You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I wrote a simple script to able to toggle the smart gaps for the active workspace ( with a keybind ).
By default I have gaps in my config file, but from time to time I want to toggle them for a given workspace.
In general I am wondering if there is a more efficient/easier way to achieve this and to share this script for anyone who might need something similar. Let me know your thoughts or if you have any suggestions for improvement!
* I have seen ##1345 but it is not quite the same as there is no keybind setup or runtime toggle mechanism mentioned in the answer.
~/.config/hypr/hyprland.conf
# toggle smart gaps for active workspacebind = $mainMod, T, exec, ~/.config/hypr/scripts/toggle-gaps.sh
~/.config/hypr/scripts/toggle-gaps.sh
#!/usr/bin/env bash# get active workspace id
id=$(hyprctl -j activeworkspace | jq ".id")# set range variable in order to match the workspace (not working by id only)
rid="r[$id-$id]"# default gaps values - can get them with hyprctl too
gaps_in_default=5 # hyprctl getoption general:gaps_in
gaps_out_default=10 # hyprctl getoption general:gaps_out# current gaps for active workspace
gaps_in_current=$(hyprctl workspacerules -j | jq --arg rid "$rid"'[.[] | select(.workspaceString | startswith($rid)) | .gapsIn[0]] | .[0]')
gaps_out_current=$(hyprctl workspacerules -j | jq --arg rid "$rid"'[.[] | select(.workspaceString | startswith($rid)) | .gapsOut[0]] | .[0]')# toggle gaps for the active workspaceif [[ ("$gaps_in_current" == "null"&&"$gaps_out_current" == "null") || ("$gaps_in_current" == "$gaps_in_default"&&"$gaps_out_current" == "$gaps_out_default") ]];then
hyprctl keyword workspace $rid f[1], gapsin:0, gapsout:0
hyprctl keyword workspace $rid w[tv1], gapsin:0, gapsout:0
else
hyprctl keyword workspace $rid f[1], gapsin:$gaps_in_default, gapsout:$gaps_out_default
hyprctl keyword workspace $rid w[tv1], gapsin:$gaps_in_default, gapsout:$gaps_out_defaultfi
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I wrote a simple script to able to toggle the smart gaps for the active workspace ( with a keybind ).
By default I have gaps in my config file, but from time to time I want to toggle them for a given workspace.
In general I am wondering if there is a more efficient/easier way to achieve this and to share this script for anyone who might need something similar. Let me know your thoughts or if you have any suggestions for improvement!
*
I have seen ##1345 but it is not quite the same as there is no keybind setup or runtime toggle mechanism mentioned in the answer.~/.config/hypr/hyprland.conf
~/.config/hypr/scripts/toggle-gaps.sh
Beta Was this translation helpful? Give feedback.
All reactions