diff --git a/config/keybinds.lua b/config/keybinds.lua index 1eaa172..bf50c6a 100644 --- a/config/keybinds.lua +++ b/config/keybinds.lua @@ -37,40 +37,71 @@ hl.bind( hl.dsp.exec_cmd("noctalia msg panel-toggle launcher"), { description = "Toggle Noctalia launcher" } ) -hl.bind(chord(main, "W"), hl.dsp.window.close()) -hl.bind(chord(main, "Q"), hl.dsp.exec_cmd(commands.uwsm(settings.programs.terminal))) -hl.bind(chord(main, "E"), hl.dsp.exec_cmd(commands.uwsm(settings.programs.file_manager))) -hl.bind(chord(main, "V"), hl.dsp.window.float({ action = "toggle" })) -hl.bind(chord(main, "R"), hl.dsp.exec_cmd(settings.programs.launcher)) -hl.bind(chord(main, "P"), hl.dsp.window.pseudo()) -hl.bind(chord(main, "J"), hl.dsp.layout("togglesplit")) +hl.bind( + chord(main, "W"), + hl.dsp.window.close(), + { description = "Close focused window" } +) +hl.bind( + chord(main, "Q"), + hl.dsp.exec_cmd(commands.uwsm(settings.programs.terminal)), + { description = "Open terminal" } +) +hl.bind( + chord(main, "E"), + hl.dsp.exec_cmd(commands.uwsm(settings.programs.file_manager)), + { description = "Open file manager" } +) +hl.bind( + chord(main, "V"), + hl.dsp.window.float({ action = "toggle" }), + { description = "Toggle focused window floating" } +) +hl.bind( + chord(main, "R"), + hl.dsp.exec_cmd(settings.programs.launcher), + { description = "Open application launcher" } +) +hl.bind( + chord(main, "P"), + hl.dsp.window.pseudo(), + { description = "Toggle pseudo-tiling for focused window" } +) +hl.bind( + chord(main, "J"), + hl.dsp.layout("togglesplit"), + { description = "Toggle dwindle split direction" } +) -- One direction table drives arrow-key focus, Hyper+WASD focus/movement, and -- moving the active workspace between adjacent monitors. local directions = { - { arrow = "left", key = "A", direction = "l" }, - { arrow = "right", key = "D", direction = "r" }, - { arrow = "up", key = "W", direction = "u" }, - { arrow = "down", key = "S", direction = "d" }, + { arrow = "left", key = "A", direction = "l", monitor = "left" }, + { arrow = "right", key = "D", direction = "r", monitor = "right" }, + { arrow = "up", key = "W", direction = "u", monitor = "above" }, + { arrow = "down", key = "S", direction = "d", monitor = "below" }, } for _, direction in ipairs(directions) do hl.bind( chord(main, direction.arrow), - hl.dsp.focus({ direction = direction.arrow }) + hl.dsp.focus({ direction = direction.arrow }), + { description = "Focus window " .. direction.arrow } ) hl.bind( chord(hyper, direction.key), - hl.dsp.focus({ direction = direction.direction }) + hl.dsp.focus({ direction = direction.direction }), + { description = "Focus window " .. direction.arrow } ) hl.bind( chord(hyper, "CTRL", direction.key), - hl.dsp.window.move({ direction = direction.direction }) + hl.dsp.window.move({ direction = direction.direction }), + { description = "Move focused window " .. direction.arrow } ) hl.bind( chord(hyper, main, direction.key), hl.dsp.workspace.move({ monitor = direction.direction }), - { description = "Move workspace " .. direction.direction } + { description = "Move workspace to monitor " .. direction.monitor } ) end @@ -78,28 +109,94 @@ bind_numbered_workspaces(main, "SHIFT", 10) bind_numbered_workspaces(hyper, "CTRL", 9) -- Cycle workspaces with the wheel and manipulate windows with mouse buttons. -hl.bind(chord(main, "mouse_down"), hl.dsp.focus({ workspace = "e+1" })) -hl.bind(chord(main, "mouse_up"), hl.dsp.focus({ workspace = "e-1" })) -hl.bind(chord(main, "mouse:272"), hl.dsp.window.drag(), { mouse = true }) -hl.bind(chord(main, "mouse:273"), hl.dsp.window.resize(), { mouse = true }) +hl.bind( + chord(main, "mouse_down"), + hl.dsp.focus({ workspace = "e+1" }), + { description = "Switch to next workspace" } +) +hl.bind( + chord(main, "mouse_up"), + hl.dsp.focus({ workspace = "e-1" }), + { description = "Switch to previous workspace" } +) +hl.bind( + chord(main, "mouse:272"), + hl.dsp.window.drag(), + { mouse = true, description = "Drag focused window" } +) +hl.bind( + chord(main, "mouse:273"), + hl.dsp.window.resize(), + { mouse = true, description = "Resize focused window" } +) -- Locked media keys also work while the session is locked. Volume and -- brightness binds repeat while held; playback controls fire once. local media_binds = { - { "XF86AudioRaiseVolume", "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+", { locked = true, repeating = true } }, - { "XF86AudioLowerVolume", "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-", { locked = true, repeating = true } }, - { "XF86AudioMute", "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle", { locked = true, repeating = true } }, - { "XF86AudioMicMute", "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle", { locked = true, repeating = true } }, - { "XF86MonBrightnessUp", "brightnessctl -e4 -n2 set 5%+", { locked = true, repeating = true } }, - { "XF86MonBrightnessDown", "brightnessctl -e4 -n2 set 5%-", { locked = true, repeating = true } }, - { "XF86AudioNext", "playerctl next", { locked = true } }, - { "XF86AudioPause", "playerctl play-pause", { locked = true } }, - { "XF86AudioPlay", "playerctl play-pause", { locked = true } }, - { "XF86AudioPrev", "playerctl previous", { locked = true } }, + { + key = "XF86AudioRaiseVolume", + command = "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+", + description = "Increase output volume", + repeating = true, + }, + { + key = "XF86AudioLowerVolume", + command = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-", + description = "Decrease output volume", + repeating = true, + }, + { + key = "XF86AudioMute", + command = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle", + description = "Toggle output mute", + repeating = true, + }, + { + key = "XF86AudioMicMute", + command = "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle", + description = "Toggle microphone mute", + repeating = true, + }, + { + key = "XF86MonBrightnessUp", + command = "brightnessctl -e4 -n2 set 5%+", + description = "Increase display brightness", + repeating = true, + }, + { + key = "XF86MonBrightnessDown", + command = "brightnessctl -e4 -n2 set 5%-", + description = "Decrease display brightness", + repeating = true, + }, + { + key = "XF86AudioNext", + command = "playerctl next", + description = "Play next media track", + }, + { + key = "XF86AudioPause", + command = "playerctl play-pause", + description = "Toggle media playback", + }, + { + key = "XF86AudioPlay", + command = "playerctl play-pause", + description = "Toggle media playback", + }, + { + key = "XF86AudioPrev", + command = "playerctl previous", + description = "Play previous media track", + }, } for _, bind in ipairs(media_binds) do - hl.bind(bind[1], hl.dsp.exec_cmd(bind[2]), bind[3]) + hl.bind(bind.key, hl.dsp.exec_cmd(bind.command), { + locked = true, + repeating = bind.repeating, + description = bind.description, + }) end -- Generate focus/move shortcuts for every named workspace in settings.lua. @@ -128,7 +225,8 @@ hl.bind( chord(hyper, "SPACE"), function() hl.plugin.hyprtasking.toggle("all") - end + end, + { description = "Toggle all-workspace window overview" } ) -- Toggle a focused client into an 80%-sized centered floating mode. Returning