1
0
Fork 0

Redo and simplify sway bindings for launching commands and opening files

main
urosm 2024-10-12 00:25:37 +02:00
parent ac905c3083
commit 8e1d649176
2 changed files with 7 additions and 31 deletions

View File

@ -32,8 +32,6 @@ set $wsp 9:p:top
set $session_mode "session: (r)eload (l)ock (q)uit (s)uspend (h)ibernate re(b)oot (p)oweroff"
set $layout_mode "layout: split(h) split(v) (s)tacking (t)abbed"
set $find_exclude_expr \( -path "$HOME/.cache" -o -path "$HOME/.mozilla" -o -path "$HOME/.thunderbird" -o -name .git \)
# commands
set $swaylock swaylock -f \
--color=$black \
@ -158,18 +156,13 @@ bindsym $mod+semicolon scratchpad show
bindsym $mod+shift+g sticky toggle
# exec
bindsym --to-code {
$mod+return exec "$TERMINAL"
$mod+space exec fuzzel
$mod+slash exec find "$HOME" $find_exclude_expr -prune -o -print | fuzzel -dp'open > ' | xargs -r xdg-open
$mod+question exec find "$HOME" $find_exclude_expr -prune -o -type f -print0 | xargs -0r grep -in "$(wl-paste)" 2>/dev/null | awk -F: '{ printf("%8s %-62s\t%-80s\\n","+"$2,"\\""$1"\\"",$3) }' | fuzzel -dw160 -p"open > " | cut -f1 | xargs -r "$TERMINAL" "$EDITOR"
$mod+apostrophe exec swaymsg -t get_tree | jq -r 'recurse(.nodes[]) | select(.nodes==[] and .type=="con" and .focused==false) | (.id|tostring) + "\t" + .name' | fuzzel -dp'focus > ' | cut -f1 | xargs -rI{} swaymsg [con_id={}] focus
$mod+home exec "$TERMINAL" nmtui connect
$mod+shift+home exec "$TERMINAL" nmtui
$mod+end exec devmon -c
$mod+n exec makoctl dismiss
$mod+shift+n exec makoctl restore
print exec grim - | wl-copy
bindsym {
$mod+return exec $TERMINAL
$mod+n exec makoctl dismiss
$mod+shift+n exec makoctl restore
print exec grim - | wl-copy
$mod+space exec fuzzel
$mod+shift+space exec 'cd $(find -type d | fuzzel -dp"cd > "); find | fuzzel -dp"open > " | xargs -rI{} xdg-open "{}"'
}
# exec (laptop)

View File

@ -1,17 +0,0 @@
#!/bin/sh
case "$(file -i "$1" 2>/dev/null)" in
*": text/"* | *": application/javascript"*)
DIRPATH="$(dirname "$1")"
while :; do
[ "$DIRPATH" = "/" ] && DIRPATH=$HOME
[ "$DIRPATH" = "$HOME" ] || [ -n "$(find "$DIRPATH" ! -path "$DIRPATH" -prune -type d -name .git)" ] && break
DIRPATH="$(dirname "$DIRPATH")"
done
exec $TERMINAL -D "$DIRPATH" "$EDITOR" "$1"
;;
*": inode/directory;"*)
exec $TERMINAL -D "$1"
;;
*) exec /usr/bin/xdg-open "$1" ;;
esac