minimum functionality restored kinda

This commit is contained in:
2026-05-13 12:39:49 +01:00
parent 92e9dd1b8e
commit f678372ee4
4 changed files with 88 additions and 13 deletions

View File

@@ -125,18 +125,8 @@ local mainMod = "SUPER" -- Sets "Windows" key as main modifier
-- Example binds, see https://wiki.hypr.land/Configuring/Basics/Binds/ for more -- Example binds, see https://wiki.hypr.land/Configuring/Basics/Binds/ for more
-- Move focus with mainMod + arrow keys -- Move focus with mainMod + arrow keys
hl.bind(mainMod .. " + h", hl.dsp.focus({ direction = "left" }))
hl.bind(mainMod .. " + l", hl.dsp.focus({ direction = "right" }))
hl.bind(mainMod .. " + k", hl.dsp.focus({ direction = "up" }))
hl.bind(mainMod .. " + j", hl.dsp.focus({ direction = "down" }))
-- Switch workspaces with mainMod + [0-9] -- Switch workspaces with mainMod + [0-9]
-- Move active window to a workspace with mainMod + SHIFT + [0-9] -- Move active window to a workspace with mainMod + SHIFT + [0-9]
for i = 1, 10 do
local key = i % 10 -- 10 maps to key 0
hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i }))
hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }))
end
-- Example special workspace (scratchpad) -- Example special workspace (scratchpad)
hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("magic")) hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("magic"))

View File

@@ -15,10 +15,10 @@ end
-- Delete windows -- Delete windows
hl.bind(mainMod .. " + backspace", hl.dsp.window.close()) hl.bind(mainMod .. " + backspace", hl.dsp.window.close())
-- If otter is open, focus it, if not make a new window
hl.bind(mainMod .. "d", function() hl.bind(mainMod .. "d", function()
hl.notification.create({ text = tostring(hl.get_windows({ class = "otter" })[1]), timeout = 3000, icon = "ok" })
if hl.get_windows({ class = "otter" })[1] ~= nil then if hl.get_windows({ class = "otter" })[1] ~= nil then
hl.dsp.focus({ window = { class = "otter" } }) hl.dispatch(hl.dsp.focus({ window = "class:otter" }))
else else
hl.exec_cmd("kitty --class otter --title otter-launcher -e sh -c 'sleep 0.05 && otter-launcher'") hl.exec_cmd("kitty --class otter --title otter-launcher -e sh -c 'sleep 0.05 && otter-launcher'")
end end
@@ -51,4 +51,67 @@ for index, bind in ipairs(keyboardSplit) do
hl.bind(mainMod .. "SHIFT + " .. bind, hl.dsp.window.move({ workspace = index, follow = false })) hl.bind(mainMod .. "SHIFT + " .. bind, hl.dsp.window.move({ workspace = index, follow = false }))
end end
-- Music workspace
hl.bind(mainMod .. "m", hl.dsp.workspace.toggle_special("music"))
-- Move windows with hjkl -- Move windows with hjkl
hl.bind(mainMod .. "SHIFT + h", hl.dsp.layout("swapcol l"))
hl.bind(mainMod .. "SHIFT + l", hl.dsp.layout("swapcol r"))
hl.bind(mainMod .. "k", hl.dsp.focus({ direction = "up" }))
hl.bind(mainMod .. "j", hl.dsp.focus({ direction = "down" }))
-- Function to get window position relative to monitor
local function normalise_current_window_pos()
local active = hl.get_active_window()
if active then
local xpos = active.at.x
-- If on right monitor
if xpos > 1920 then
xpos = xpos - 1920
return xpos
-- If on left monitor
elseif xpos < 1 then
xpos = xpos + 1920
return xpos
else
return xpos
end
end
end
hl.bind(mainMod .. "h", function()
local pos = normalise_current_window_pos()
if pos then
-- 9 derived from 5 gap plus 3 border (8), so first pixel of window is 9
if pos == 9 then
-- If first window, then move to monitor to the left
hl.dispatch(hl.dsp.focus({ monitor = "-1" }))
end
end
hl.dispatch(hl.dsp.layout("move -col"))
end)
hl.bind(mainMod .. "l", function()
-- Move before so you can detect if it is the last window
hl.dispatch(hl.dsp.layout("move +col"))
if not normalise_current_window_pos() then
-- Go back a window
hl.dispatch(hl.dsp.layout("move -col"))
-- Move to monitor to the right
hl.dispatch(hl.dsp.focus({ monitor = "+1" }))
end
end)
-- Fullscreen with b
hl.bind(mainMod .. "b", hl.dsp.window.fullscreen({ action = "toggle" }))
-- Special workspace
hl.bind(mainMod .. "minus", hl.dsp.workspace.toggle_special("scratch"))
hl.bind(mainMod .. "SHIFT + minus", hl.dsp.window.move({ workspace = "special:scratch", follow = false }))
-- Float resize and move window with mouse
hl.bind(subMod .. "mouse:272", hl.dsp.window.drag(), { mouse = true, drag = true })
hl.bind(subMod .. "mouse:272", hl.dsp.window.float(), { mouse = true, click = true })
hl.bind(subMod .. "mouse:272", hl.dsp.layout("promote"), { mouse = true, release = true })
hl.bind(subMod .. "SHIFT + mouse:272", hl.dsp.window.resize(), { mouse = true })

22
modules/rules.lua Normal file
View File

@@ -0,0 +1,22 @@
hl.window_rule({
name = "otter-launcher",
match = {
class = "otter",
},
float = true,
size = { 410, 220 },
opaque = true,
})
hl.window_rule({
name = "nodim-youtube",
})
hl.workspace_rule({
workspace = "special:music",
gaps_out = {
left = 400,
right = 400,
bottom = 400,
},
})

View File

@@ -25,7 +25,7 @@ hl.config({
scrolling = { scrolling = {
column_width = 0.8, column_width = 0.8,
follow_min_visible = 0.1, follow_min_visible = 0.1,
focus_fit_method = 0, focus_fit_method = 1,
wrap_focus = false, wrap_focus = false,
wrap_swapcol = false, wrap_swapcol = false,
}, },