Skip to content

Instantly share code, notes, and snippets.

@lidgnulinux
Created May 30, 2026 13:14
Show Gist options
  • Select an option

  • Save lidgnulinux/c164a27a332bf4b550b7af0910ac935b to your computer and use it in GitHub Desktop.

Select an option

Save lidgnulinux/c164a27a332bf4b550b7af0910ac935b to your computer and use it in GitHub Desktop.
Hyprland simple window menu.
#!/bin/bash
menu="Floating Toggle\nMove Workspace\nCapture Window\nClose"
xc=$(hyprctl activewindow -j | jq -r '.at.[0]')
yc=$(hyprctl activewindow -j | jq -r '.at.[1]')
w=$(hyprctl activewindow -j | jq -r '.size.[0]')
h=$(hyprctl activewindow -j | jq -r '.size.[1]')
pos="$(grep 'location: top' ~/.config/hypr/yambar.yml)"
if [[ -n $pos ]]
then selected=$(echo -e $menu \
| wofi -d --prompt="Window Menu" \
-x $(expr $xc + 10) \
-y $(expr $yc - 15) \
-W 10% --lines 5 \
| awk '{print tolower ($1)}')
else selected=$(echo -e $menu \
| wofi -d --prompt="Window Menu" \
-x $(expr $xc + 10) \
-y $(expr $yc + 10) \
-W 10% --lines 5 \
| awk '{print tolower ($1)}')
fi
ws() {
wspc=$(wofi -d --prompt="Workspace" --lines 2 -W 10%); \
hyprctl dispatch "hl.dsp.window.move({ workspace = $wspc })"
}
case $selected in
close)
exec hyprctl dispatch "hl.dsp.window.close()";;
floating)
exec hyprctl dispatch "hl.dsp.window.float({ action = "toggle" })";;
move)
ws;;
capture)
exec grim -g "$xc,$yc ${w}x${h}" \
/home/lfs/Pictures/IMG-$(date +'%Y%m%d_%H%M%S').png;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment