Skip to content

Instantly share code, notes, and snippets.

@lidgnulinux
Created January 7, 2023 07:56
Show Gist options
  • Save lidgnulinux/72659b321b5ed2642ed3193ae90039bd to your computer and use it in GitHub Desktop.
Save lidgnulinux/72659b321b5ed2642ed3193ae90039bd to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
menu=" Minimize\n Floating Toggle\n Window Shot\n Close"
active=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused) | .rect | "\(.x),\(.y)"')
x_cord=$(echo "$active" | cut -d ',' -f 1)
y_cord=$(echo "$active" | sed -e 's/^.*,//g')
selected=$(echo -e $menu | wofi -d -x $(expr $x_cord + 10) -y $(expr $y_cord - 20) -W 10% --prompt="Window Menu" --lines 5 | awk '{print tolower ($2)}')
case $selected in
minimize)
exec swaymsg move scratchpad;;
close)
exec swaymsg kill;;
floating)
exec swaymsg floating toggle;;
window)
exec imv $(grimshot save active);;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment