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 ---@param s string the string to process
---@return string ---@return string
local function trim_string(s) local function trim_string(s)
return s:match("^%s*(.*)"):match("(.-)%s*$") return s:match("^%s*(.*)"):match("(.-)%s*$")
end end
local is_docked = false 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" local read_docked = trim_string(io.popen("cat ~/.config/janishutz/docked"):read("a")) == "y"
if read_platform then if read_platform then
laptop_config = true laptop_config = true
end end
if read_docked and laptop_config then if read_docked and laptop_config then
is_docked = true is_docked = true
end end
if is_docked and #hl.get_monitors() <= 1 then if is_docked and #hl.get_monitors() <= 1 then
hl.notification.create({ hl.notification.create({
text = "Emergency docked mode fallback initiated: No external displays detected", text = "Emergency docked mode fallback initiated: No external displays detected",
timeout = 5000, timeout = 5000,
}) })
is_docked = false is_docked = false
else
hl.notification.create({
text = "Config for " .. (laptop_config and "laptop" or "desktop") .. " loaded",
timeout = 5000,
})
end end
-- Core -- Core
@@ -44,6 +39,7 @@ require("hyprland.binds.main")
require("hyprland.binds.device") require("hyprland.binds.device")
require("hyprland.binds.groups") require("hyprland.binds.groups")
require("hyprland.binds.launch") require("hyprland.binds.launch")
require("hyprland.binds.group-launch")
require("hyprland.binds.notifications") require("hyprland.binds.notifications")
require("hyprland.binds.screenshot") require("hyprland.binds.screenshot")
require("hyprland.binds.window") require("hyprland.binds.window")
@@ -65,6 +61,6 @@ require("hyprland.monitors")(laptop_config, is_docked)
require("hyprland.execs")(laptop_config) require("hyprland.execs")(laptop_config)
hl.device({ hl.device({
name = "pnp0c50:00-093a:0255-touchpad", name = "pnp0c50:00-093a:0255-touchpad",
enabled = true, 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")) hl.dispatch(hl.dsp.submap("reset"))
end end
-- TODO: Improve mapping (also global mapping, for moving between els if to use regularly)
-- Improve colours
hl.define_submap("groups", function() hl.define_submap("groups", function()
hl.bind("c", function() hl.bind("c", function()
hl.dispatch(hl.dsp.group.toggle()) 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 + W", hl.dsp.submap("window"))
hl.bind("SUPER + A", hl.dsp.submap("workspace")) hl.bind("SUPER + A", hl.dsp.submap("workspace"))
hl.bind("SUPER + Q", hl.dsp.window.close()) 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 + Space", hl.dsp.exec_cmd("dms ipc call spotlight toggle"))
hl.bind("SUPER + Escape", hl.dsp.exec_cmd("wlogout")) hl.bind("SUPER + Escape", hl.dsp.exec_cmd("wlogout"))
+20 -20
View File
@@ -3,36 +3,36 @@
-- └ ┘ -- └ ┘
-- Games -- Games
hl.window_rule({ hl.window_rule({
match = { match = {
class = "steam_app.*", class = "steam_app.*",
}, },
tag = "+game", tag = "+game",
}) })
hl.window_rule({ hl.window_rule({
match = { match = {
title = "Minecraft|Beat Saber", title = "Minecraft.*|Beat Saber",
}, },
tag = "+game", tag = "+game",
}) })
-- Launchers -- Launchers
hl.window_rule({ hl.window_rule({
match = { match = {
class = "steam|minecraft-launcher|org\\.prismlauncher\\.PrismLauncher", class = "steam|minecraft-launcher|org\\.prismlauncher\\.PrismLauncher",
}, },
tag = "+launchers", tag = "+launchers",
}) })
-- Dialogs -- Dialogs
hl.window_rule({ hl.window_rule({
match = { match = {
class = "file_progress|confirm|dialog|download|notification|error|splash|confirmreset|lxappearance|pavucontrol|file-roller", class = "file_progress|confirm|dialog|download|notification|error|splash|confirmreset|lxappearance|pavucontrol|file-roller",
}, },
tag = "+dialog", tag = "+dialog",
}) })
hl.window_rule({ hl.window_rule({
match = { match = {
title = "SteamVR Status|Open File|Media viewer|Volume Control|Picture-in-Picture|File Operation Progress|Loading|AG Controller|AG Controller|Qalculate", title = ".*SteamVR.*|Open File.*|Media viewer|Volume Control|Picture-in-Picture|File Operation Progress|Loading.*|AG Controller|.*Qalculate.*",
}, },
tag = "+dialog", tag = "+dialog",
}) })
@@ -7,7 +7,7 @@ hl.window_rule({
workspace = 1, workspace = 1,
}) })
hl.window_rule({ hl.window_rule({
match = { title = "ALVR|^hidden-terminator$" }, match = { title = "ALVR.*|^hidden-terminator$" },
workspace = 1, workspace = 1,
}) })
@@ -17,7 +17,7 @@ hl.window_rule({
workspace = 2, workspace = 2,
}) })
hl.window_rule({ hl.window_rule({
match = { title = "BSManager" }, match = { title = ".*BSManager.*" },
workspace = 2, workspace = 2,
}) })
@@ -28,6 +28,6 @@ hl.window_rule({
}) })
hl.window_rule({ hl.window_rule({
match = { title = "Qalculate|AG Controller" }, match = { title = "Qalculate.*|AG Controller" },
workspace = "special", workspace = "special",
}) })
+41 -24
View File
@@ -1,26 +1,43 @@
hl.config({ hl.config({
general = { general = {
col = { col = {
active_border = { active_border = {
colors = { colors = {
"rgba({{colors.primary.default.hex_stripped}}cc)", "rgba({{colors.primary.default.hex_stripped}}cc)",
"rgba({{colors.secondary.default.hex_stripped}}cc)", "rgba({{colors.secondary.default.hex_stripped}}cc)",
"rgba({{colors.tertiary.default.hex_stripped}}cc)", "rgba({{colors.tertiary.default.hex_stripped}}cc)",
}, },
angle = 45, angle = 45,
}, },
inactive_border = "rgba({{colors.surface_container_low.default.hex_stripped}}33)", inactive_border = "rgba({{colors.surface_container_low.default.hex_stripped}}33)",
}, },
}, },
group = { group = {
col = { col = {
border_active = "rgba({{colors.outline_variant.default.hex_stripped}}77)", border_active = "rgba({{colors.secondary.default.hex_stripped}}cc)",
border_inactive = "rgba({{colors.surface_container_high.default.hex_stripped}}33)", 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)",
decoration = { },
shadow = { },
color = "rgba({{colors.shadow.default.hex_stripped}}20)", 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)",
},
},
}) })