diff --git a/.config/hypr/apps.lua b/.config/hypr/apps.lua index 927d0c7..d0c2fd9 100644 --- a/.config/hypr/apps.lua +++ b/.config/hypr/apps.lua @@ -228,6 +228,7 @@ hl.window_rule({ hl.window_rule({ name = "steam-float", float = true, + no_initial_focus = true, workspace = "name:Gaming_1", idle_inhibit = "fullscreen", match = { diff --git a/.config/hypr/workspaces.lua b/.config/hypr/workspaces.lua index 88168c1..07df71e 100644 --- a/.config/hypr/workspaces.lua +++ b/.config/hypr/workspaces.lua @@ -6,15 +6,7 @@ local workspace_map = { "Writing", } -local monitor_binds = {} - local function setup_monitors() - -- Clear old binds - for _, bind in ipairs(monitor_binds) do - hl.unbind(bind) - end - monitor_binds = {} - local monitors = hl.get_monitors() local monitor_count = #monitors @@ -32,28 +24,31 @@ local function setup_monitors() default = i == 1, }) - table.insert( - monitor_binds, - hl.bind( - "SUPER + code:1" .. (i - 1), - hl.dsp.focus({ workspace = "name:" .. workspace_name }), - { description = "Switch to workspace " .. workspace_map[i] } - ) + hl.bind( + "SUPER + code:1" .. (i - 1), + hl.dsp.focus({ workspace = "name:" .. workspace_name }), + { description = "Switch to workspace " .. workspace_map[i] } ) end - table.insert( - monitor_binds, - hl.bind("SUPER + SHIFT + code:1" .. (i - 1), function() - local active_workspace = hl.get_active_workspace() - local active_workspace_name = active_workspace.name - local monitor_suffix = active_workspace_name:match("_(%d+)$") or "1" - local new_workspace = "name:" .. workspace_map[i] .. "_" .. monitor_suffix - -- local new_workspace = (i - 1) * monitor_count + active_workspace.id - hl.notification.create({ text = new_workspace, duration = 2000 }) - hl.dispatch(hl.dsp.window.move({ workspace = new_workspace, follow = false })) - end, { description = "Move window to workspace " .. workspace_map[i] }) - ) + hl.bind("SUPER + SHIFT + code:1" .. (i - 1), function() + local active_workspace = hl.get_active_workspace() + local active_workspace_name = active_workspace.name + local monitor_suffix = active_workspace_name:match("_(%d+)$") or "1" + local new_workspace = "name:" .. workspace_map[i] .. "_" .. monitor_suffix + -- local new_workspace = (i - 1) * monitor_count + active_workspace.id + hl.notification.create({ text = new_workspace, duration = 2000 }) + hl.dispatch(hl.dsp.window.move({ workspace = new_workspace, follow = false })) + end, { description = "Move window to workspace " .. workspace_map[i] }) + end + + -- A hack to move to the Home workspace when Hyprland first loads + if hl.get_active_workspace().id == 1 then + for j = monitor_count, 1, -1 do + local monitor = monitors[j] + hl.dispatch(hl.dsp.focus({ monitor = monitor.name })) + hl.dispatch(hl.dsp.focus({ workspace = "name:Home_" .. j, on_current_monitor = true })) + end end end