Fix mcsr/global binds
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
local function bind(keys, dispatcher, flags)
|
||||
function bind(keys, dispatcher, flags)
|
||||
if flags == nil then
|
||||
flags = {}
|
||||
end
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
local function mcsr_submap(window, active)
|
||||
if window ~= nil and window.class ~= nil and window.class:find("Minecraft") then
|
||||
hl.dispatch(hl.dsp.submap("mcsr"))
|
||||
else
|
||||
hl.dispatch(hl.dsp.submap("reset"))
|
||||
end
|
||||
end
|
||||
hl.on("window.active", mcsr_submap)
|
||||
hl.bind("mouse:275", function() mcsr_submap(hl.get_active_window(), nil) end)
|
||||
|
||||
local function remap(from, to)
|
||||
hl.bind(from, hl.dsp.send_key_state({mods = "", key = to, state = "down"}), {transparent = true})
|
||||
hl.bind(from, hl.dsp.send_key_state({mods = "", key = to, state = "up"}), {transparent = true, release = true})
|
||||
hl.bind(from, hl.dsp.send_key_state({mods = "", key = to, state = "down"}), {ignore_mods = true, transparent = true})
|
||||
hl.bind(from, hl.dsp.send_key_state({mods = "", key = to, state = "up"}), {ignore_mods = true, transparent = true, release = true})
|
||||
end
|
||||
|
||||
-- #MCSR
|
||||
@@ -34,20 +24,16 @@ hl.define_submap("mcsr", function()
|
||||
hl.bind("KP_NEXT", hl.dsp.window.resize({x = 2540, y = 400}))
|
||||
hl.bind("KP_NEXT", hl.dsp.window.center())
|
||||
|
||||
-- Close boateye
|
||||
-- FIXME: use hl.on() to couple this to the actions of fullscreening/floating
|
||||
-- instead of the keybinds
|
||||
hl.bind("SUPER + F", hl.dsp.exec_cmd("quickshell ipc call boateye close"))
|
||||
hl.bind("SUPER + M", hl.dsp.exec_cmd("quickshell ipc call boateye close"))
|
||||
|
||||
-- Search crafting mappings
|
||||
remap("mouse:275", "f3")
|
||||
remap("SHIFT + mouse:275", "f3")
|
||||
remap("1", "apostrophe")
|
||||
remap("apostrophe", "1")
|
||||
remap("k", "0")
|
||||
remap("semicolon", "w")
|
||||
remap("j", "v")
|
||||
|
||||
hl.bind("SUPER_L", hl.dsp.submap("reset"))
|
||||
end)
|
||||
|
||||
-- Close boateye
|
||||
-- FIXME: use hl.on() to couple this to the actions of fullscreening/floating
|
||||
-- instead of the keybinds
|
||||
bind("SUPER + F", hl.dsp.exec_cmd("quickshell ipc call boateye close"))
|
||||
bind("SUPER + M", hl.dsp.exec_cmd("quickshell ipc call boateye close"))
|
||||
|
||||
@@ -55,10 +55,20 @@ hl.window_rule({
|
||||
float = true,
|
||||
size = { "monitor_w*0.95", "monitor_h*0.95"}
|
||||
})
|
||||
hl.layer_rule({
|
||||
match = { namespace = "quickshell" },
|
||||
no_anim = true
|
||||
})
|
||||
|
||||
hl.on("window.active", function(window, active)
|
||||
if window ~= nil and window.class ~= nil and window.class:find("zen") == 1 then
|
||||
if window == nil or window.class == nil then
|
||||
hl.dispatch(hl.dsp.submap("reset"))
|
||||
return
|
||||
end
|
||||
if window.class:find("zen") == 1 then
|
||||
hl.dispatch(hl.dsp.submap("zen"))
|
||||
elseif window.class:find("Minecraft") == 1 then
|
||||
hl.dispatch(hl.dsp.submap("mcsr"))
|
||||
else
|
||||
hl.dispatch(hl.dsp.submap("reset"))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user