-- Tiling only: keep every workspace on Hyprland's dwindle (tiling) layout.
--
-- Omarchy lets each workspace cycle between tiling, scrolling and floating
-- (Super+L, Super+Alt+L, clicking the active workspace in the bar, or
-- Appearance > Workspace Layout). All of those go through o.workspace_mode, so
-- it is wrapped here to always pick dwindle. ~/.local/bin/tiling-only-cleanup.sh
-- removes the layout Omarchy saves afterwards and corrects the notification.

-- Omarchy loads the saved layouts after this file (default/hypr/toggles.lua),
-- so they pass through the wrapper too.
require("default.hypr.workspace-modes")

local cleanup = os.getenv("HOME") .. "/.local/bin/tiling-only-cleanup.sh"
local original = o.workspace_mode

function o.workspace_mode(spec)
  local requested = spec.default or spec.mode
  if spec.default then spec.default = "dwindle" end
  if spec.mode then spec.mode = "dwindle" end
  original(spec)
  if requested and requested ~= "dwindle" then
    hl.exec_cmd(cleanup)
  end
end

-- No layout cycling keys (were: cycle workspace layout / cycle back).
hl.unbind("SUPER + L")
hl.unbind("SUPER + ALT + L")
