Skip to content

Instantly share code, notes, and snippets.

@gngeorgiev
Last active May 11, 2025 19:46
Show Gist options
  • Save gngeorgiev/faff04ee9be262fe37db194839eb65a8 to your computer and use it in GitHub Desktop.
Save gngeorgiev/faff04ee9be262fe37db194839eb65a8 to your computer and use it in GitHub Desktop.
Hacky maximized, minimized, fullscreen window state for waybar. Put the window-state widget right after the hyprland/window widget. Optionally style them the same so they appear as the same widgget.
"custom/window-state": {
"exec": "~/.config/waybar/scripts/window-state.sh",
"interval": 1,
"format": "{text}",
"return-type": "json",
},
#!/bin/bash
window_info=$(hyprctl activewindow -j)
is_floating=$(echo "$window_info" | jq -r '.floating')
fullscreen_state=$(echo "$window_info" | jq -r '.fullscreen')
state=""
if [[ "$is_floating" == "true" ]]; then
state="[Floating]"
fi
if [[ "$fullscreen_state" == "2" ]]; then
state="[Fullscreen]"
elif [[ "$fullscreen_state" == "1" ]]; then
state="[Maximized]"
fi
echo "{\"text\": \"$state\" }"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment