Skip to content

Instantly share code, notes, and snippets.

@lidgnulinux
Created January 16, 2023 02:08
Show Gist options
  • Save lidgnulinux/a9fe11be7394582e9b5ba4ee1f2c0952 to your computer and use it in GitHub Desktop.
Save lidgnulinux/a9fe11be7394582e9b5ba4ee1f2c0952 to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
menu=" Minimize\n Floating Toggle\n Window Shot\n Move Workspace\n Close"
swspc () {
wspc=$(wofi -d -W 15% --prompt="Move To Worspace" --lines=2); swaymsg move window to workspace $wspc
}
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)}')
selected=$(echo -e $menu | wofi -d -x $(expr $x_cord + 10) -y $(expr $y_cord + 5) -W 10% --prompt="Window Menu" --lines 6 | awk '{print tolower ($2)}')
case $selected in
minimize)
exec swaymsg move scratchpad;;
close)
exec swaymsg kill;;
floating)
exec swaymsg floating toggle;;
window)
exec /usr/bin/imv-wayland $(grimshot save active);;
move)
swspc;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment