diff --git a/hypr/hyprland.lua b/hypr/hyprland.lua index ca2cf2a..6931483 100644 --- a/hypr/hyprland.lua +++ b/hypr/hyprland.lua @@ -4,3 +4,4 @@ require("hyprland.hardware") require("hyprland.environment") require("hyprland.animations") require("hyprland.rules") +require("hyprland.mcsr") diff --git a/hypr/hyprland/binds.lua b/hypr/hyprland/binds.lua index eea870f..ae66f2c 100644 --- a/hypr/hyprland/binds.lua +++ b/hypr/hyprland/binds.lua @@ -1,4 +1,4 @@ -local function bind(keys, dispatcher, flags) +function bind(keys, dispatcher, flags) if flags == nil then flags = {} end diff --git a/hypr/hyprland/mcsr.lua b/hypr/hyprland/mcsr.lua index 4ded7f4..210f544 100644 --- a/hypr/hyprland/mcsr.lua +++ b/hypr/hyprland/mcsr.lua @@ -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")) diff --git a/hypr/hyprland/rules.lua b/hypr/hyprland/rules.lua index f61470a..241316d 100644 --- a/hypr/hyprland/rules.lua +++ b/hypr/hyprland/rules.lua @@ -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