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,
})
@@ -0,0 +1,30 @@
local function exit_submap()
hl.dispatch(hl.dsp.submap("reset"))
end
hl.define_submap("groupedlaunch", function()
hl.bind("e", function()
hl.exec_cmd("kitty ~/projects/eth/projects/eyetap/", { workspace = 1 })
hl.exec_cmd("kitty ~/projects/eth/projects/eyetap/backend/", { workspace = 10 })
hl.exec_cmd("kitty ~/projects/eth/projects/eyetap/frontend/", { workspace = 10 })
hl.exec_cmd("librewolf http://localhost:8081")
exit_submap()
end)
hl.bind("s", function()
hl.exec_cmd("kitty ~/projects/eth/eth-summaries/", { workspace = 1 })
hl.exec_cmd("kitty ~/NextCloud/Documents/ETH/Semester4/", { workspace = 3 })
exit_submap()
end)
hl.bind("b", function()
hl.exec_cmd("alvr_dashboard", { workspace = 1 })
hl.exec_cmd("/opt/BSManager/bs-manager", { workspace = 2 })
hl.exec_cmd("steam", { workspace = 3 })
exit_submap()
end)
hl.bind("Escape", function()
exit_submap()
end)
end)
+2
View File
@@ -2,6 +2,8 @@ local function exit_submap()
hl.dispatch(hl.dsp.submap("reset"))
end
-- TODO: Improve mapping (also global mapping, for moving between els if to use regularly)
-- Improve colours
hl.define_submap("groups", function()
hl.bind("c", function()
hl.dispatch(hl.dsp.group.toggle())
+1
View File
@@ -6,6 +6,7 @@ hl.bind("SUPER + S", hl.dsp.submap("screenshot"))
hl.bind("SUPER + W", hl.dsp.submap("window"))
hl.bind("SUPER + A", hl.dsp.submap("workspace"))
hl.bind("SUPER + Q", hl.dsp.window.close())
hl.bind("SUPER + P", hl.dsp.submap("groupedlaunch"))
hl.bind("SUPER + Space", hl.dsp.exec_cmd("dms ipc call spotlight toggle"))
hl.bind("SUPER + Escape", hl.dsp.exec_cmd("wlogout"))
+20 -20
View File
@@ -3,36 +3,36 @@
-- └ ┘
-- Games
hl.window_rule({
match = {
class = "steam_app.*",
},
tag = "+game",
match = {
class = "steam_app.*",
},
tag = "+game",
})
hl.window_rule({
match = {
title = "Minecraft|Beat Saber",
},
tag = "+game",
match = {
title = "Minecraft.*|Beat Saber",
},
tag = "+game",
})
-- Launchers
hl.window_rule({
match = {
class = "steam|minecraft-launcher|org\\.prismlauncher\\.PrismLauncher",
},
tag = "+launchers",
match = {
class = "steam|minecraft-launcher|org\\.prismlauncher\\.PrismLauncher",
},
tag = "+launchers",
})
-- Dialogs
hl.window_rule({
match = {
class = "file_progress|confirm|dialog|download|notification|error|splash|confirmreset|lxappearance|pavucontrol|file-roller",
},
tag = "+dialog",
match = {
class = "file_progress|confirm|dialog|download|notification|error|splash|confirmreset|lxappearance|pavucontrol|file-roller",
},
tag = "+dialog",
})
hl.window_rule({
match = {
title = "SteamVR Status|Open File|Media viewer|Volume Control|Picture-in-Picture|File Operation Progress|Loading|AG Controller|AG Controller|Qalculate",
},
tag = "+dialog",
match = {
title = ".*SteamVR.*|Open File.*|Media viewer|Volume Control|Picture-in-Picture|File Operation Progress|Loading.*|AG Controller|.*Qalculate.*",
},
tag = "+dialog",
})
@@ -7,7 +7,7 @@ hl.window_rule({
workspace = 1,
})
hl.window_rule({
match = { title = "ALVR|^hidden-terminator$" },
match = { title = "ALVR.*|^hidden-terminator$" },
workspace = 1,
})
@@ -17,7 +17,7 @@ hl.window_rule({
workspace = 2,
})
hl.window_rule({
match = { title = "BSManager" },
match = { title = ".*BSManager.*" },
workspace = 2,
})
@@ -28,6 +28,6 @@ hl.window_rule({
})
hl.window_rule({
match = { title = "Qalculate|AG Controller" },
match = { title = "Qalculate.*|AG Controller" },
workspace = "special",
})
+41 -24
View File
@@ -1,26 +1,43 @@
hl.config({
general = {
col = {
active_border = {
colors = {
"rgba({{colors.primary.default.hex_stripped}}cc)",
"rgba({{colors.secondary.default.hex_stripped}}cc)",
"rgba({{colors.tertiary.default.hex_stripped}}cc)",
},
angle = 45,
},
inactive_border = "rgba({{colors.surface_container_low.default.hex_stripped}}33)",
},
},
group = {
col = {
border_active = "rgba({{colors.outline_variant.default.hex_stripped}}77)",
border_inactive = "rgba({{colors.surface_container_high.default.hex_stripped}}33)",
},
},
decoration = {
shadow = {
color = "rgba({{colors.shadow.default.hex_stripped}}20)",
},
},
general = {
col = {
active_border = {
colors = {
"rgba({{colors.primary.default.hex_stripped}}cc)",
"rgba({{colors.secondary.default.hex_stripped}}cc)",
"rgba({{colors.tertiary.default.hex_stripped}}cc)",
},
angle = 45,
},
inactive_border = "rgba({{colors.surface_container_low.default.hex_stripped}}33)",
},
},
group = {
col = {
border_active = "rgba({{colors.secondary.default.hex_stripped}}cc)",
border_inactive = "rgba({{colors.surface_container_high.default.hex_stripped}}33)",
border_locked_active = "rgba({{colors.tertiary.default.hex_stripped}}cc)",
border_locked_inactive = "rgba({{colors.surface_container_high.default.hex_stripped}}33)",
},
},
groupbar = {
font_family = "Comfortaa",
height = 12,
font_size = 10,
text_color = "rgba({{colors.on_secondary.default.hex_stripped}}aa)",
text_color_inactive = "rgba({{colors.on_surface.default.hex_stripped}}aa)",
text_color_locked_active = "rgba({{colors.on_error.default.hex_stripped}}aa)",
text_color_locked_inactive = "rgba({{colors.on_surface.default.hex_stripped}}aa)",
col = {
active = "rgba({{colors.secondary.default.hex_stripped}}aa)",
inactive = "rgba({{colors.surface_container_low.default.hex_stripped}}aa)",
locked_inactive = "rgba({{colors.surface_container_high.default.hex_stripped}}aa)",
locked_active = "rgba({{colors.error.default.hex_stripped}}aa)",
},
},
decoration = {
shadow = {
color = "rgba({{colors.shadow.default.hex_stripped}}20)",
},
},
})