From e2e3fbebc6061e534770661faa5b97dd8dcb0425 Mon Sep 17 00:00:00 2001 From: Robert Stringer <62722976+pipetogrep@users.noreply.github.com> Date: Thu, 23 Apr 2026 15:17:02 +0100 Subject: [PATCH] Persist workspace layout toggles Store the selected workspace layout in the existing Hyprland toggle state instead of applying it with a runtime-only hyprctl keyword. Hyprland intentionally drops keyword changes on config reload, so writing a sourced config entry lets the layout survive theme changes, reloads, and reboot. Rely on the Omarchy toggle setup to create the toggle directory, matching the other persistent Hyprland toggles. The workspace layout file is created by the append path the first time a workspace layout is persisted. --- bin/omarchy-hyprland-workspace-layout-toggle | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/omarchy-hyprland-workspace-layout-toggle b/bin/omarchy-hyprland-workspace-layout-toggle index 189a469421..3b492467e4 100755 --- a/bin/omarchy-hyprland-workspace-layout-toggle +++ b/bin/omarchy-hyprland-workspace-layout-toggle @@ -2,6 +2,7 @@ # Toggle the layout on the current active workspace between dwindle and scrolling +LAYOUTS_CONF="$HOME/.local/state/omarchy/toggles/hypr/workspace-layouts.conf" ACTIVE_WORKSPACE=$(hyprctl activeworkspace -j | jq -r '.id') CURRENT_LAYOUT=$(hyprctl activeworkspace -j | jq -r '.tiledLayout') @@ -10,5 +11,11 @@ case "$CURRENT_LAYOUT" in *) NEW_LAYOUT=dwindle ;; esac -hyprctl keyword workspace $ACTIVE_WORKSPACE, layout:$NEW_LAYOUT +if [[ -f $LAYOUTS_CONF ]] && grep -q "^workspace = $ACTIVE_WORKSPACE," "$LAYOUTS_CONF"; then + sed -i "s/^workspace = $ACTIVE_WORKSPACE,.*/workspace = $ACTIVE_WORKSPACE, layout:$NEW_LAYOUT/" "$LAYOUTS_CONF" +else + echo "workspace = $ACTIVE_WORKSPACE, layout:$NEW_LAYOUT" >> "$LAYOUTS_CONF" +fi + +hyprctl reload notify-send -u low "󱂬 Workspace layout set to $NEW_LAYOUT"