add back some repetitive keybinds to cheatsheet

This commit is contained in:
end-4
2026-05-16 23:27:26 +02:00
parent 68c67aced4
commit c0706258b1
3 changed files with 173 additions and 90 deletions
+108 -74
View File
@@ -16,8 +16,10 @@ hl.bind("SUPER + SUPER_R", hl.dsp.exec_cmd(qsIsAlive .. " || pkill fuzzel || fuz
hl.bind("SUPER_L", hl.dsp.global("quickshell:workspaceNumber"), { ignore_mods = true, transparent = true }) hl.bind("SUPER_L", hl.dsp.global("quickshell:workspaceNumber"), { ignore_mods = true, transparent = true })
hl.bind("SUPER_R", hl.dsp.global("quickshell:workspaceNumber"), { ignore_mods = true, transparent = true }) hl.bind("SUPER_R", hl.dsp.global("quickshell:workspaceNumber"), { ignore_mods = true, transparent = true })
hl.bind("SUPER_L", hl.dsp.global("quickshell:workspaceNumber"), { ignore_mods = true, transparent = true, release = true }) hl.bind("SUPER_L", hl.dsp.global("quickshell:workspaceNumber"),
hl.bind("SUPER_R", hl.dsp.global("quickshell:workspaceNumber"), { ignore_mods = true, transparent = true, release = true }) { ignore_mods = true, transparent = true, release = true })
hl.bind("SUPER_R", hl.dsp.global("quickshell:workspaceNumber"),
{ ignore_mods = true, transparent = true, release = true })
hl.bind("SUPER + Tab", hl.dsp.global("quickshell:overviewWorkspacesToggle"), { description = "Shell: Toggle overview" }) hl.bind("SUPER + Tab", hl.dsp.global("quickshell:overviewWorkspacesToggle"), { description = "Shell: Toggle overview" })
hl.bind("SUPER + V", hl.dsp.global("quickshell:overviewClipboardToggle")) hl.bind("SUPER + V", hl.dsp.global("quickshell:overviewClipboardToggle"))
hl.bind("SUPER + Period", hl.dsp.global("quickshell:overviewEmojiToggle")) hl.bind("SUPER + Period", hl.dsp.global("quickshell:overviewEmojiToggle"))
@@ -45,9 +47,9 @@ hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO
{ locked = true, repeating = true }) { locked = true, repeating = true })
hl.bind("CTRL + SUPER + T", hl.dsp.global("quickshell:wallpaperSelectorToggle"), hl.bind("CTRL + SUPER + T", hl.dsp.global("quickshell:wallpaperSelectorToggle"),
{ description = "Shell: Toggle wallpaper selector" }) { description = "Shell: Change wallpaper" })
hl.bind("CTRL + SUPER + ALT + T", hl.dsp.global("quickshell:wallpaperSelectorRandom"), hl.bind("CTRL + SUPER + ALT + T", hl.dsp.global("quickshell:wallpaperSelectorRandom"),
{ description = "Shell: Select random wallpaper" }) { description = "Shell: Random wallpaper" })
hl.bind("CTRL + SUPER + SHIFT + D", hl.dsp.global("quickshell:toggleLightDark"), hl.bind("CTRL + SUPER + SHIFT + D", hl.dsp.global("quickshell:toggleLightDark"),
{ description = "Shell: Toggle light/dark mode" }) { description = "Shell: Toggle light/dark mode" })
hl.bind("CTRL + SUPER + T", hl.dsp.exec_cmd(qsIsAlive .. " || " .. qsScripts .. "/colors/switchwall.sh")) hl.bind("CTRL + SUPER + T", hl.dsp.exec_cmd(qsIsAlive .. " || " .. qsScripts .. "/colors/switchwall.sh"))
@@ -58,10 +60,10 @@ hl.bind("CTRL + SUPER + P", hl.dsp.global("quickshell:panelFamilyCycle"), { desc
--##! Utilities --##! Utilities
--# Screenshot, Record, OCR, Color picker, Clipboard history --# Screenshot, Record, OCR, Color picker, Clipboard history
hl.bind("SUPER + V", hl.dsp.exec_cmd( hl.bind("SUPER + V", hl.dsp.exec_cmd(
qsIsAlive .. " || pkill fuzzel || cliphist list | fuzzel --match-mode fzf --dmenu | cliphist decode | wl-copy"), qsIsAlive .. " || pkill fuzzel || cliphist list | fuzzel --match-mode fzf --dmenu | cliphist decode | wl-copy"),
{ description = "Utilities: Clipboard history >> clipboard" }) { description = "Utilities: Clipboard history >> clipboard" })
hl.bind("SUPER + Period", hl.dsp.exec_cmd( hl.bind("SUPER + Period", hl.dsp.exec_cmd(
qsIsAlive .. " || pkill fuzzel || " .. hyprScripts .. "/fuzzel-emoji.sh copy"), qsIsAlive .. " || pkill fuzzel || " .. hyprScripts .. "/fuzzel-emoji.sh copy"),
{ description = "Utilities: Emoji >> clipboard" }) { description = "Utilities: Emoji >> clipboard" })
hl.bind("SUPER + SHIFT + S", hl.dsp.global("quickshell:regionScreenshot"), { description = "Utilities: Screen snip" }) hl.bind("SUPER + SHIFT + S", hl.dsp.global("quickshell:regionScreenshot"), { description = "Utilities: Screen snip" })
hl.bind("SUPER + SHIFT + S", hl.bind("SUPER + SHIFT + S",
@@ -103,6 +105,47 @@ hl.bind("SUPER + SHIFT + ALT + mouse:273", hl.dsp.exec_cmd(hyprScripts .. "/ai/p
{ description = "Utilities: Generate AI summary for selected text" }) { description = "Utilities: Generate AI summary for selected text" })
-- (requires a running ollama model) -- (requires a running ollama model)
--##! Screen
--# Zoom
local function zoomfunction(value)
local zoomvalue = hl.get_config("cursor:zoom_factor")
if (zoomvalue + value) > 3.0 then
hl.config({ cursor = { zoom_factor = 3.0 } })
elseif (zoomvalue + value) < 1.0 then
hl.config({ cursor = { zoom_factor = 1.0 } })
else
hl.config({ cursor = { zoom_factor = zoomvalue + value } })
end
end
hl.bind("SUPER + Minus", function() zoomfunction(-0.3) end, { repeating = true, description = "Screen: Zoom out" })
hl.bind("SUPER + Equal", function() zoomfunction(0.3) end, { repeating = true, description = "Screen: Zoom in" })
--# Zoom with keypad
hl.bind("SUPER + code:82", function() zoomfunction(-0.3) end, { repeating = true })
hl.bind("SUPER + code:86", function() zoomfunction(0.3) end, { repeating = true })
--##! Media
local mediaNextCommand =
"playerctl next || playerctl position `bc <<< \"100 * $(playerctl metadata mpris:length) / 1000000 / 100\"`"
hl.bind("SUPER + SHIFT + N", hl.dsp.exec_cmd(mediaNextCommand), { locked = true, description = "Media: Next track" })
hl.bind("XF86AudioNext", hl.dsp.exec_cmd(mediaNextCommand), { locked = true })
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true })
hl.bind("SUPER + SHIFT + ALT + mouse:275", hl.dsp.exec_cmd("playerctl previous"))
hl.bind("SUPER + SHIFT + ALT + mouse:276", hl.dsp.exec_cmd(mediaNextCommand))
hl.bind("SUPER + SHIFT + B", hl.dsp.exec_cmd("playerctl previous"),
{ locked = true, description = "Media: Previous track" })
hl.bind("SUPER + SHIFT + P", hl.dsp.exec_cmd("playerctl play-pause"),
{ locked = true, description = "Media: Play/pause media" })
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_SINK@ toggle"), { locked = true })
hl.bind("SUPER + SHIFT + M", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_SINK@ toggle"),
{ locked = true, description = "Media: Toggle mute" })
hl.bind("ALT + XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_SOURCE@ toggle"), { locked = true })
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_SOURCE@ toggle"), { locked = true })
hl.bind("SUPER + ALT + M", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_SOURCE@ toggle"),
{ locked = true, description = "Media: Toggle mic" })
--#! --#!
--##! Window --##! Window
--# Focusing --# Focusing
@@ -110,21 +153,30 @@ hl.bind("SUPER + mouse:272", hl.dsp.window.drag(), { mouse = true, description =
hl.bind("SUPER + mouse:274", hl.dsp.window.drag(), { mouse = true }) hl.bind("SUPER + mouse:274", hl.dsp.window.drag(), { mouse = true })
hl.bind("SUPER + mouse:273", hl.dsp.window.resize(), { mouse = true, description = "Window: Resize" }) hl.bind("SUPER + mouse:273", hl.dsp.window.resize(), { mouse = true, description = "Window: Resize" })
--#/# bind = SUPER + ←/↑/→/↓,, -- Focus in direction --#/# bind = SUPER + ←/↑/→/↓,, -- Focus in direction
for i = 1, 6 do for i = 1, 4 do
local arrowkey = { "Left", "Right", "Up", "Down", "BracketLeft", "BracketRight" } local arrowkey = { "Left", "Right", "Up", "Down" }
local focusdir = { "l", "r", "u", "d", "l", "r" } local focusdir = { "l", "r", "u", "d" }
hl.bind("SUPER + " .. arrowkey[i], hl.dsp.focus({ direction = focusdir[i] }),
{ description = "Window: Focus " .. arrowkey[i] })
end
for i = 1, 2 do
local arrowkey = { "BracketLeft", "BracketRight" }
local focusdir = { "l", "r" }
hl.bind("SUPER + " .. arrowkey[i], hl.dsp.focus({ direction = focusdir[i] })) hl.bind("SUPER + " .. arrowkey[i], hl.dsp.focus({ direction = focusdir[i] }))
end end
--#/# bind = SUPER + SHIFT, ←/↑/→/↓,, -- Move in direction --#/# bind = SUPER + SHIFT, ←/↑/→/↓,, -- Move in direction
for i = 1, 4 do for i = 1, 4 do
local arrowkey = { "Left", "Right", "Up", "Down" } local arrowkey = { "Left", "Right", "Up", "Down" }
local focusdir = { "l", "r", "u", "d" } local focusdir = { "l", "r", "u", "d" }
hl.bind("SUPER + SHIFT + " .. arrowkey[i], hl.dsp.window.move({ direction = focusdir[i] })) hl.bind("SUPER + SHIFT + " .. arrowkey[i], hl.dsp.window.move({ direction = focusdir[i] }),
{ description = "Window: Move " .. arrowkey[i] })
end end
hl.bind("ALT + F4", hl.bind("ALT + F4",
function() hl.exec_cmd( function()
"notify-send \"Wrong close keybind\" \"Super+Q to close. Use Alt+F4 for Windows VMs\" -a Hyprland") end, hl.exec_cmd(
"notify-send \"Wrong close keybind\" \"Super+Q to close. Use Alt+F4 for Windows VMs\" -a Hyprland")
end,
{ non_consuming = true }) { non_consuming = true })
hl.bind("SUPER + Q", hl.dsp.window.close(), { description = "Window: Close" }) hl.bind("SUPER + Q", hl.dsp.window.close(), { description = "Window: Close" })
hl.bind("SUPER + SHIFT + ALT + Q", hl.dsp.exec_cmd("hyprctl kill"), { description = "Window: Forcefully zap a window" }) hl.bind("SUPER + SHIFT + ALT + Q", hl.dsp.exec_cmd("hyprctl kill"), { description = "Window: Forcefully zap a window" })
@@ -144,7 +196,12 @@ hl.bind("SUPER + ALT + F", hl.dsp.window.fullscreen_state({ internal = 0, client
hl.bind("SUPER + P", hl.dsp.window.pin(), { description = "Window: Pin" }) hl.bind("SUPER + P", hl.dsp.window.pin(), { description = "Window: Pin" })
--#/# bind = SUPER+ALT, Hash,, -- Send to workspace -- (1, 2, 3,...) --#/# bind = SUPER+ALT, Hash,, -- Send to workspace -- (1, 2, 3,...)
--# We use raw keycodes because some keyboard layouts register number keys as different chars. The codes can be verified with `wev` for i = 1, 10 do
hl.bind("SUPER + ALT + " .. (i % 10), function()
hl.dispatch(hl.dsp.window.move({ workspace = workspace_in_group(i), follow = false }))
end, { description = "Window: Send to workspace " .. i })
end
--# We also use raw keycodes because some keyboard layouts register number keys as different chars. The codes can be verified with `wev`
for i = 1, 10 do for i = 1, 10 do
local numberkey = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 } local numberkey = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }
hl.bind("SUPER + ALT + code:" .. numberkey[i], function() hl.bind("SUPER + ALT + code:" .. numberkey[i], function()
@@ -163,27 +220,37 @@ end
for i = 1, 4 do for i = 1, 4 do
local key = { "SUPER + SHIFT + mouse_", "SUPER + ALT + mouse_" } local key = { "SUPER + SHIFT + mouse_", "SUPER + ALT + mouse_" }
local keycombos = { key[1] .. "down", key[1] .. "up", key[2] .. "down", key[2] .. "up" } local keycombos = { key[1] .. "down", key[1] .. "up", key[2] .. "down", key[2] .. "up" }
local prefix = { "r-", "r+", "-", "+" } local prefix = { "r-", "r+", "r-", "r+" }
hl.bind(keycombos[i], hl.dsp.window.move({ workspace = prefix[i] .. "1" })) hl.bind(keycombos[i], hl.dsp.window.move({ workspace = prefix[i] .. "1" }))
end end
--#/# bind = SUPER+SHIFT, Page_↑/↓,, -- Send to workspace left/right --#/# bind = SUPER+SHIFT, Page_↑/↓,, -- Send to workspace left/right
for i = 1, 6 do for i = 1, 2 do
local key = { "SUPER + ALT + Page_", "SUPER + SHIFT + Page_", "CTRL + SUPER + SHIFT + " } local keydirs = { "Up", "Down" }
local keycombos = { key[1] .. "down", key[1] .. "up", key[2] .. "down", key[2] .. "up", key[3] .. "Right", key[3] .. local prefix = { "r-", "r+" }
"Left" } local descdir = { "left", "right" }
local prefix = { "+", "-", "r+", "r-", "r+", "r-" } hl.bind("SUPER + SHIFT + Page_" .. keydirs[i], hl.dsp.window.move({ workspace = prefix[i] .. "1" }), {description = "Window: Send to workspace " .. descdir[i]})
end
for i = 1, 4 do
local key = { "SUPER + ALT + Page_", "CTRL + SUPER + SHIFT + " }
local keycombos = { key[1] .. "down", key[1] .. "up", key[2] .. "Right", key[2] .. "Left" }
local prefix = { "r+", "r-", "r+", "r-" }
hl.bind(keycombos[i], hl.dsp.window.move({ workspace = prefix[i] .. "1" })) -- # [hidden] hl.bind(keycombos[i], hl.dsp.window.move({ workspace = prefix[i] .. "1" })) -- # [hidden]
end end
hl.bind("SUPER + ALT + S", hl.bind("SUPER + ALT + S",
hl.dsp.window.move({ workspace = "special:special", follow = false }), {description = "Window: Send to scratchpad"}) hl.dsp.window.move({ workspace = "special:special", follow = false }), { description = "Window: Send to scratchpad" })
hl.bind("CTRL + SUPER + S", hl.dsp.workspace.toggle_special("special")) hl.bind("CTRL + SUPER + S", hl.dsp.workspace.toggle_special("special"))
--##! Workspace --##! Workspace
--# Switching --# Switching
--#/# bind = SUPER, Hash,, -- Focus workspace -- (1, 2, 3,...) --#/# bind = SUPER, Hash,, -- Focus workspace -- (1, 2, 3,...)
--# We use raw keycodes because some keyboard layouts register number keys as different chars. The codes can be verified with `wev` for i = 1, 10 do
hl.bind("SUPER + " .. (i % 10), function()
hl.dispatch(hl.dsp.focus({ workspace = workspace_in_group(i) }))
end, { description = "Workspace: Focus " .. i })
end
--# We also use raw keycodes because some keyboard layouts register number keys as different chars. The codes can be verified with `wev`
for i = 1, 10 do for i = 1, 10 do
local numberkey = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 } local numberkey = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }
hl.bind("SUPER + code:" .. numberkey[i], function() hl.bind("SUPER + code:" .. numberkey[i], function()
@@ -200,11 +267,16 @@ end
--#/# bind = CTRL+SUPER, ←/→,, -- Focus left/right --#/# bind = CTRL+SUPER, ←/→,, -- Focus left/right
--#/# bind = CTRL+SUPER+ALT, ←/→,, -- # [hidden] Focus busy left/right --#/# bind = CTRL+SUPER+ALT, ←/→,, -- # [hidden] Focus busy left/right
for i = 1, 4 do for i = 1, 2 do
local key = { "CTRL + SUPER + ", "CTRL + SUPER + ALT + " } local keys = { "Left", "Right" }
local keycombos = { key[1] .. "Right", key[1] .. "Left", key[2] .. "Right", key[2] .. "Left" } local prefix = { "r-", "r+" }
local prefix = { "r+", "r-", "m+", "m-" } local descdir = { "left", "right" }
hl.bind(keycombos[i], hl.dsp.focus({ workspace = prefix[i] .. "1" })) hl.bind("CTRL + SUPER + " .. keys[i], hl.dsp.focus({ workspace = prefix[i] .. "1" }), {description = "Workspace: Focus " .. descdir[i]})
end
for i = 1, 2 do
local keys = { "Left", "Right" }
local prefix = { "m-", "m+" }
hl.bind("CTRL + SUPER + ALT + " .. keys[i], hl.dsp.focus({ workspace = prefix[i] .. "1" }))
end end
--#/# bind = SUPER, Page_↑/↓,, -- Focus left/right --#/# bind = SUPER, Page_↑/↓,, -- Focus left/right
for i = 1, 4 do for i = 1, 4 do
@@ -235,11 +307,11 @@ hl.define_submap("virtual-machine", function()
local currentsubmap = hl.get_current_submap() local currentsubmap = hl.get_current_submap()
if currentsubmap == "virtual-machine" then if currentsubmap == "virtual-machine" then
hl.dispatch(hl.dsp.exec_cmd( hl.dispatch(hl.dsp.exec_cmd(
"notify-send 'Exited Virtual Machine submap' 'Keybinds re-enabled' -a 'Hyprland'")) "notify-send 'Exited Virtual Machine submap' 'Keybinds re-enabled' -a 'Hyprland'"))
hl.dispatch(hl.dsp.submap("reset")) hl.dispatch(hl.dsp.submap("reset"))
elseif currentsubmap == "" then elseif currentsubmap == "" then
hl.dispatch(hl.dsp.exec_cmd( hl.dispatch(hl.dsp.exec_cmd(
"notify-send 'Entered Virtual Machine submap' 'Keybinds disabled. hit SUPER+ALT+F1 to escape' -a 'Hyprland'")) "notify-send 'Entered Virtual Machine submap' 'Keybinds disabled. hit SUPER+ALT+F1 to escape' -a 'Hyprland'"))
hl.dispatch(hl.dsp.submap("virtual-machine")) hl.dispatch(hl.dsp.submap("virtual-machine"))
end end
end, { submap_universal = true }) end, { submap_universal = true })
@@ -250,63 +322,25 @@ end)
--# Testing --# Testing
hl.bind("SUPER + ALT + F11", hl.bind("SUPER + ALT + F11",
hl.dsp.exec_cmd( hl.dsp.exec_cmd(
"bash -c 'RANDOM_IMAGE=$(find ~/Pictures -type f | shuf -n 1); ACTION=$(notify-send \"Test notification with body image\" \"This notification should contain your user account <b>image</b> and <a href=\\\"https://discord.com/app\\\">Discord</a> <b>icon</b>. Oh and here is a random image in your Pictures folder: <img src=\\\"$RANDOM_IMAGE\\\" alt=\\\"Testing image\\\"/>\" -a \"Hyprland\" -p -h \"string:image-path:/var/lib/AccountsService/icons/$USER\" -t 6000 -i \"discord\" -A \"openImage=Profile image\" -A \"action2=Open the random image\" -A \"action3=Useless button\"); [[ $ACTION == *openImage ]] && xdg-open \"/var/lib/AccountsService/icons/$USER\"; [[ $ACTION == *action2 ]] && xdg-open \"$RANDOM_IMAGE\"'") "bash -c 'RANDOM_IMAGE=$(find ~/Pictures -type f | shuf -n 1); ACTION=$(notify-send \"Test notification with body image\" \"This notification should contain your user account <b>image</b> and <a href=\\\"https://discord.com/app\\\">Discord</a> <b>icon</b>. Oh and here is a random image in your Pictures folder: <img src=\\\"$RANDOM_IMAGE\\\" alt=\\\"Testing image\\\"/>\" -a \"Hyprland\" -p -h \"string:image-path:/var/lib/AccountsService/icons/$USER\" -t 6000 -i \"discord\" -A \"openImage=Profile image\" -A \"action2=Open the random image\" -A \"action3=Useless button\"); [[ $ACTION == *openImage ]] && xdg-open \"/var/lib/AccountsService/icons/$USER\"; [[ $ACTION == *action2 ]] && xdg-open \"$RANDOM_IMAGE\"'")
) -- # [hidden] ) -- # [hidden]
hl.bind("SUPER + ALT + F12", hl.bind("SUPER + ALT + F12",
hl.dsp.exec_cmd( hl.dsp.exec_cmd(
"bash -c 'RANDOM_IMAGE=$(find ~/Pictures -type f | shuf -n 1); ACTION=$(notify-send \"Test notification\" \"This notification should contain a random image in your <b>Pictures</b> folder and <a href=\\\"https://discord.com/app\\\">Discord</a> <b>icon</b>.\n<i>Flick right to dismiss!</i>\" -a \"Discord (fake)\" -p -h \"string:image-path:$RANDOM_IMAGE\" -t 6000 -i \"discord\" -A \"openImage=Profile image\" -A \"action2=Useless button\"); [[ $ACTION == *openImage ]] && xdg-open \"/var/lib/AccountsService/icons/$USER\"'") "bash -c 'RANDOM_IMAGE=$(find ~/Pictures -type f | shuf -n 1); ACTION=$(notify-send \"Test notification\" \"This notification should contain a random image in your <b>Pictures</b> folder and <a href=\\\"https://discord.com/app\\\">Discord</a> <b>icon</b>.\n<i>Flick right to dismiss!</i>\" -a \"Discord (fake)\" -p -h \"string:image-path:$RANDOM_IMAGE\" -t 6000 -i \"discord\" -A \"openImage=Profile image\" -A \"action2=Useless button\"); [[ $ACTION == *openImage ]] && xdg-open \"/var/lib/AccountsService/icons/$USER\"'")
) -- # [hidden] ) -- # [hidden]
hl.bind("SUPER + ALT + Equal", hl.bind("SUPER + ALT + Equal",
hl.dsp.exec_cmd("notify-send 'Urgent notification' 'Ah hell no' -u critical -a 'Hyprland keybind'")) -- # [hidden] hl.dsp.exec_cmd("notify-send 'Urgent notification' 'Ah hell no' -u critical -a 'Hyprland keybind'")) -- # [hidden]
--##! Session --##! Session
hl.bind("SUPER + L", hl.dsp.exec_cmd("loginctl lock-session"), { description = "Misc: Lock" }) hl.bind("SUPER + L", hl.dsp.exec_cmd("loginctl lock-session"), { description = "Session: Lock" })
hl.bind("SUPER + SHIFT + L", hl.dsp.exec_cmd("systemctl suspend || loginctl suspend"), hl.bind("SUPER + SHIFT + L", hl.dsp.exec_cmd("systemctl suspend || loginctl suspend"),
{ locked = true, description = "Misc: Suspend system" }) -- Sleep { locked = true, description = "Session: Sleep" }) -- Sleep
-- hl.bind("switch:on:Lid Switch", hl.dsp.exec_cmd("systemctl suspend || loginctl suspend"), {locked = true} ) -- # [hidden] Suspend when laptop lid is closed, uncomment if for whatever reason it's not the default behavior -- hl.bind("switch:on:Lid Switch", hl.dsp.exec_cmd("systemctl suspend || loginctl suspend"), {locked = true} ) -- # [hidden] Suspend when laptop lid is closed, uncomment if for whatever reason it's not the default behavior
hl.bind("CTRL + SHIFT + ALT + SUPER + Delete", hl.dsp.exec_cmd("systemctl poweroff || loginctl poweroff"), hl.bind("CTRL + SHIFT + ALT + SUPER + Delete", hl.dsp.exec_cmd("systemctl poweroff || loginctl poweroff"),
{ description = "Misc: Shutdown" }) -- # [hidden] Power off { description = "Session: Shut down" }) -- # [hidden] Power off
--##! Screen
--# Zoom
local function zoomfunction(value)
local zoomvalue = hl.get_config("cursor:zoom_factor")
if (zoomvalue + value) > 3.0 then
hl.config({ cursor = { zoom_factor = 3.0 } })
elseif (zoomvalue + value) < 1.0 then
hl.config({ cursor = { zoom_factor = 1.0 } })
else
hl.config({ cursor = { zoom_factor = zoomvalue + value } })
end
end
hl.bind("SUPER + Minus", function() zoomfunction(-0.3) end, { repeating = true, description = "Misc: Zoom out" })
hl.bind("SUPER + Equal", function() zoomfunction(0.3) end, { repeating = true, description = "Misc: Zoom in" })
--# Zoom with keypad
hl.bind("SUPER + code:82", function() zoomfunction(-0.3) end, { repeating = true })
hl.bind("SUPER + code:86", function() zoomfunction(0.3) end, { repeating = true })
--##! Media
local mediaNextCommand =
"playerctl next || playerctl position `bc <<< \"100 * $(playerctl metadata mpris:length) / 1000000 / 100\"`"
hl.bind("SUPER + SHIFT + N", hl.dsp.exec_cmd(mediaNextCommand), { locked = true, description = "Misc: Next track" })
hl.bind("XF86AudioNext", hl.dsp.exec_cmd(mediaNextCommand), { locked = true })
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true })
hl.bind("SUPER + SHIFT + ALT + mouse:275", hl.dsp.exec_cmd("playerctl previous"))
hl.bind("SUPER + SHIFT + ALT + mouse:276", hl.dsp.exec_cmd(mediaNextCommand))
hl.bind("SUPER + SHIFT + B", hl.dsp.exec_cmd("playerctl previous"), { locked = true, description = "Misc: Previous track" })
hl.bind("SUPER + SHIFT + P", hl.dsp.exec_cmd("playerctl play-pause"),
{ locked = true, description = "Misc: Play/pause media" })
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_SINK@ toggle"), { locked = true })
hl.bind("SUPER + SHIFT + M", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_SINK@ toggle"),
{ locked = true, description = "Misc: Toggle mute" })
hl.bind("ALT + XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_SOURCE@ toggle"), { locked = true })
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_SOURCE@ toggle"), { locked = true })
hl.bind("SUPER + ALT + M", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_SOURCE@ toggle"),
{ locked = true, description = "Misc: Toggle mic" })
--##! Apps --##! Apps
hl.bind("SUPER + Return", hl.dsp.exec_cmd(terminal), { description = "App: Terminal" }) hl.bind("SUPER + Return", hl.dsp.exec_cmd(terminal), { description = "App: Terminal" })
hl.bind("SUPER + T", hl.dsp.exec_cmd(terminal)) hl.bind("SUPER + T", hl.dsp.exec_cmd(terminal))
@@ -16,6 +16,7 @@ Item {
StyledFlickable { StyledFlickable {
id: flickable id: flickable
clip: true
anchors.fill: parent anchors.fill: parent
anchors.margins: Appearance.rounding.small anchors.margins: Appearance.rounding.small
contentHeight: height contentHeight: height
@@ -34,4 +35,10 @@ Item {
} }
} }
} }
ScrollEdgeFade {
target: flickable
vertical: false
color: Appearance.colors.colLayer0Base
}
} }
@@ -8,6 +8,8 @@ import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
// Notes:
// We deal with keybinds being numbered 1, 2, etc by discarding 2+, keeping 1 and replacing it with a generic "<Number>"
Column { Column {
id: root id: root
required property string categoryName required property string categoryName
@@ -61,11 +63,11 @@ Column {
property var keyBlacklist: ["SUPER_L", "SUPER_R"] property var keyBlacklist: ["SUPER_L", "SUPER_R"]
property var keySubstitutions: Object.assign({ property var keySubstitutions: Object.assign({
"Super": "", "Super": "",
"Mouse_up": "Scroll ↓", // ikr, weird "mouse_up": "Scroll ↓", // ikr, weird
"Mouse_down": "Scroll ↑", // trust me bro "mouse_down": "Scroll ↑", // trust me bro
"Mouse:272": "LMB", "mouse:272": "LMB",
"Mouse:273": "RMB", "mouse:273": "RMB",
"Mouse:275": "MouseBack", "mouse:275": "MouseBack",
"Slash": "/", "Slash": "/",
"Hash": "#", "Hash": "#",
"Return": "Enter", "Return": "Enter",
@@ -93,6 +95,7 @@ Column {
return list; return list;
} }
visible: repeater.model.length > 0
spacing: titleSpacing spacing: titleSpacing
StyledText { StyledText {
@@ -100,14 +103,59 @@ Column {
font.pixelSize: Appearance.font.pixelSize.title font.pixelSize: Appearance.font.pixelSize.title
} }
function hasDescription(bind) {
return bind.description?.length > 0;
}
function isCategory(bind, categoryName) {
return bind.description.substring(0, bind.description.indexOf(":")) === categoryName;
}
function isUncategorized(bind) {
return bind.description.indexOf(":") === -1;
}
function containsNonFirstRepetitive(bind) {
const key = bind.key;
if (key.includes("mouse") || key.includes("page")) return false;
// Contains non-1 number
if (/\d/.test(key) && !key.includes("1")) return true;
// Contains non-left direction
if (/^(right|up|down)\b/i.test(key)) return true;
return false;
}
function containsFirstRepetitive(bind) {
const key = bind.key;
return key.includes("1") || /left/i.test(key);
}
function transformKey(key) {
const replaced = root.keySubstitutions[key] || key;
const denumbered = replaced.replace("1", "<Number>");
const dedirectioned = denumbered.replace("Left", "<Direction>");
return dedirectioned;
}
function transformDescription(bind, categoryName) {
const description = bind.description
const regex = new RegExp("\\s*" + categoryName + "\\s*:\\s*");
const decategorized = description.replace(regex, "");
if (!containsFirstRepetitive(bind)) return decategorized;
const denumbered = decategorized.replace("1", "<Number>");
const dedirectioned = denumbered.replace(/ \b(left|right|up|down)\b/i, " <Direction>");
return dedirectioned;
}
Column { Column {
spacing: 4 spacing: 4
Repeater { Repeater {
id: repeater
model: { model: {
if (!root.isCategorized) { if (!root.isCategorized) {
return HyprlandKeybinds.keybinds.filter(bind => bind.description?.length > 0 && bind.description.indexOf(":") === -1); return HyprlandKeybinds.keybinds.filter(bind => root.hasDescription(bind) && root.isUncategorized(bind) && !root.containsNonFirstRepetitive(bind));
} }
return HyprlandKeybinds.keybinds.filter(bind => bind.description?.length > 0 && bind.description.substring(0, bind.description.indexOf(":")) === root.categoryName); return HyprlandKeybinds.keybinds.filter(bind => root.hasDescription(bind) && root.isCategory(bind, root.categoryName) && !root.containsNonFirstRepetitive(bind));
} }
delegate: BindLine { delegate: BindLine {
required property var modelData required property var modelData
@@ -138,7 +186,7 @@ Column {
} }
delegate: KeyboardKey { delegate: KeyboardKey {
required property var modelData required property var modelData
key: modelData key: root.transformKey(modelData)
pixelSize: Config.options.cheatsheet.fontSize.key pixelSize: Config.options.cheatsheet.fontSize.key
} }
} }
@@ -152,10 +200,7 @@ Column {
id: keybindKey id: keybindKey
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: !keyBlacklist.includes(bindLine.keyData.key) visible: !keyBlacklist.includes(bindLine.keyData.key)
key: { key: root.transformKey(bindLine.keyData.key)
const k = StringUtils.toTitleCase(bindLine.keyData.key)
return root.keySubstitutions[k] || k
}
pixelSize: Config.options.cheatsheet.fontSize.key pixelSize: Config.options.cheatsheet.fontSize.key
color: Appearance.colors.colOnLayer0 color: Appearance.colors.colOnLayer0
} }
@@ -169,10 +214,7 @@ Column {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
font.pixelSize: Config.options.cheatsheet.fontSize.comment || Appearance.font.pixelSize.smaller font.pixelSize: Config.options.cheatsheet.fontSize.comment || Appearance.font.pixelSize.smaller
text: { text: root.transformDescription(bindLine.keyData, bindLine.categoryName)
const regex = new RegExp("\\s*" + bindLine.categoryName + "\\s*:\\s*");
return bindLine.keyData.description.replace(regex, "");
}
} }
} }
} }