Files
dotfiles/.config/hypr/bindings.lua
T
2026-06-07 19:03:11 +01:00

367 lines
16 KiB
Lua

-- ==========================
-- Media
-- ==========================
-- Only display the OSD on the currently focused monitor
local osdclient = "swayosd-client --monitor \"$(hyprctl monitors -j | jq -r '.[] | select(.focused == true).name')\""
-- Laptop multimedia keys for volume and LCD brightness (with OSD)
hl.bind(
"XF86AudioRaiseVolume",
hl.dsp.exec_cmd(osdclient .. " --output-volume raise"),
{ locked = true, repeating = true, description = "Volume up" }
)
hl.bind(
"XF86AudioRaiseVolume",
hl.dsp.exec_cmd(osdclient .. " --output-volume raise"),
{ locked = true, repeating = true, description = "Volume up" }
)
hl.bind(
"XF86AudioLowerVolume",
hl.dsp.exec_cmd(osdclient .. " --output-volume lower"),
{ locked = true, repeating = true, description = "Volume down" }
)
hl.bind(
"XF86AudioMute",
hl.dsp.exec_cmd(osdclient .. " --output-volume mute-toggle"),
{ locked = true, repeating = true, description = "Mute" }
)
hl.bind(
"XF86AudioMicMute",
hl.dsp.exec_cmd(osdclient .. " --input-volume mute-toggle"),
{ locked = true, repeating = true, description = "Mute microphone" }
)
hl.bind(
"XF86MonBrightnessUp",
hl.dsp.exec_cmd("station-brightness-display +5%"),
{ locked = true, repeating = true, description = "Brightness up" }
)
hl.bind(
"XF86MonBrightnessDown",
hl.dsp.exec_cmd("station-brightness-display 5%-"),
{ locked = true, repeating = true, description = "Brightness down" }
)
hl.bind(
"XF86KbdBrightnessUp",
hl.dsp.exec_cmd("station-brightness-keyboard up"),
{ locked = true, repeating = true, description = "Keyboard brightness up" }
)
hl.bind(
"XF86KbdBrightnessDown",
hl.dsp.exec_cmd("station-brightness-keyboard down"),
{ locked = true, repeating = true, description = "Keyboard brightness down" }
)
hl.bind(
"XF86KbdLightOnOff",
hl.dsp.exec_cmd("station-brightness-keyboard cycle"),
{ locked = true, description = "Keyboard backlight cycle" }
)
-- Precise 1% multimedia adjustments with Alt modifier
hl.bind(
"ALT + XF86AudioRaiseVolume",
hl.dsp.exec_cmd("$osdclient --output-volume +1"),
{ locked = true, repeating = true, description = "Volume up precise" }
)
hl.bind(
"ALT + XF86AudioLowerVolume",
hl.dsp.exec_cmd("$osdclient --output-volume -1"),
{ locked = true, repeating = true, description = "Volume down precise" }
)
hl.bind(
"ALT + XF86MonBrightnessUp",
hl.dsp.exec_cmd("station-brightness-display +1%"),
{ locked = true, repeating = true, description = "Brightness up precise" }
)
hl.bind(
"ALT + XF86MonBrightnessDown",
hl.dsp.exec_cmd("station-brightness-display 1%-"),
{ locked = true, repeating = true, description = "Brightness down precise" }
)
-- Requires playerctl
hl.bind(
"F86AudioNext",
hl.dsp.exec_cmd(osdclient .. " --playerctl next"),
{ locked = true, description = "Next track" }
)
hl.bind(
"F86AudioPause",
hl.dsp.exec_cmd(osdclient .. " --playerctl play-pause"),
{ locked = true, description = "Pause" }
)
hl.bind(
"F86AudioPlay",
hl.dsp.exec_cmd(osdclient .. " --playerctl play-pause"),
{ locked = true, description = "Play" }
)
hl.bind(
"F86AudioPrev",
hl.dsp.exec_cmd(osdclient .. " --playerctl previous"),
{ locked = true, description = "Previous track" }
)
-- Switch audio output with Super + Mute
hl.bind(
"SUPER + XF86AudioMute",
hl.dsp.exec_cmd("station-cmd-audio-switch"),
{ locked = true, description = "Switch audio output" }
)
-- ==========================
-- Copy & Paste
-- ==========================
hl.bind("SUPER + C", hl.dsp.send_shortcut("CTRL + Insert"), { description = "Universal copy" })
hl.bind("SUPER + V", hl.dsp.send_shortcut("SHIFT + Insert"), { description = "Universal paste" })
hl.bind("SUPER + X", hl.dsp.send_shortcut("CTRL + X"), { description = "Universal cut" })
hl.bind("SUPER + A", hl.dsp.send_shortcut("CTRL + A"), { description = "Universal cut" })
hl.bind(
"SUPER + CTRL + V",
hl.dsp.exec_cmd("station-launch-walker -m clipboard"),
{ description = "Clipboard manager" }
)
-- Close windows
hl.bind("SUPER + Q", hl.dsp.window.kill(), { description = "Close window" })
-- ==========================
-- Tiling
-- ==========================
hl.bind("SUPER + P", hl.dsp.window.pseudo()--[[# dwindle]], { description = "Pseudo window" })
hl.bind("SUPER + F", hl.dsp.window.fullscreen(0), { description = "Full screen" })
hl.bind("SUPER + CTRL + F", hl.dsp.window.fullscreen(1), { description = "Full width" })
hl.bind("SUPER + T", hl.dsp.exec_cmd("station-hyprland-window-pop"), { description = "Pop window out (float & pin)" })
hl.bind(
"SUPER + CTRL + L",
hl.dsp.exec_cmd("station-hyprland-workspace-layout-toggle"),
{ description = "Toggle workspace layout" }
)
-- Move focus with SUPER + arrow keys
hl.bind("SUPER + H", hl.dsp.focus({ direction = "left" }), { description = "Move window focus left" })
hl.bind("SUPER + L", hl.dsp.focus({ description = "right" }), { description = "Move window focus right" })
hl.bind("SUPER + K", hl.dsp.focus({ direction = "up" }), { description = "Move window focus up" })
hl.bind("SUPER + J", hl.dsp.focus({ direction = "down" }), { description = "Move window focus down" })
hl.bind("SUPER + SHIFT + H", hl.dsp.window.move({ direction = "left" }), { description = "Move window left" })
hl.bind("SUPER + SHIFT + L", hl.dsp.window.move({ direction = "right" }), { description = "Move window right" })
hl.bind("SUPER + SHIFT + K", hl.dsp.window.move({ direction = "up" }), { description = "Move window up" })
hl.bind("SUPER + SHIFT + J", hl.dsp.window.move({ direction = "down" }), { description = "Move window down" })
-- Control scratchpad
hl.bind("SUPER + S", hl.dsp.workspace.toggle_special("scratchpad"), { description = "Toggle scratchpad" })
hl.bind(
"SUPER + ALT + S",
hl.dsp.window.move({ worspace = "special:scratchpad" }),
{ description = "Move window to scratchpad" }
)
-- Cycle through applications on active workspace
hl.bind("SUPER + TAB", hl.dsp.window.cycle_next({ next = true }), { description = "Cycle to next window" })
hl.bind("SUPER + SHIFT + TAB", hl.dsp.window.cycle_next({ next = false }), { description = "Cycle to prev window" })
-- hl.bind("SUPER + TAB", /*bringactivetotop*/, { description = "Reveal active window on top" })
-- hl.bind("SUPER SHIFT + TAB", /*bringactivetotop*/, { description = "Reveal active window on top" })
-- Resize active window
hl.bind("SUPER + code:20", hl.dsp.window.resize({ x = -100, y = 0 }), { description = "Expand window left" })
hl.bind("SUPER + code:21", hl.dsp.window.resize({ x = 100, y = 0 }), { description = "Shrink window left" })
hl.bind("SUPER + SHIFT + code:20", hl.dsp.window.resize({ x = 0, y = -100 }), { description = "Shrink window up" })
hl.bind("SUPER + SHIFT + code:21", hl.dsp.window.resize({ x = 0, y = 100 }), { description = "Expand window down" })
-- Move/resize windows with mainMod + LMB/RMB and dragging
hl.bind("SUPER + mouse:272", hl.dsp.window.drag(), { mouse = true, description = "Move window" })
hl.bind("SUPER + mouse:273", hl.dsp.window.resize(), { mouse = true, description = "Move window" })
-- Toggle current window to be a group or stack in other window manager lingo
hl.bind("SUPER + G", hl.dsp.group.toggle())
-- Move to the next tab group window
hl.bind("SUPER + bracketleft", hl.dsp.group.prev())
hl.bind("SUPER + bracketright", hl.dsp.group.next())
-- Move current window in the tab group
hl.bind("SUPER + SHIFT + bracketleft", hl.dsp.group.move_window({ direction = "left" }))
hl.bind("SUPER + SHIFT + bracketright", hl.dsp.group.move_window({ direction = "right" }))
-- Move current window out of the tab group
hl.bind("SUPER + CTRL + bracketleft", hl.dsp.window.move({ out_of_group = "left" }))
hl.bind("SUPER + CTRL + bracketright", hl.dsp.window.move({ out_of_group = "right" }))
-- Move current window into an existing tab group or create a new one
hl.bind("SUPER + SHIFT + CTRL + bracketleft", hl.dsp.window.move({ into_or_create_group = "left" }))
hl.bind("SUPER + SHIFT + CTRL + bracketright", hl.dsp.window.move({ into_or_create_group = "right" }))
-- ==========================
-- Utilities
-- ==========================
-- Menus
hl.bind("SUPER + SPACE", hl.dsp.exec_cmd("station-launch-walker"), { description = "Launch apps" })
hl.bind("SUPER + CTRL + E", hl.dsp.exec_cmd("station-launch-walker -m symbols"), { description = "Emoji picker" })
hl.bind("SUPER + CTRL + C", hl.dsp.exec_cmd("station-menu capture"), { description = "Capture menu" })
hl.bind("SUPER + CTRL + O", hl.dsp.exec_cmd("station-menu toggle"), { description = "Toggle menu" })
hl.bind("SUPER + ALT + SPACE", hl.dsp.exec_cmd("station-menu"), { description = "Station menu" })
hl.bind("SUPER + ESCAPE", hl.dsp.exec_cmd("station-menu system"), { description = "System menu" })
hl.bind("F86PowerOff", hl.dsp.exec_cmd("station-menu system"), { locked = true, description = "Power menu" })
hl.bind("SUPER + K", hl.dsp.exec_cmd("station-menu-keybindings"), { description = "Show key bindings" })
hl.bind("XF86Calculator", hl.dsp.exec_cmd("gnome-calculator"), { description = "Calculator" })
-- Aesthetics
hl.bind("SUPER + SHIFT + SPACE", hl.dsp.exec_cmd("station-toggle-waybar"), { description = "Toggle top bar" })
hl.bind("SUPER + CTRL + SPACE", hl.dsp.exec_cmd("station-menu background"), { description = "Theme background menu" })
-- hl.bind("SUPER SHIFT CTRL + SPACE", hl.dsp.exec_cmd("station-menu theme"), { description = "Theme menu" })
hl.bind(
"SUPER + BACKSPACE",
hl.dsp.exec_cmd("hyprctl dispatch setprop \"address:$(hyprctl activewindow -j | jq -r '.address')\" opaque toggle"),
{ description = "Toggle window transparency" }
)
hl.bind(
"SUPER + SHIFT + BACKSPACE",
hl.dsp.exec_cmd("station-hyprland-window-gaps-toggle"),
{ description = "Toggle window gaps" }
)
hl.bind(
"SUPER + CTRL + Backspace",
hl.dsp.exec_cmd("station-hyprland-window-single-square-aspect-toggle"),
{ description = "Toggle single-window square aspect" }
)
-- Notifications
hl.bind("SUPER + COMMA", hl.dsp.exec_cmd("makoctl dismiss"), { description = "Dismiss last notification" })
hl.bind(
"SUPER + SHIFT + COMMA",
hl.dsp.exec_cmd("makoctl dismiss --all"),
{ description = "Dismiss all notifications" }
)
hl.bind(
"SUPER + CTRL + COMMA",
hl.dsp.exec_cmd("station-toggle-notification-silencing"),
{ description = "Toggle silencing notifications" }
)
hl.bind("SUPER + ALT + COMMA", hl.dsp.exec_cmd("makoctl invoke"), { description = "Invoke last notification" })
hl.bind(
"SUPER + SHIFT + ALT + COMMA",
hl.dsp.exec_cmd("makoctl restore"),
{ description = "Restore last notification" }
)
-- Toggles
hl.bind("SUPER + CTRL + I", hl.dsp.exec_cmd("station-toggle-idle"), { description = "Toggle locking on idle" })
hl.bind("SUPER + CTRL + N", hl.dsp.exec_cmd("station-toggle-nightlight"), { description = "Toggle nightlight" })
-- Captures
hl.bind("PRINT", hl.dsp.exec_cmd("station-cmd-screenshot"), { description = "Screenshot" })
hl.bind("ALT + PRINT", hl.dsp.exec_cmd("station-menu screenrecord"), { description = "Screenrecording" })
hl.bind("SUPER + PRINT", hl.dsp.exec_cmd("pkill hyprpicker || hyprpicker -a"), { description = "Color picker" })
-- File sharing
-- hl.bind("SUPER CTRL + S", hl.dsp.exec_cmd("station-menu share"), { description = "Share" })
-- Waybar-less information
hl.bind(
"SUPER + CTRL ALT + T",
hl.dsp.exec_cmd('notify-send " $(date +"%A %H:%M — %d %B W%V %Y")"'),
{ description = "Show time" }
)
hl.bind(
"SUPER + CTRL ALT + B",
hl.dsp.exec_cmd('notify-send "󰁹 Battery is at $(station-battery-remaining)%"'),
{ description = "Show battery remaining" }
)
hl.bind(
"SUPER + CTRL ALT + W",
hl.dsp.exec_cmd('notify-send "$(hyprctl activewindow -j | jq -r \'"Window: (.title)\nClass: (.class)"\')"'),
{ description = "Show active window name and class" }
)
-- Control panels
hl.bind("SUPER + CTRL + A", hl.dsp.exec_cmd("station-launch-audio"), { description = "Audio controls" })
hl.bind("SUPER + CTRL + B", hl.dsp.exec_cmd("station-launch-bluetooth"), { description = "Bluetooth controls" })
hl.bind("SUPER + CTRL + W", hl.dsp.exec_cmd("station-launch-wifi"), { description = "Wifi controls" })
hl.bind("SUPER + CTRL + T", hl.dsp.exec_cmd("station-launch-tui btop"), { description = "Activity" })
-- Dictation
-- hl.bind("SUPER CTRL + X", hl.dsp.exec_cmd("voxtype record toggle"), { description = "Toggle dictation" })
-- Zoom
hl.bind(
"SUPER + CTRL + Z",
hl.dsp.exec_cmd("hyprctl keyword cursor:zoom_factor $(hyprctl getoption cursor:zoom_factor -j | jq '.float + 1')"),
{ description = "Zoom in" }
)
hl.bind("SUPER + CTRL ALT + Z", hl.dsp.exec_cmd("hyprctl keyword cursor:zoom_factor 1"), { description = "Reset zoom" })
-- Lock system
-- hl.bind("SUPER CTRL + L", hl.dsp.exec_cmd("station-lock-screen"), { description = "Lock system" })
-- ==========================
-- Applications
-- ==========================
hl.bind("SUPER + RETURN", hl.dsp.exec_cmd("uwsm-app -- xdg-terminal-exec"), { description = "Terminal" })
hl.bind(
"SUPER + ALT + RETURN",
hl.dsp.exec_cmd('uwsm-app -- xdg-terminal-exec --dir="$(station-cmd-terminal-cwd)" tmux new'),
{ description = "Tmux" }
)
hl.bind("SUPER + SHIFT + F", hl.dsp.exec_cmd("uwsm-app -- nautilus --new-window"), { description = "File manager" })
hl.bind(
"SUPER + ALT SHIFT + F",
hl.dsp.exec_cmd('uwsm-app -- nautilus --new-window "$(station-cmd-terminal-cwd)"'),
{ description = "File manager (cwd)" }
)
hl.bind(
"SUPER + SHIFT + B",
hl.dsp.exec_cmd("/home/chris/.local/bin/station-launch-browser"),
{ description = "Browser" }
)
hl.bind(
"SUPER + SHIFT ALT + B",
hl.dsp.exec_cmd("station-launch-browser --private"),
{ description = "Browser (private)" }
)
hl.bind("SUPER + SHIFT + M", hl.dsp.exec_cmd("station-launch-or-focus spotify"), { description = "Music" })
hl.bind("SUPER + SHIFT + N", hl.dsp.exec_cmd("station-launch-editor"), { description = "Editor" })
-- hl.bind("SUPER SHIFT + D", hl.dsp.exec_cmd("station-launch-tui lazydocker"), { description = "Docker" })
hl.bind(
"SUPER + SHIFT + G",
hl.dsp.exec_cmd('station-launch-or-focus ^signal$ "uwsm-app -- signal-desktop"'),
{ description = "Signal" }
)
hl.bind(
"SUPER + SHIFT + O",
hl.dsp.exec_cmd('station-launch-or-focus ^obsidian$ "uwsm-app -- obsidian -disable-gpu --enable-wayland-ime"'),
{ description = "Obsidian" }
)
-- hl.bind("SUPER SHIFT + W", hl.dsp.exec_cmd("uwsm-app -- typora --enable-wayland-ime"), { description = "Typora" })
hl.bind("SUPER + SHIFT + SLASH", hl.dsp.exec_cmd("Enpass showassistant"), { description = "Passwords" })
hl.bind("SUPER + SHIFT + E", hl.dsp.exec_cmd("station-launch-or-focus mailspring"), { description = "Email" })
hl.bind(
"SUPER + SHIFT + A",
hl.dsp.exec_cmd('station-launch-webapp "https://gemini.google.com/app"'),
{ description = "ChatGPT" }
)
hl.bind(
"SUPER + SHIFT + C",
hl.dsp.exec_cmd('station-launch-webapp "https://tower.scarif.space/apps/calendar"'),
{ description = "Calendar" }
)
hl.bind(
"SUPER + SHIFT + Y",
hl.dsp.exec_cmd('station-launch-or-focus-webapp "YouTube" "https://youtube.com/"'),
{ description = "YouTube" }
)
hl.bind(
"SUPER + SHIFT + ALT + G",
hl.dsp.exec_cmd('station-launch-or-focus-webapp WhatsApp "https://web.whatsapp.com/"'),
{ description = "WhatsApp" }
)
hl.bind(
"SUPER + SHIFT + CTRL + G",
hl.dsp.exec_cmd('station-launch-or-focus-webapp "Google Maps" "https://maps.google.com"'),
{ description = "Google Maps" }
)
-- hl.bind("SUPER SHIFT + P", hl.dsp.exec_cmd("station-launch-or-focus-webapp "Google Photos" "https://photos.google.com/""), { description = "Google Photos" })
-- hl.bind("SUPER SHIFT + X", hl.dsp.exec_cmd("station-launch-webapp "https://x.com/""), { description = "X" })
-- hl.bind("SUPER SHIFT ALT + X", hl.dsp.exec_cmd("station-launch-webapp "https://x.com/compose/post""), { description = "X Post" })
-- Add extra bindings
hl.bind("SUPER + SHIFT + R", hl.dsp.exec_cmd("ghostty -e ssh scarif"), { description = "SSH to scarif" })