From d019822a699e0599e6836f5e103a2bdb4e494971 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Sat, 20 Jun 2026 07:56:15 +0200 Subject: [PATCH] feat: fix workspace rules for docked --- config/hypr/hyprland.lua | 7 ++- config/hypr/hyprland/workspacerules/main.lua | 65 +++++++++++--------- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/config/hypr/hyprland.lua b/config/hypr/hyprland.lua index c5b90b6..7b5de41 100644 --- a/config/hypr/hyprland.lua +++ b/config/hypr/hyprland.lua @@ -18,7 +18,10 @@ if read_docked and laptop_config then is_docked = true end -hl.notification.create({ text = "Config for " .. (laptop_config and "laptop" or "desktop") .. " loaded", timeout = 5000 }) +hl.notification.create({ + text = "Config for " .. (laptop_config and "laptop" or "desktop") .. " loaded", + timeout = 5000, +}) -- Core require("hyprland.colors") @@ -45,7 +48,7 @@ require("hyprland.windowrules.tags") require("hyprland.windowrules.workspaces") -- Workspace rules -require("hyprland.workspacerules.main") +require("hyprland.workspacerules.main")(laptop_config, is_docked) -- Monitors require("hyprland.monitors")(laptop_config, is_docked) diff --git a/config/hypr/hyprland/workspacerules/main.lua b/config/hypr/hyprland/workspacerules/main.lua index 30779bd..54fdb9f 100644 --- a/config/hypr/hyprland/workspacerules/main.lua +++ b/config/hypr/hyprland/workspacerules/main.lua @@ -1,30 +1,35 @@ -hl.workspace_rule({ - workspace = "1", - monitor = "DP-1", - default = true, -}) -hl.workspace_rule({ - workspace = "2", - monitor = "HDMI-A-1", - default = true, -}) -hl.workspace_rule({ - workspace = "2", - monitor = "DP-2", - default = true, -}) -hl.workspace_rule({ - workspace = "3", - monitor = "DP-1", - default = false, -}) -hl.workspace_rule({ - workspace = "4", - monitor = "DP-2", - default = false, -}) -hl.workspace_rule({ - workspace = "4", - monitor = "HDMI-A-1", - default = false, -}) +return function(is_laptop, is_docked) + hl.workspace_rule({ + workspace = "1", + monitor = "DP-1", + default = true, + }) + hl.workspace_rule({ + workspace = "3", + monitor = "DP-1", + default = false, + }) + if not is_laptop then + hl.workspace_rule({ + workspace = "2", + monitor = "DP-2", + default = true, + }) + hl.workspace_rule({ + workspace = "4", + monitor = "DP-2", + default = false, + }) + elseif is_docked then + hl.workspace_rule({ + workspace = "2", + monitor = "HDMI-A-1", + default = true, + }) + hl.workspace_rule({ + workspace = "4", + monitor = "HDMI-A-1", + default = false, + }) + end +end