From b7c2682ca0054b565e79fe590dd0398020406f44 Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 17 Jul 2025 22:01:04 +0200 Subject: [PATCH 1/2] pbfile function in macos.plugin.zsh --- plugins/macos/macos.plugin.zsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugins/macos/macos.plugin.zsh b/plugins/macos/macos.plugin.zsh index 4d73d22c3..1cda6e719 100644 --- a/plugins/macos/macos.plugin.zsh +++ b/plugins/macos/macos.plugin.zsh @@ -314,3 +314,19 @@ source "${0:h:A}/music" # Spotify control function source "${0:h:A}/spotify" + +# Copy file to the macOS pasteboard +function pbfile() { + if [[ $# -ne 1 ]]; then + echo "Usage: pbfile " + return 1 + fi + + if [[ ! -e "$1" ]]; then + echo "File not found: $1" + return 1 + fi + + osascript -e "tell application \"Finder\" to set the clipboard to (POSIX file \"$(realpath "$1")\")" + echo "Copied $1 to pasteboard" +} From 742f6af6d377d9e573c5b9f993e5cab8c2a56ce5 Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 17 Jul 2025 22:05:34 +0200 Subject: [PATCH 2/2] pbfile function in README.md --- plugins/macos/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/macos/README.md b/plugins/macos/README.md index ccc4331e5..ac6ca0b86 100644 --- a/plugins/macos/README.md +++ b/plugins/macos/README.md @@ -39,6 +39,7 @@ plugins=(... macos) | `rmdsstore` | Remove .DS_Store files recursively in a directory | | `btrestart` | Restart the Bluetooth daemon | | `freespace` | Erases purgeable disk space with 0s on the selected disk | +| `pbfile` | Copy the file reference to the macOS pasteboard | ## Acknowledgements