Files
dotfiles/.config/hypr/bindings.lua
T

315 lines
16 KiB
Lua
Raw Normal View History

2026-06-06 19:08:02 +01:00
-- ==========================
-- Media
-- ==========================
-- Only display the OSD on the currently focused monitor
2026-07-21 22:04:54 +01:00
local osdclient = 'swayosd-client --monitor "$(hyprctl monitors -j | jq -r \'.[] | select(.focused == true).name\')"'
2026-06-06 19:08:02 +01:00
2026-06-07 22:38:07 +01:00
local exec = hl.dsp.exec_cmd
local shortcut = hl.dsp.send_shortcut
local function bind(key, cmd, desc, opts)
opts = opts or {}
opts.desc = desc
hl.bind(key, cmd, opts)
end
local function bindl(key, cmd, desc, opts)
opts = opts or {}
opts.locked = true
bind(key, cmd, desc, opts)
end
local function bindlr(key, cmd, desc, opts)
opts = opts or {}
opts.repeating = true
bindl(key, cmd, desc, opts)
end
2026-06-21 16:44:45 +01:00
local function notify(text)
2026-07-21 22:04:54 +01:00
hl.notification.create { text = text, duration = 2000 }
2026-06-21 16:44:45 +01:00
end
2026-06-06 19:08:02 +01:00
-- Laptop multimedia keys for volume and LCD brightness (with OSD)
2026-07-21 22:04:54 +01:00
bindlr('XF86AudioRaiseVolume', exec(osdclient .. ' --output-volume raise'), 'Volume up')
bindlr('XF86AudioRaiseVolume', exec(osdclient .. ' --output-volume raise'), 'Volume up')
bindlr('XF86AudioLowerVolume', exec(osdclient .. ' --output-volume lower'), 'Volume down')
bindlr('XF86AudioMute', exec(osdclient .. ' --output-volume mute-toggle'), 'Mute')
bindlr('XF86AudioMicMute', exec(osdclient .. ' --input-volume mute-toggle'), 'Mute microphone')
bindlr('XF86MonBrightnessUp', exec 'station-brightness-display +5%', 'Brightness up')
bindlr('XF86MonBrightnessDown', exec 'station-brightness-display 5%-', 'Brightness down')
bindlr('XF86KbdBrightnessUp', exec 'station-brightness-keyboard up', 'Keyboard brightness up')
bindlr('XF86KbdBrightnessDown', exec 'station-brightness-keyboard down', 'Keyboard brightness down')
bindl('XF86KbdLightOnOff', exec 'station-brightness-keyboard cycle', 'Keyboard backlight cycle')
2026-06-06 19:08:02 +01:00
-- Precise 1% multimedia adjustments with Alt modifier
2026-07-21 22:04:54 +01:00
bindlr('ALT + XF86AudioRaiseVolume', exec '$osdclient --output-volume +1', 'Volume up precise')
bindlr('ALT + XF86AudioLowerVolume', exec '$osdclient --output-volume -1', 'Volume down precise')
bindlr('ALT + XF86MonBrightnessUp', exec 'station-brightness-display +1%', 'Brightness up precise')
bindlr('ALT + XF86MonBrightnessDown', exec 'station-brightness-display 1%-', 'Brightness down precise')
2026-06-06 19:08:02 +01:00
-- Requires playerctl
2026-07-21 22:04:54 +01:00
bindl('XF86AudioNext', exec(osdclient .. ' --playerctl next'), 'Next track')
bindl('XF86AudioPause', exec(osdclient .. ' --playerctl play-pause'), 'Pause')
bindl('XF86AudioPlay', exec(osdclient .. ' --playerctl play-pause'), 'Play')
bindl('XF86AudioPrev', exec(osdclient .. ' --playerctl previous'), 'Previous track')
2026-06-06 19:08:02 +01:00
-- Switch audio output with Super + Mute
2026-07-21 22:04:54 +01:00
bindl('SUPER + XF86AudioMute', exec 'station-cmd-audio-switch', 'Switch audio output')
2026-06-06 19:08:02 +01:00
-- ==========================
-- Copy & Paste
-- ==========================
2026-07-21 22:04:54 +01:00
bind('SUPER + C', shortcut { mods = 'CTRL', key = 'Insert' }, 'Universal copy')
bind('SUPER + V', shortcut { mods = 'SHIFT', key = 'Insert' }, 'Universal paste')
bind('SUPER + X', shortcut { mods = 'CRTL', key = 'X' }, 'Universal cut')
bind('SUPER + A', shortcut { mods = 'CTRL', key = 'A' }, 'Universal cut')
bind('SUPER + CTRL + V', exec 'station-launch-walker -m clipboard', 'Clipboard manager')
2026-06-06 19:08:02 +01:00
-- Close windows
2026-07-21 22:04:54 +01:00
bind('SUPER + Q', hl.dsp.window.close(), 'Close window')
2026-06-06 19:08:02 +01:00
-- ==========================
-- Tiling
-- ==========================
2026-07-21 22:04:54 +01:00
bind('SUPER + P', hl.dsp.window.pseudo()--[[# dwindle]], 'Pseudo window')
bind('SUPER + F', hl.dsp.window.fullscreen(0), 'Full screen')
bind('SUPER + CTRL + F', hl.dsp.window.fullscreen(1), 'Full width')
bind('SUPER + T', function()
2026-06-21 16:44:45 +01:00
local width = 1300
local height = 900
local pinned = hl.get_active_window().pinned
if pinned then
hl.dispatch(hl.dsp.window.pin())
2026-07-21 22:04:54 +01:00
hl.dispatch(hl.dsp.window.float { action = 'toggle' })
hl.dispatch(hl.dsp.window.tag { tag = '-pop' })
2026-06-21 16:44:45 +01:00
else
2026-07-21 22:04:54 +01:00
hl.dispatch(hl.dsp.window.float { action = 'toggle' })
hl.dispatch(hl.dsp.window.resize { x = width, y = height })
2026-06-21 16:44:45 +01:00
hl.dispatch(hl.dsp.window.center())
hl.dispatch(hl.dsp.window.pin())
2026-07-21 22:04:54 +01:00
hl.dispatch(hl.dsp.window.alter_zorder { mode = 'top' })
hl.dispatch(hl.dsp.window.tag { tag = '+pop' })
2026-06-21 16:44:45 +01:00
end
2026-07-21 22:04:54 +01:00
end, 'Pop window out (float & pin)')
bind('SUPER + CTRL + L', function()
local layouts = { 'dwindle', 'scrolling', 'monocle', 'master' }
2026-06-21 16:44:45 +01:00
local workspace = hl.get_active_workspace()
if hl.get_active_special_workspace() then
workspace = hl.get_active_special_workspace()
end
2026-07-21 22:04:54 +01:00
local next_layout = 'dwindle'
2026-06-21 16:44:45 +01:00
if not workspace then
return
end
for i = 1, #layouts do
if layouts[i] == workspace.tiled_layout then
local next_layout_idx = (i % #layouts) + 1
next_layout = layouts[next_layout_idx]
break
end
end
if workspace.special then
2026-07-21 22:04:54 +01:00
hl.workspace_rule { workspace = tostring(workspace.name), layout = next_layout }
2026-06-21 16:44:45 +01:00
else
2026-07-21 22:04:54 +01:00
hl.workspace_rule { workspace = tostring(workspace.id), layout = next_layout }
2026-06-21 16:44:45 +01:00
end
2026-07-21 22:04:54 +01:00
notify('󱂬 Workspace layout set to ' .. next_layout)
end, 'Toggle workspace layout')
2026-06-06 19:08:02 +01:00
-- Move focus with SUPER + arrow keys
2026-07-21 22:04:54 +01:00
bind('SUPER + H', hl.dsp.focus { direction = 'left' }, 'Move window focus left')
bind('SUPER + L', hl.dsp.focus { direction = 'right' }, 'Move window focus right')
bind('SUPER + K', hl.dsp.focus { direction = 'up' }, 'Move window focus up')
bind('SUPER + J', hl.dsp.focus { direction = 'down' }, 'Move window focus down')
bind('SUPER + SHIFT + H', hl.dsp.window.move { direction = 'left' }, 'Move window left')
bind('SUPER + SHIFT + L', hl.dsp.window.move { direction = 'right' }, 'Move window right')
bind('SUPER + SHIFT + K', hl.dsp.window.move { direction = 'up' }, 'Move window up')
bind('SUPER + SHIFT + J', hl.dsp.window.move { direction = 'down' }, 'Move window down')
2026-06-06 19:08:02 +01:00
-- Control scratchpad
2026-07-21 22:04:54 +01:00
bind('SUPER + S', hl.dsp.workspace.toggle_special 'scratchpad', 'Toggle scratchpad')
bind('SUPER + ALT + S', hl.dsp.window.move { workspace = 'special:scratchpad' }, 'Move window to scratchpad')
bind('SUPER + N', function()
hl.dispatch(hl.dsp.workspace.toggle_special 'prod')
local windows = hl.get_windows { workspace = 'special:prod' }
if #windows == 0 then
hl.exec_cmd 'station-launch-or-focus ^superProductivity$ "uwsm-app -- super-productivity"'
hl.exec_cmd 'uwsm-app -- xdg-terminal-exec --app-id=org.station.notes nvim ~/Tower/Documents/Notes'
end
end, 'Toggle productivity workspace')
bind('SUPER + M', function()
hl.dispatch(hl.dsp.workspace.toggle_special 'music')
local windows = hl.get_windows { workspace = 'special:music' }
if #windows == 0 then
hl.exec_cmd 'station-launch-or-focus spotify'
hl.exec_cmd 'station-launch-or-focus psysonic'
end
end, 'Toggle music workspace')
bind('SUPER + D', function()
hl.dispatch(hl.dsp.workspace.toggle_special 'comms')
local windows = hl.get_windows { workspace = 'special:comms' }
if #windows == 0 then
hl.exec_cmd 'station-launch-or-focus ^signal$ "uwsm-app -- signal-desktop"'
hl.exec_cmd 'station-launch-or-focus ^chrome-web.whatsapp.com__-Default$ "station-launch-webapp https://web.whatsapp.com"'
hl.exec_cmd 'station-launch-or-focus ^chrome-discord.com__channels_@me-Default$ "station-launch-webapp https://discord.com/channels/@me"'
end
end, 'Toggle comms workspace')
2026-06-06 19:08:02 +01:00
-- Cycle through applications on active workspace
2026-07-21 22:04:54 +01:00
bind('SUPER + TAB', hl.dsp.window.cycle_next { next = true }, 'Cycle to next window')
bind('SUPER + SHIFT + TAB', hl.dsp.window.cycle_next { next = false }, 'Cycle to prev window')
2026-06-07 22:38:07 +01:00
-- bind("SUPER + TAB", /*bringactivetotop*/, "Reveal active window on top")
-- bind("SUPER SHIFT + TAB", /*bringactivetotop*/, "Reveal active window on top")
2026-06-06 19:08:02 +01:00
-- Resize active window
2026-07-21 22:04:54 +01:00
bind('SUPER + code:20', hl.dsp.window.resize { x = -100, y = 0 }, 'Expand window left')
bind('SUPER + code:21', hl.dsp.window.resize { x = 100, y = 0 }, 'Shrink window left')
bind('SUPER + SHIFT + code:20', hl.dsp.window.resize { x = 0, y = -100 }, 'Shrink window up')
bind('SUPER + SHIFT + code:21', hl.dsp.window.resize { x = 0, y = 100 }, 'Expand window down')
2026-06-06 19:08:02 +01:00
-- Move/resize windows with mainMod + LMB/RMB and dragging
2026-07-21 22:04:54 +01:00
bind('SUPER + mouse:272', hl.dsp.window.drag(), 'Move window', { mouse = true })
bind('SUPER + mouse:273', hl.dsp.window.resize(), 'Resize window', { mouse = true })
2026-06-06 19:08:02 +01:00
-- Toggle current window to be a group or stack in other window manager lingo
2026-07-21 22:04:54 +01:00
bind('SUPER + G', hl.dsp.group.toggle(), 'Toggle window to a group')
2026-06-06 19:08:02 +01:00
-- Move to the next tab group window
2026-07-21 22:04:54 +01:00
bind('SUPER + bracketleft', hl.dsp.group.prev(), 'Move to previous window in the group')
bind('SUPER + bracketright', hl.dsp.group.next(), 'Move to next window in the group')
2026-06-06 19:08:02 +01:00
-- Move current window in the tab group
2026-07-21 22:04:54 +01:00
bind('SUPER + SHIFT + bracketleft', hl.dsp.group.move_window { direction = 'left' }, 'Move window left in group')
bind('SUPER + SHIFT + bracketright', hl.dsp.group.move_window { direction = 'right' }, 'Move window right in group')
2026-06-06 19:08:02 +01:00
-- Move current window out of the tab group
2026-07-21 22:04:54 +01:00
bind('SUPER + CTRL + bracketleft', hl.dsp.window.move { out_of_group = 'left' }, 'Move window out of group left')
bind('SUPER + CTRL + bracketright', hl.dsp.window.move { out_of_group = 'right' }, 'Move window out of group right')
2026-06-06 19:08:02 +01:00
-- Move current window into an existing tab group or create a new one
2026-07-21 22:04:54 +01:00
bind('SUPER + SHIFT + CTRL + bracketleft', hl.dsp.window.move { into_or_create_group = 'left' }, 'Move window into group left')
bind('SUPER + SHIFT + CTRL + bracketright', hl.dsp.window.move { into_or_create_group = 'right' }, 'Move window into group right')
2026-06-06 19:08:02 +01:00
-- ==========================
-- Utilities
-- ==========================
-- Menus
2026-07-21 22:04:54 +01:00
bind('SUPER + SPACE', exec 'station-launch-walker', 'Launch apps')
bind('SUPER + CTRL + E', exec 'station-launch-walker -m symbols', 'Emoji picker')
bind('SUPER + CTRL + C', exec 'station-menu capture', 'Capture menu')
bind('SUPER + CTRL + O', exec 'station-menu toggle', 'Toggle menu')
bind('SUPER + ALT + SPACE', exec 'station-menu', 'Station menu')
bind('SUPER + ESCAPE', exec 'station-menu system', 'System menu')
bindl('XF86PowerOff', exec 'station-menu system', 'Power menu')
bind('SUPER + K', exec 'station-menu-keybindings', 'Show key bindings')
bind('XF86Calculator', exec 'gnome-calculator', 'Calculator')
2026-06-06 19:08:02 +01:00
-- Aesthetics
2026-07-21 22:04:54 +01:00
bind('SUPER + SHIFT + SPACE', exec 'station-toggle-waybar', 'Toggle top bar')
bind('SUPER + CTRL + SPACE', exec 'station-menu background', 'Theme background menu')
2026-06-07 22:38:07 +01:00
-- bind("SUPER SHIFT CTRL + SPACE", exec("station-menu theme"), "Theme menu")
2026-07-21 22:04:54 +01:00
bind('SUPER + BACKSPACE', exec 'hyprctl dispatch setprop "address:$(hyprctl activewindow -j | jq -r \'.address\')" opaque toggle', 'Toggle window transparency')
bind('SUPER + SHIFT + BACKSPACE', function()
local gaps = hl.get_config 'general.gaps_out'
2026-06-21 16:44:45 +01:00
if gaps.top == 0 then
2026-07-21 22:04:54 +01:00
hl.config {
2026-06-21 16:44:45 +01:00
general = {
gaps_out = 10,
gaps_in = 5,
border_size = 2,
},
2026-07-21 22:04:54 +01:00
}
2026-06-21 16:44:45 +01:00
else
2026-07-21 22:04:54 +01:00
hl.config {
2026-06-21 16:44:45 +01:00
general = {
gaps_out = 0,
gaps_in = 0,
border_size = 0,
},
2026-07-21 22:04:54 +01:00
}
2026-06-21 16:44:45 +01:00
end
2026-07-21 22:04:54 +01:00
end, 'Toggle window gaps')
2026-06-06 19:08:02 +01:00
-- Notifications
2026-07-21 22:04:54 +01:00
bind('SUPER + COMMA', exec 'makoctl dismiss', 'Dismiss last notification')
bind('SUPER + SHIFT + COMMA', exec 'makoctl dismiss --all', 'Dismiss all notifications')
bind('SUPER + CTRL + COMMA', exec 'station-toggle-notification-silencing', 'Toggle silencing notifications')
bind('SUPER + ALT + COMMA', exec 'makoctl invoke', 'Invoke last notification')
bind('SUPER + SHIFT + ALT + COMMA', exec 'makoctl restore', 'Restore last notification')
2026-06-06 19:08:02 +01:00
-- Toggles
2026-07-21 22:04:54 +01:00
bind('SUPER + CTRL + I', exec 'station-toggle-idle', 'Toggle locking on idle')
bind('SUPER + CTRL + N', exec 'station-toggle-nightlight', 'Toggle nightlight')
2026-06-06 19:08:02 +01:00
-- Captures
2026-07-21 22:04:54 +01:00
bind('PRINT', exec 'station-cmd-screenshot', 'Screenshot')
bind('ALT + PRINT', exec 'station-menu screenrecord', 'Screenrecording')
bind('SUPER + PRINT', exec 'pkill hyprpicker || hyprpicker -a', 'Color picker')
2026-06-06 19:08:02 +01:00
-- File sharing
2026-06-07 22:38:07 +01:00
-- bind("SUPER CTRL + S", exec("station-menu share"), "Share")
2026-06-06 19:08:02 +01:00
-- Waybar-less information
2026-07-21 22:04:54 +01:00
bind('SUPER + CTRL + ALT + T', exec 'notify " $(date +"%A %H:%M — %d %B W%V %Y")"', 'Show time')
bind('SUPER + CTRL + ALT + B', exec 'notify-send "󰁹 Battery is at $(station-battery-remaining)%"', 'Show battery remaining')
bind('SUPER + CTRL + ALT + W', function()
2026-06-21 16:44:45 +01:00
local window = hl.get_active_window()
2026-07-21 22:04:54 +01:00
notify('Window: ' .. window.title .. '\nClass: ' .. window.class)
end, 'Show active window name and class')
2026-06-06 19:08:02 +01:00
-- Control panels
2026-07-21 22:04:54 +01:00
bind('SUPER + CTRL + A', exec 'station-launch-audio', 'Audio controls')
bind('SUPER + CTRL + B', exec 'station-launch-bluetooth', 'Bluetooth controls')
bind('SUPER + CTRL + W', exec 'station-launch-wifi', 'Wifi controls')
bind('SUPER + CTRL + T', exec 'station-launch-tui btop', 'Activity')
2026-06-06 19:08:02 +01:00
-- Dictation
2026-06-07 22:38:07 +01:00
-- bind("SUPER CTRL + X", exec("voxtype record toggle"), "Toggle dictation")
2026-06-06 19:08:02 +01:00
-- Zoom
2026-07-21 22:04:54 +01:00
bind('SUPER + CTRL + Z', exec "hyprctl keyword cursor:zoom_factor $(hyprctl getoption cursor:zoom_factor -j | jq '.float + 1')", 'Zoom in')
bind('SUPER + CTRL + ALT + Z', exec 'hyprctl keyword cursor:zoom_factor 1', 'Reset zoom')
2026-06-06 19:08:02 +01:00
-- Lock system
2026-06-07 22:38:07 +01:00
-- bind("SUPER CTRL + L", exec("station-lock-screen"), "Lock system")
2026-06-06 19:08:02 +01:00
-- ==========================
-- Applications
-- ==========================
2026-07-21 22:04:54 +01:00
bind('SUPER + RETURN', exec 'uwsm-app -- xdg-terminal-exec', 'Terminal')
bind('SUPER + ALT + RETURN', exec 'uwsm-app -- xdg-terminal-exec --dir="$(station-cmd-terminal-cwd)" tmux new', 'Tmux')
bind('SUPER + SHIFT + F', exec 'uwsm-app -- nautilus --new-window', 'File manager')
bind('SUPER + ALT + SHIFT + F', exec 'uwsm-app -- nautilus --new-window "$(station-cmd-terminal-cwd)"', 'File manager (cwd)')
bind('SUPER + SHIFT + B', exec 'station-launch-browser', 'Browser')
bind('SUPER + SHIFT + ALT + B', exec 'station-launch-browser --private', 'Browser (private)')
bind('SUPER + SHIFT + S', exec 'station-launch-or-focus spotify', 'Spotify')
bind('SUPER + SHIFT + M', exec 'station-launch-or-focus psysonic', 'Music')
2026-06-07 22:38:07 +01:00
-- bind("SUPER SHIFT + D", exec("station-launch-tui lazydocker"), "Docker")
2026-07-21 22:04:54 +01:00
bind('SUPER + SHIFT + G', exec 'station-launch-or-focus ^signal$ "uwsm-app -- signal-desktop"', 'Signal')
bind('SUPER + SHIFT + D', exec 'station-launch-or-focus ^chrome-discord.com__channels_@me-Default$ "uwsm-app -- discord"', 'Discord')
bind('SUPER + SHIFT + W', exec 'station-launch-or-focus ^chrome-web.whatsapp.com__-Default$ "uwsm-app -- whatsapp"', 'Whatsapp')
bind('SUPER + SHIFT + P', exec 'station-launch-or-focus ^superProductivity$ "uwsm-app -- super-productivity"', 'Super Productivity')
bind('SUPER + SHIFT + N', exec 'uwsm-app -- xdg-terminal-exec --app-id=org.station.notes nvim ~/Tower/Documents/Notes', 'Editor')
2026-06-07 22:38:07 +01:00
-- bind("SUPER SHIFT + W", exec("uwsm-app -- typora --enable-wayland-ime"), "Typora")
2026-07-21 22:04:54 +01:00
bind('SUPER + SHIFT + SLASH', exec 'Enpass showassistant', 'Passwords')
bind('SUPER + SHIFT + E', exec 'station-launch-or-focus mailspring', 'Email')
2026-06-06 19:08:02 +01:00
2026-07-21 22:04:54 +01:00
bind('SUPER + SHIFT + A', exec 'station-launch-webapp "https://gemini.google.com/app"', 'ChatGPT')
bind('SUPER + SHIFT + C', exec 'station-launch-webapp "https://tower.scarif.space/apps/calendar"', 'Calendar')
bind('SUPER + SHIFT + Y', exec 'station-launch-or-focus-webapp "YouTube" "https://youtube.com/"', 'YouTube')
bind('SUPER + SHIFT + ALT + G', exec 'station-launch-or-focus-webapp WhatsApp "https://web.whatsapp.com/"', 'WhatsApp')
bind('SUPER + SHIFT + CTRL + G', exec 'station-launch-or-focus-webapp "Google Maps" "https://maps.google.com"', 'Google Maps')
2026-06-07 22:38:07 +01:00
-- bind("SUPER SHIFT + P", exec("station-launch-or-focus-webapp "Google Photos" "https://photos.google.com/""), "Google Photos")
-- bind("SUPER SHIFT + X", exec("station-launch-webapp "https://x.com/""), "X")
-- bind("SUPER SHIFT ALT + X", exec("station-launch-webapp "https://x.com/compose/post""), "X Post")
2026-06-06 19:08:02 +01:00
-- Add extra bindings
2026-07-21 22:04:54 +01:00
bind('SUPER + SHIFT + R', exec 'ghostty -e ssh scarif', 'SSH to scarif')