1
0

keybindings.lua 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. local mainMod = "ALT"
  2. local secMod = "SUPER"
  3. local terminal = "alacritty"
  4. local fileManager = "dolphin"
  5. local menu = "caelestia shell drawers toggle launcher"
  6. -- Example binds, see https://wiki.hypr.land/Configuring/Basics/Binds/ for more
  7. hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(terminal))
  8. hl.bind(mainMod .. " + SHIFT + Q", hl.dsp.window.close())
  9. hl.bind(mainMod .. " + M", hl.dsp.exec_cmd("command -v hyprshutdown >/dev/null 2>&1 && hyprshutdown || hyprctl dispatch 'hl.dsp.exit()'"))
  10. hl.bind(mainMod .. " + D", hl.dsp.exec_cmd(menu))
  11. hl.bind(mainMod .. " + P", hl.dsp.window.pseudo())
  12. hl.bind(mainMod .. " + V", hl.dsp.layout("togglesplit")) -- dwindle only
  13. hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen({ action = "toggle" }))
  14. hl.bind(mainMod .. " + SHIFT + SPACE", hl.dsp.window.float({ action = "toggle" }))
  15. hl.bind(mainMod .. " + E", hl.dsp.exec_cmd("caelestia shell drawers toggle sidebar"))
  16. hl.bind(mainMod .. " + SHIFT + E", hl.dsp.exec_cmd("caelestia shell drawers toggle session"))
  17. hl.bind("CONTROL + ALT + DELETE", hl.dsp.exec_cmd("caelestia shell drawers toggle session"))
  18. hl.bind(secMod .. " + V", hl.dsp.exec_cmd("caelestia clipboard"))
  19. hl.bind(secMod .. " + E", hl.dsp.exec_cmd(fileManager))
  20. hl.bind(secMod .. " + Q", hl.dsp.exec_cmd("firefox"))
  21. hl.bind(secMod .. " + S", hl.dsp.exec_cmd("spotify"))
  22. hl.bind(secMod .. " + D", hl.dsp.exec_cmd("discord"))
  23. hl.bind(secMod .. " + L", hl.dsp.exec_cmd("caelestia shell lock lock"))
  24. hl.bind(secMod .. " + SHIFT + C", hl.dsp.exec_cmd("hyprpicker --autocopy"))
  25. hl.bind(secMod .. " + SHIFT + S", hl.dsp.exec_cmd([[
  26. #!/bin/bash
  27. OLD=$(wl-paste)
  28. caelestia shell picker openFreezeClip
  29. for i in {1..20}; do
  30. NEW=$(wl-paste)
  31. if [ "$NEW" != "$OLD" ]; then
  32. wl-paste --type image/png > ~/Pictures/Screenshots/$(date +%Y-%m-%d_%H-%M-%S).png
  33. exit 0
  34. fi
  35. sleep 0.1
  36. done
  37. exit 1
  38. ]]))
  39. -- Move focus with mainMod + arrow keys
  40. hl.bind(mainMod .. " + left", hl.dsp.focus({ direction = "left" }))
  41. hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "right" }))
  42. hl.bind(mainMod .. " + up", hl.dsp.focus({ direction = "up" }))
  43. hl.bind(mainMod .. " + down", hl.dsp.focus({ direction = "down" }))
  44. -- Move window
  45. hl.bind(mainMod .. " + SHIFT + left", hl.dsp.window.move({ direction = "left" }))
  46. hl.bind(mainMod .. " + SHIFT + right", hl.dsp.window.move({ direction = "right" }))
  47. hl.bind(mainMod .. " + SHIFT + up", hl.dsp.window.move({ direction = "up" }))
  48. hl.bind(mainMod .. " + SHIFT + down", hl.dsp.window.move({ direction = "down" }))
  49. -- Switch workspaces with mainMod + [0-9]
  50. -- Move active window to a workspace with mainMod + SHIFT + [0-9]
  51. for i = 1, 10 do
  52. local key = i % 10 -- 10 maps to key 0
  53. hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i}))
  54. hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i, follow = false }))
  55. end
  56. for i = 1, 10 do
  57. local key = "F" .. i
  58. hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i + 10 }))
  59. hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i + 10, follow = false }))
  60. end
  61. -- Example special workspace (scratchpad)
  62. hl.bind(mainMod .. " + BAR", hl.dsp.workspace.toggle_special("magic"))
  63. hl.bind(mainMod .. " + SHIFT + BAR", hl.dsp.window.move({ workspace = "special:magic" }))
  64. -- Scroll through existing workspaces with mainMod + scroll
  65. hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
  66. hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }))
  67. -- Move/resize windows with mainMod + LMB/RMB and dragging
  68. hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
  69. hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
  70. -- Laptop multimedia keys for volume and LCD brightness
  71. hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), { locked = true, repeating = true })
  72. hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), { locked = true, repeating = true })
  73. hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true, repeating = true })
  74. hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true, repeating = true })
  75. hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"), { locked = true, repeating = true })
  76. hl.bind("XF86MonBrightnessDown",hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"), { locked = true, repeating = true })
  77. -- Requires playerctl
  78. hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true })
  79. hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
  80. hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
  81. hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true })