Compare commits

...

6 Commits

Author SHA1 Message Date
wyj 900c1c8922 new: add fcitx5 module 2026-05-30 14:23:06 -04:00
wyj a4edeec23b new: add envs to modules 2026-05-30 14:22:49 -04:00
wyj 7182189e8e add: add a debug print of module loaded 2026-05-30 14:19:57 -04:00
wyj 072c5876e4 fix: fix the swayosd module 2026-05-30 14:18:17 -04:00
wyj 90f1a6b17b fix: fix the input config 2026-05-30 14:17:41 -04:00
wyj ffa71223d5 fix: fix the usermodule load 2026-05-30 14:16:56 -04:00
6 changed files with 46 additions and 14 deletions
+5 -4
View File
@@ -2,16 +2,17 @@ local M = {}
local settings = require("lua.lib.settings") local settings = require("lua.lib.settings")
M.confs = { M.confs = {
input = { touchpad = {}, gestures = {} }, input = { touchpad = {} },
gestures = {},
} }
if settings["profile"] == "desktop" then if settings["profile"] == "desktop" then
M.confs.input.numlock_by_default = true M.confs.input = table.insert(M.confs.input, { numlock_by_default = true })
elseif settings["profile"] == "laptop" then elseif settings["profile"] == "laptop" then
M.confs.input.gestures.workspace_swipe_touch = true M.confs.gestures = table.insert(M.confs.gestures, { workspace_swipe_touch = true })
M.gestures = { M.gestures = {
{ {
fingures = 3, fingers = 3,
direction = "horizontal", direction = "horizontal",
action = "workspace", action = "workspace",
}, },
+1
View File
@@ -39,6 +39,7 @@ settings["modules"] = {
swayosd = true, swayosd = true,
cliphist = true, cliphist = true,
pypr = true, pypr = true,
fcitx5 = false,
} }
return require("lua.lib.utils").extend_config(settings, "lua.user.settings") return require("lua.lib.utils").extend_config(settings, "lua.user.settings")
+3 -1
View File
@@ -79,7 +79,9 @@ function M.tbl_recursive_merge(defaults, overrides)
end end
function M.extend_config(defaults, user_module) function M.extend_config(defaults, user_module)
if not M.is_file_exists(HYPR .. user_module) then local file = HYPR .. "/" .. string.gsub(user_module, "%.", "/") .. ".lua"
if not M.is_file_exists(file) then
print(file .. " not found.")
return deepcopy(defaults) return deepcopy(defaults)
end end
local ok, overrides = pcall(require, user_module) local ok, overrides = pcall(require, user_module)
+24
View File
@@ -0,0 +1,24 @@
local bind = require("lua.lib.bind")
local M = {}
M.binds = {
{
keys = bind.with_leader("CTRL + E"),
dispatcher = hl.dsp.exec_cmd("pkill fcitx5 -9;sleep 1;fcitx5 -d"),
desc = "restart fcitx5",
},
}
M.autostart = {
function()
hl.exec_cmd("fcitx5 -d")
end,
}
M.envs = {
QT_IM_MODULE = "fcitx",
XMODIFIERS = "@im=fcitx",
}
return M
+6
View File
@@ -26,6 +26,7 @@ end
for name, enabled in pairs(settings.modules) do for name, enabled in pairs(settings.modules) do
if enabled then if enabled then
local mod = load_module(name) local mod = load_module(name)
print("module " .. name .. " loaded.")
table.insert(modules, { table.insert(modules, {
name = name, name = name,
config = mod, config = mod,
@@ -36,6 +37,7 @@ end
M.autostart = {} M.autostart = {}
M.autostop = {} M.autostop = {}
M.binds = {} M.binds = {}
M.envs = {}
local function collect_modules_prop(module, prop) local function collect_modules_prop(module, prop)
if module[prop] then if module[prop] then
@@ -48,6 +50,7 @@ for _, item in ipairs(modules) do
collect_modules_prop(module, "autostart") collect_modules_prop(module, "autostart")
collect_modules_prop(module, "autostop") collect_modules_prop(module, "autostop")
collect_modules_prop(module, "binds") collect_modules_prop(module, "binds")
collect_modules_prop(module, "envs")
end end
function M.load() function M.load()
@@ -55,6 +58,9 @@ function M.load()
events.map("hyprland.shutdown", M.autostop) events.map("hyprland.shutdown", M.autostop)
bind.map(M.binds) bind.map(M.binds)
for name, value in pairs(M.envs) do
hl.env(name, value)
end
end end
return M return M
+7 -9
View File
@@ -43,41 +43,39 @@ end
M.binds = { M.binds = {
{ {
keys = "XF86MonBrightnessUp", keys = "XF86MonBrightnessUp",
dispatcher = function() dispatcher = swayosd_client_cmd("--brightness raise"),
swayosd_client_cmd("--brightness raise")
end,
dosc = "Increase brightness ", dosc = "Increase brightness ",
opts = { long_press = true, locked = true }, opts = { repeating = true, locked = true },
}, },
{ {
keys = "XF86MonBrightnessDown", keys = "XF86MonBrightnessDown",
dispatcher = swayosd_client_cmd("--brightness lower"), dispatcher = swayosd_client_cmd("--brightness lower"),
desc = "Decrease brightness ", desc = "Decrease brightness ",
opts = { long_press = true, locked = true }, opts = { repeating = true, locked = true },
}, },
{ {
keys = "XF86AudioRaiseVolume", keys = "XF86AudioRaiseVolume",
dispatcher = swayosd_client_cmd("--output-volume raise"), dispatcher = swayosd_client_cmd("--output-volume raise"),
desc = "Increase brightness ", desc = "Increase brightness ",
opts = { long_press = true, locked = true }, opts = { repeating = true, locked = true },
}, },
{ {
keys = "XF86AudioLowerVolume", keys = "XF86AudioLowerVolume",
dispatcher = swayosd_client_cmd("--output-volume lower"), dispatcher = swayosd_client_cmd("--output-volume lower"),
desc = "Decrease brightness ", desc = "Decrease brightness ",
opts = { long_press = true, locked = true }, opts = { repeating = true, locked = true },
}, },
{ {
keys = "XF86AudioMute", keys = "XF86AudioMute",
dispatcher = swayosd_client_cmd("--output-volume mute-toggle"), dispatcher = swayosd_client_cmd("--output-volume mute-toggle"),
desc = "Toggle output mute", desc = "Toggle output mute",
opts = { long_press = true, locked = true }, opts = { repeating = true, locked = true },
}, },
{ {
keys = "XF86AudioMicMute", keys = "XF86AudioMicMute",
dispatcher = swayosd_client_cmd("--input-volume mute-toggle"), dispatcher = swayosd_client_cmd("--input-volume mute-toggle"),
desc = "Toggle input mute", desc = "Toggle input mute",
opts = { long_press = true, locked = true }, opts = { repeating = true, locked = true },
}, },
{ {
keys = "XF86AudioPlay", keys = "XF86AudioPlay",