| 1 | --------------------- |
| 2 | ---- KEYBINDINGS ---- |
| 3 | --------------------- |
| 4 | -- See https://wiki.hypr.land/Configuring/Basics/Binds/ for more |
| 5 | |
| 6 | hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(terminal)) |
| 7 | hl.bind(mainMod .. " + SHIFT + X", hl.dsp.window.close()) |
| 8 | hl.bind(mainMod .. " + SHIFT + Q", hl.dsp.exit()) |
| 9 | hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen({ mode = "fullscreen", action = "toggle" })) |
| 10 | hl.bind(mainMod .. " + SHIFT + F", hl.dsp.window.fullscreen({ mode = "maximized", action = "toggle" })) |
| 11 | |
| 12 | -- bind = $mainMod SHIFT, R, togglefloating, |
| 13 | -- Smart Float: Toggle float -> Resize to 90% -> Center |
| 14 | hl.bind( |
| 15 | mainMod .. "+ SHIFT + R", |
| 16 | hl.dsp.exec_cmd([[ |
| 17 | if hyprctl activewindow | grep -q 'floating: 0'; then |
| 18 | W=$(hyprctl monitors -j | jq '.[] | select(.focused) | ((.width / .scale) * 0.9) | floor') |
| 19 | H=$(hyprctl monitors -j | jq '.[] | select(.focused) | ((.height / .scale) * 0.9) | floor') |
| 20 | hyprctl --batch "dispatch hl.dsp.window.float({action='set'}); dispatch hl.dsp.window.resize({x=${W}, y=${H}, relative=false})" |
| 21 | hyprctl dispatch "hl.dsp.window.center()" |
| 22 | else |
| 23 | hyprctl dispatch "hl.dsp.window.float({action='unset'})" |
| 24 | fi |
| 25 | ]]), |
| 26 | { description = "Smart Float" } |
| 27 | ) |
| 28 | |
| 29 | |
| 30 | ------------------ |
| 31 | -- Aurora Shell |
| 32 | ----------------- |
| 33 | hl.bind(mainMod .. " + c", hl.dsp.exec_cmd("qs -c aurora ipc call shell toggle")) |
| 34 | hl.bind(mainMod .. " + b", hl.dsp.exec_cmd("systemctl --user restart aurora")) |
| 35 | |
| 36 | hl.bind(mainMod .. " + R", hl.dsp.exec_cmd(menu)) |
| 37 | -- bind = $mainMod SHIFT, P, pseudo, # dwindle |
| 38 | hl.bind(mainMod .. " + Tab", hl.dsp.window.cycle_next({ next = false }), { repeating = true }) |
| 39 | hl.bind(mainMod .. " + grave", hl.dsp.exec_cmd("fuzzelunicode")) |
| 40 | hl.bind(mainMod .. " + escape", hl.dsp.exec_cmd("sysact")) |
| 41 | |
| 42 | -- Applications |
| 43 | hl.bind(mainMod .. " + W", hl.dsp.exec_cmd(browser)) |
| 44 | hl.bind("PRINT", hl.dsp.exec_cmd("hypr_screenshot.sh")) |
| 45 | hl.bind(mainMod .. " + SHIFT + P", hl.dsp.exec_cmd("hypr_screenshot.sh")) |
| 46 | |
| 47 | -- Music Controls |
| 48 | hl.bind(mainMod .. " + m", hl.dsp.exec_cmd(terminal .. " -e zsh -i -c \"ncmpcpp\"")) |
| 49 | hl.bind(mainMod .. " + p", hl.dsp.exec_cmd("mpc toggle")) |
| 50 | hl.bind(mainMod .. " + period", hl.dsp.exec_cmd("mpc seek +10"), { repeating = true }) |
| 51 | hl.bind(mainMod .. " + comma", hl.dsp.exec_cmd("mpc seek -10"), { repeating = true }) |
| 52 | hl.bind(mainMod .. " + SHIFT + period", hl.dsp.exec_cmd("mpc next")) |
| 53 | hl.bind(mainMod .. " + SHIFT + comma", hl.dsp.exec_cmd("mpc prev")) |
| 54 | |
| 55 | -- Swap current focused window with master |
| 56 | hl.bind(mainMod .. " + space", hl.dsp.layout("swapwithmaster")) |
| 57 | |
| 58 | -- Resize windows with h/j/k/l |
| 59 | hl.bind(mainMod .. " + h", hl.dsp.window.resize({ x = -30, y = 0, relative = true}), { repeating = true }) |
| 60 | hl.bind(mainMod .. " + l", hl.dsp.window.resize({ x = 30, y = 0, relative = true}), { repeating = true }) |
| 61 | hl.bind(mainMod .. " + k", hl.dsp.window.resize({ x = 0, y = -30, relative = true }), { repeating = true }) |
| 62 | hl.bind(mainMod .. " + j", hl.dsp.window.resize({ x = 0, y = 30, relative = true }), { repeating = true }) |
| 63 | |
| 64 | -- Clipboard menu (cliphist) |
| 65 | hl.bind(mainMod .. " + v", hl.dsp.exec_cmd("sh -c \"cliphist list | fuzzel --dmenu --with-nth 2 | cliphist decode | wl-copy\"")) |
| 66 | |
| 67 | -- ----------------------------------------------------- |
| 68 | -- Workspace switching |
| 69 | -- ----------------------------------------------------- |
| 70 | |
| 71 | local mainMod = "SUPER" |
| 72 | for i = 1, smw.get_amount_of_workspaces() do |
| 73 | local n = tostring(i) |
| 74 | if n == "10" then n = "0" end -- Optional if you configured 10 workspaces: bind workspace 10 to SUPER + 0 |
| 75 | -- Switch to the Nth workspace on the currently focused monitor. |
| 76 | hl.bind(mainMod .. " +" .. n, smw.workspace(n)) |
| 77 | -- Move the active window to the Nth workspace on the currently focused monitor silently (no focus change). |
| 78 | hl.bind(mainMod .. " + SHIFT +" .. n, smw.move_to_workspace_silent(n)) |
| 79 | end |
| 80 | |
| 81 | -- Example special workspace (scratchpad) |
| 82 | hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("magic")) |
| 83 | hl.bind(mainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" })) |
| 84 | |
| 85 | -- Scratchpad like DWM |
| 86 | hl.workspace_rule({ workspace = "special:h", on_created_empty = terminal }) |
| 87 | hl.bind(mainMod .. " + SHIFT + Return", hl.dsp.workspace.toggle_special("h")) |
| 88 | |
| 89 | -- --- Accessibility: Zoom --- |
| 90 | hl.config({ cursor = { zoom_disable_aa = true } }) |
| 91 | |
| 92 | hl.bind( |
| 93 | "SUPER + equal", |
| 94 | function() |
| 95 | local z = hl.get_config("cursor.zoom_factor") |
| 96 | hl.config({ cursor = { zoom_factor = z * 1.25 } }) |
| 97 | end, |
| 98 | { description = "Zoom In", repeating = true } |
| 99 | ) |
| 100 | |
| 101 | hl.bind( |
| 102 | "SUPER + minus", |
| 103 | function() |
| 104 | local z = hl.get_config("cursor.zoom_factor") |
| 105 | local nz = z / 1.25 |
| 106 | if nz < 1.0 then nz = 1.0 end |
| 107 | hl.config({ cursor = { zoom_factor = nz } }) |
| 108 | end, |
| 109 | { description = "Zoom Out", repeating = true } |
| 110 | ) |
| 111 | |
| 112 | hl.bind( |
| 113 | "SUPER + BACKSPACE", |
| 114 | function() |
| 115 | hl.config({ cursor = { zoom_factor = 1.0 } }) |
| 116 | end, |
| 117 | { description = "Reset Zoom", locked = true } |
| 118 | ) |
| 119 | |
| 120 | -- Screen Rotate |
| 121 | hl.bind(mainMod .. " + CTRL + comma", hl.dsp.exec_cmd("hypr_screen_rotate.py +90"), |
| 122 | { locked = true, desc = "Rotate Screen Anti-Clockwise" }) |
| 123 | hl.bind(mainMod .. " + CTRL + period", hl.dsp.exec_cmd("hypr_screen_rotate.py -90"), |
| 124 | { locked = true, desc = "Rotate Screen Clockwise" }) |
| 125 | |
| 126 | -- --- Hyprshade (Visual Filters) --- |
| 127 | hl.bind(mainMod .. " + CTRL + S", hl.dsp.exec_cmd("hypr_shader_menu.sh"), { desc = "Shader Menu" }) |
| 128 | hl.bind(mainMod .. " + CTRL + X", hl.dsp.exec_cmd("hyprshade off"), { locked = true, desc = "Disable Shader" }) |
| 129 | hl.bind(mainMod .. " + CTRL + V", hl.dsp.exec_cmd("hyprshade on vibrance"), { locked = true, desc = "Vibrant Shader" }) |
| 130 | |
| 131 | -- Scroll through existing workspaces with mainMod + scroll |
| 132 | hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" })) |
| 133 | hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" })) |
| 134 | |
| 135 | -- Move/resize windows with mainMod + LMB/RMB and dragging |
| 136 | hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) |
| 137 | hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) |
| 138 | |
| 139 | -- Laptop multimedia keys for volume and LCD brightness |
| 140 | hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), { locked = true, repeating = true }) |
| 141 | hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), { locked = true, repeating = true }) |
| 142 | hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true, repeating = true }) |
| 143 | hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true, repeating = true }) |
| 144 | hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("~/.local/bin/brictl -"), { locked = true, repeating = true }) |
| 145 | hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("~/.local/bin/brictl +"), { locked = true, repeating = true }) |
| 146 | |
| 147 | -- Requires playerctl |
| 148 | hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true }) |
| 149 | hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) |
| 150 | hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) |
| 151 | hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true }) |
| 152 | |