Workspaces bruh
This commit is contained in:
@@ -11,15 +11,15 @@ local function setup_monitors()
|
|||||||
local monitor_count = #monitors
|
local monitor_count = #monitors
|
||||||
|
|
||||||
-- Move active window to a workspace with SUPER + SHIFT + [1-5]
|
-- Move active window to a workspace with SUPER + SHIFT + [1-5]
|
||||||
for i = 1, 5 do
|
for i = 1, #workspace_map do
|
||||||
for j = monitor_count, 1, -1 do
|
for j = monitor_count, 1, -1 do
|
||||||
local monitor = monitors[j]
|
local monitor = monitors[j]
|
||||||
-- local workspace_id = "name:" .. workspace_map[i] .. "_" .. j
|
-- local workspace_id = "name:" .. workspace_map[i] .. "_" .. j
|
||||||
local workspace_id = (i - 1) * monitor_count + j
|
local workspace_id = (i - 1) * monitor_count + j
|
||||||
local workspace_name = workspace_map[i] .. "_" .. j
|
local workspace_name = workspace_map[i] .. "_" .. j
|
||||||
hl.workspace_rule({
|
hl.workspace_rule({
|
||||||
workspace = workspace_id,
|
workspace = "name:" .. workspace_name,
|
||||||
default_name = workspace_name,
|
-- default_name = workspace_name,
|
||||||
monitor = monitor.name,
|
monitor = monitor.name,
|
||||||
default = i == 1,
|
default = i == 1,
|
||||||
})
|
})
|
||||||
@@ -32,22 +32,20 @@ local function setup_monitors()
|
|||||||
end
|
end
|
||||||
|
|
||||||
hl.bind("SUPER + SHIFT + code:1" .. (i - 1), function()
|
hl.bind("SUPER + SHIFT + code:1" .. (i - 1), function()
|
||||||
local active_workspace = hl.get_active_workspace()
|
local active_window = hl.get_active_window()
|
||||||
|
local active_workspace = active_window.workspace
|
||||||
local active_workspace_name = active_workspace.name
|
local active_workspace_name = active_workspace.name
|
||||||
local monitor_suffix = active_workspace_name:match("_(%d+)$") or "1"
|
local monitor_suffix = active_workspace_name:match("_(%d+)$") or "1"
|
||||||
local new_workspace = "name:" .. workspace_map[i] .. "_" .. monitor_suffix
|
local new_workspace = "name:" .. workspace_map[i] .. "_" .. monitor_suffix
|
||||||
-- local new_workspace = (i - 1) * monitor_count + active_workspace.id
|
-- 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, window = active_window, follow = false }))
|
||||||
hl.dispatch(hl.dsp.window.move({ workspace = new_workspace, follow = false }))
|
|
||||||
end, { description = "Move window to workspace " .. workspace_map[i] })
|
end, { description = "Move window to workspace " .. workspace_map[i] })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- A hack to move to the Home workspace when Hyprland first loads
|
-- 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
|
for j = monitor_count, 1, -1 do
|
||||||
local monitor = monitors[j]
|
if hl.get_workspaces()[j].id > 0 and monitor_count == 2 then
|
||||||
hl.dispatch(hl.dsp.focus({ monitor = monitor.name }))
|
hl.dispatch(hl.dsp.focus({ workspace = "name:Home_" .. j }))
|
||||||
hl.dispatch(hl.dsp.focus({ workspace = "name:Home_" .. j, on_current_monitor = true }))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user