diff options
Diffstat (limited to 'config/hypr/UserConfigs/user_keybinds.lua')
| -rw-r--r-- | config/hypr/UserConfigs/user_keybinds.lua | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/config/hypr/UserConfigs/user_keybinds.lua b/config/hypr/UserConfigs/user_keybinds.lua new file mode 100644 index 00000000..91872105 --- /dev/null +++ b/config/hypr/UserConfigs/user_keybinds.lua @@ -0,0 +1,40 @@ +-- User keybind overrides (auto-generated). +-- Add keybinds with bind("MODS", "KEY", fn, opts). +-- Example: +-- bind("SUPER", "Z", exec_cmd("ghostty"), { description = "Launch ghostty" }) +-- Helper functions live in ~/.config/hypr/lua/user_keybinds_helper.lua so they can be updated separately. +local user_keybinds_helper = nil +do + local source = (debug.getinfo(1, "S") or {}).source or "" + local source_path = source:match("^@(.+)$") + local source_dir = source_path and source_path:match("^(.*)/[^/]+$") or nil + local home = os.getenv("HOME") or "" + local candidate_paths = { + source_dir and (source_dir .. "/../lua/user_keybinds_helper.lua") or nil, + home ~= "" and (home .. "/.config/hypr/lua/user_keybinds_helper.lua") or nil, + home ~= "" and (home .. "/.config/hypr/user_keybinds_helper.lua") or nil, + } + + local tried_paths = {} + for _, helper_path in ipairs(candidate_paths) do + if helper_path then + table.insert(tried_paths, helper_path) + local f = io.open(helper_path, "r") + if f then + f:close() + local loaded_ok, loaded_helpers = pcall(dofile, helper_path) + if loaded_ok and type(loaded_helpers) == "table" and loaded_helpers.bind then + user_keybinds_helper = loaded_helpers + break + end + end + end + end + + if not user_keybinds_helper then + error("Failed to load user_keybinds_helper.lua from: " .. table.concat(tried_paths, ", ")) + end +end +local exec_cmd = user_keybinds_helper.exec_cmd +local bind = user_keybinds_helper.bind + |
