feat(hyprlua): file-picker-to-clipboard binds on Super+F / Super+Shift+F
Add filepicker-clipboard.sh: a zenity file dialog that copies the selected file's path (Super+F) or contents (Super+Shift+F) to the clipboard via wl-copy. Path mode collapses $HOME to ~. Repoints Super+F / Super+Shift+F from wofi-file-search/foldersearch (kept as comments) in usr/binds.lua. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>feat/astal-menu
parent
b879b1ae89
commit
8ca1026552
|
|
@ -51,8 +51,12 @@ hl.bind(mainMod .. " + SHIFT + RETURN", hl.dsp.exec_cmd(winswitch))
|
|||
hl.bind(mainMod .. " + SHIFT + R", hl.dsp.exec_cmd("wofi --show drun"))
|
||||
hl.bind("CTRL + SHIFT + R", hl.dsp.exec_cmd(menu))
|
||||
|
||||
hl.bind(mainMod .. " + F", hl.dsp.exec_cmd("~/.config/scripts/wofi-file-search.sh"))
|
||||
hl.bind(mainMod .. " + SHIFT + F", hl.dsp.exec_cmd("~/.config/scripts/foldersearch.sh"))
|
||||
-- File picker dialog -> clipboard (path / contents)
|
||||
hl.bind(mainMod .. " + F", hl.dsp.exec_cmd("~/.config/scripts/filepicker-clipboard.sh path"))
|
||||
hl.bind(mainMod .. " + SHIFT + F", hl.dsp.exec_cmd("~/.config/scripts/filepicker-clipboard.sh content"))
|
||||
-- old:
|
||||
-- hl.bind(mainMod .. " + F", hl.dsp.exec_cmd("~/.config/scripts/wofi-file-search.sh"))
|
||||
-- hl.bind(mainMod .. " + SHIFT + F", hl.dsp.exec_cmd("~/.config/scripts/foldersearch.sh"))
|
||||
hl.bind(mainMod .. " + ALT + F", hl.dsp.exec_cmd("wofi-calc"))
|
||||
|
||||
hl.bind(mainMod .. " + S", hl.dsp.exec_cmd("[tag +mixer] pavucontrol"))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
# File picker dialog -> clipboard.
|
||||
# path (default): copy the selected file's absolute path
|
||||
# content : copy the selected file's contents
|
||||
# Bound to Super+F (path) and Super+Shift+F (content) in usr/binds.lua.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
mode="${1:-path}"
|
||||
|
||||
# zenity exits non-zero on cancel/close -> treat as a no-op.
|
||||
file="$(zenity --file-selection --title="Copy file ${mode} to clipboard")" || exit 0
|
||||
[ -n "$file" ] || exit 0
|
||||
|
||||
case "$mode" in
|
||||
content)
|
||||
if [ ! -r "$file" ]; then
|
||||
notify-send -u critical "File picker" "Cannot read: $file"
|
||||
exit 1
|
||||
fi
|
||||
wl-copy < "$file"
|
||||
notify-send "Copied file contents" "$(basename "$file")"
|
||||
;;
|
||||
path | *)
|
||||
# Collapse the home dir to ~
|
||||
case "$file" in
|
||||
"$HOME"/*) file="~${file#"$HOME"}" ;;
|
||||
"$HOME") file="~" ;;
|
||||
esac
|
||||
printf '%s' "$file" | wl-copy
|
||||
notify-send "Copied file path" "$file"
|
||||
;;
|
||||
esac
|
||||
Loading…
Reference in New Issue