feat: much improved hyprland binds

This commit is contained in:
2026-07-08 15:44:19 +02:00
parent 3bec7f4d9e
commit e312c254e8
7 changed files with 108 additions and 62 deletions
+11 -15
View File
@@ -3,7 +3,7 @@
---@param s string the string to process
---@return string
local function trim_string(s)
return s:match("^%s*(.*)"):match("(.-)%s*$")
return s:match("^%s*(.*)"):match("(.-)%s*$")
end
local is_docked = false
@@ -12,23 +12,18 @@ local read_platform = trim_string(io.popen("cat ~/.config/janishutz/platform"):r
local read_docked = trim_string(io.popen("cat ~/.config/janishutz/docked"):read("a")) == "y"
if read_platform then
laptop_config = true
laptop_config = true
end
if read_docked and laptop_config then
is_docked = true
is_docked = true
end
if is_docked and #hl.get_monitors() <= 1 then
hl.notification.create({
text = "Emergency docked mode fallback initiated: No external displays detected",
timeout = 5000,
})
is_docked = false
else
hl.notification.create({
text = "Config for " .. (laptop_config and "laptop" or "desktop") .. " loaded",
timeout = 5000,
})
hl.notification.create({
text = "Emergency docked mode fallback initiated: No external displays detected",
timeout = 5000,
})
is_docked = false
end
-- Core
@@ -44,6 +39,7 @@ require("hyprland.binds.main")
require("hyprland.binds.device")
require("hyprland.binds.groups")
require("hyprland.binds.launch")
require("hyprland.binds.group-launch")
require("hyprland.binds.notifications")
require("hyprland.binds.screenshot")
require("hyprland.binds.window")
@@ -65,6 +61,6 @@ require("hyprland.monitors")(laptop_config, is_docked)
require("hyprland.execs")(laptop_config)
hl.device({
name = "pnp0c50:00-093a:0255-touchpad",
enabled = true,
name = "pnp0c50:00-093a:0255-touchpad",
enabled = true,
})