keys.lisp 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. (in-package :stumpwm)
  2. (defcommand s-I () ()
  3. "Open YouTube if free-time? is nil or mjru-servers."
  4. (if (free-time?)
  5. (youtube)
  6. (mjru-servers)))
  7. (defcommand kbd-C-s-a () ()
  8. "Workaround for SVEN KB-C3800W."
  9. (xmodmap)
  10. (mjru-pass-route))
  11. (defun bind-super ()
  12. (define-key *top-map* (kbd "C-s-e") "editor")
  13. (define-key *top-map* (kbd "C-s-w") "chromium")
  14. (define-key *top-map* (kbd "C-s-W") "chromium-new-window")
  15. (define-key *top-map* (kbd "C-S-s-RET") "rofi-mycli")
  16. (define-key *top-map* (kbd "C-s-s") "only")
  17. (define-key *top-map* (kbd "s-+") "pavucontrol")
  18. (define-key *top-map* (kbd "s-_") "volume-toggle")
  19. (define-key *top-map* (kbd "s-r") "keybinding-s-r")
  20. (define-key *top-map* (kbd "M-s-r") "repl-ghci")
  21. (define-key *top-map* (kbd "s-R") "repl-guix")
  22. (define-key *top-map* (kbd "C-s-r") "repl-python")
  23. (define-key *top-map* (kbd "C-M-s-RET") "repl-r")
  24. (define-key *top-map* (kbd "C-s-R") "repl-nix")
  25. (define-key *top-map* (kbd "C-M-s-R") "repl-node")
  26. (define-key *top-map* (kbd "s-f") "fullscreen")
  27. (define-key *top-map* (kbd "s-D") "mjru-docker-pull")
  28. (define-key *top-map* (kbd "s-H") "glances")
  29. (define-key *top-map* (kbd "s-l") "looking-glass-client")
  30. (define-key *top-map* (kbd "s-t") "top")
  31. (define-key *top-map* (kbd "s-T") "tometips")
  32. (define-key *top-map* (kbd "s-h") "monitoring")
  33. (define-key *top-map* (kbd "C-s-C") "rofi-drun")
  34. (define-key *top-map* (kbd "S-s-RET") "rofi-ssh")
  35. (define-key *top-map* (kbd "s-\"") "global-windowlist")
  36. (define-key *top-map* (kbd "s-quoteright") "global-windowlist-custom")
  37. (define-key *top-map* (kbd "XF86AudioMute") "volume-toggle")
  38. (define-key *top-map* (kbd "XF86AudioLowerVolume") "volume-decrease")
  39. (define-key *top-map* (kbd "XF86AudioRaiseVolume") "volume-increase")
  40. (define-key *top-map* (kbd "s--") "keybinding-s--")
  41. (define-key *top-map* (kbd "s-=") "keybinding-s-=")
  42. (define-key *top-map* (kbd "s-KP_Add") "volume-increase")
  43. (define-key *top-map* (kbd "s-KP_Subtract") "volume-decrease")
  44. (define-key *top-map* (kbd "s-RET") "run-terminal")
  45. (define-key *top-map* (kbd "s-e") "emacsclient")
  46. (define-key *top-map* (kbd "s-E") "emacsclient-new")
  47. (define-key *top-map* (kbd "s-m") "mode-line")
  48. (define-key *top-map* (kbd "s-M") "music-mpv")
  49. (define-key *top-map* (kbd "s-N") "next-in-frame-custom")
  50. (define-key *top-map* (kbd "s-P") "prev-in-frame-custom")
  51. (define-key *top-map* (kbd "s-w") "firefox")
  52. (define-key *top-map* (kbd "s-W") "firefox-new-window")
  53. (define-key *top-map* (kbd "M-s-w") "firefox-temp-profile-new-window")
  54. (define-key *top-map* (kbd "s-q") "delete-window!")
  55. (define-key *top-map* (kbd "s-Q") "remove")
  56. (define-key *top-map* (kbd "s-quoteleft") "emacs-vterm")
  57. (define-key *top-map* (kbd "s-~") "display-0-keys")
  58. (define-key *top-map* (kbd "s-o") "keybinding-s-o")
  59. (define-key *top-map* (kbd "s-j") "run-or-raise-xterm")
  60. (define-key *top-map* (kbd "M-s-j") "run-xterm-light")
  61. (define-key *top-map* (kbd "s-J") "jenkins")
  62. (define-key *top-map* (kbd "s-g") "gnus")
  63. (define-key *top-map* (kbd "s-G") "notmuch")
  64. (define-key *top-map* (kbd "s-C") "org")
  65. (define-key *top-map* (kbd "C-s-c") "org-agenda")
  66. (define-key *top-map* (kbd "s-x") "keybinding-s-x")
  67. (define-key *top-map* (kbd "s-X") "wi-project-ivy")
  68. (define-key *top-map* (kbd "s-i") "shop-food")
  69. (mapcar #'(lambda (pair)
  70. (let ((command (concat "gmove-and-follow " (write-to-string (car pair))))
  71. (key (concat "s-" (string (cdr pair)))))
  72. (define-key *top-map* (kbd key) command)))
  73. '((1 . #\!) (2 . #\@) (3 . #\#)
  74. (4 . #\$) (5 . #\%) (6 . #\^)
  75. (7 . #\&) (8 . #\*) (9 . #\()
  76. (0 . #\))))
  77. (define-key *top-map* (kbd "s-KP_Enter") "run-or-raise-xterm")
  78. (define-key *top-map* (kbd "s-k") "delete-window-or-remove-split")
  79. (define-key *top-map* (kbd "s-K") "delete-window!")
  80. (define-key *top-map* (kbd "s-ESC") "keybinding-s-k")
  81. (define-key *top-map* (kbd "s-Right") "move-focus right")
  82. (define-key *top-map* (kbd "s-Left") "move-focus left")
  83. (define-key *top-map* (kbd "s-Up") "move-focus up")
  84. (define-key *top-map* (kbd "s-Down") "move-focus down")
  85. (define-key *top-map* (kbd "s-Tab") "other-in-frame-or-fother")
  86. (define-key *top-map* (kbd "C-s-Tab") "fother")
  87. (define-key *top-map* (kbd "s-ISO_Left_Tab") "fother")
  88. (define-key *top-map* (kbd "s-ISO_Next_Group") "espanso-daemon")
  89. (define-key *top-map* (kbd "S-s-Right") "move-window right")
  90. (define-key *top-map* (kbd "S-s-Left") "move-window left")
  91. (define-key *top-map* (kbd "S-s-Up") "move-window up")
  92. (define-key *top-map* (kbd "S-s-Down") "move-window down")
  93. (define-key *top-map* (kbd "s-v") "virt-manager")
  94. (define-key *top-map* (kbd "s-V") "pulsemixer")
  95. (define-key *top-map* (kbd "s-c") "run-or-raise-terminal")
  96. (define-key *top-map* (kbd "s-F") "move-focus right")
  97. (define-key *top-map* (kbd "s-B") "move-focus left")
  98. (define-key *top-map* (kbd "s-p") "prev-in-frame")
  99. (define-key *top-map* (kbd "s-n") "next-in-frame")
  100. (define-key *top-map* (kbd "C-s-p") "gprev")
  101. (define-key *top-map* (kbd "C-s-n") "gnext")
  102. (define-key *top-map* (kbd "s-S") "passmenu")
  103. (define-key *top-map* (kbd "s-s") "hsplit")
  104. (define-key *top-map* (kbd "s-d") "bemenu-run")
  105. (define-key *top-map* (kbd "s-;") "colon")
  106. (define-key *top-map* (kbd "s-[") "place-existing-windows")
  107. (define-key *top-map* (kbd "C-s-h") "sampler")
  108. (define-key *top-map* (kbd "C-M-S-s-RET") "xterm-dark-no-scrollbar")
  109. (define-key *top-map* (kbd "s-SunPrint_Screen") "zoom")
  110. (define-key *top-map* (kbd "s-b") "qbittorrent")
  111. (define-key *top-map* (kbd "C-s-Right") "window-resize-by-half-horizontal")
  112. (define-key *top-map* (kbd "C-s-Left") "window-resize-by-half-vertical")
  113. (define-key *top-map* (kbd "C-M-s-S") "suspend")
  114. (define-key *top-map* (kbd "C-s-=") "volume-increase")
  115. (define-key *top-map* (kbd "C-s--") "volume-decrease")
  116. (define-key *top-map* (kbd "C-s-RET") "st")
  117. (define-key *top-map* (kbd "M-s-RET") "xfce-terminal")
  118. (define-key *top-map* (kbd "M-s-n") "mpv-next")
  119. (define-key *top-map* (kbd "M-s-p") "mpv-previous")
  120. (define-key *top-map* (kbd "M-s-e") "emacs-guix-edit")
  121. (define-key *top-map* (kbd "C-s-Up") "next-in-frame")
  122. (define-key *top-map* (kbd "C-s-Down") "prev-in-frame")
  123. (define-key *top-map* (kbd "M-s-d") "repology-guix-outdated")
  124. (define-key *top-map* (kbd "M-s-g") "ci-guix")
  125. (define-key *top-map* (kbd "SunPrint_Screen") "xfce-screenshooter")
  126. ;; Majordomo
  127. (define-key *top-map* (kbd "s-a") "mjru-pass-gitlab-ssh")
  128. (define-key *top-map* (kbd "s-A") "mjru-pass-eng")
  129. (define-key *top-map* (kbd "C-s-a") "kbd-C-s-a")
  130. (define-key *top-map* (kbd "s-u") "place-existing-windows")
  131. (define-key *top-map* (kbd "s-U") "mjru-cerb")
  132. (define-key *top-map* (kbd "M-s-u") "mjru-grafana-upstream-interfaces")
  133. (define-key *top-map* (kbd "C-s-u") "mjru-grafana-netflow")
  134. (define-key *top-map* (kbd "s-y") "greenclip")
  135. (define-key *top-map* (kbd "s-I") "s-I")
  136. ;; Rebind groups to PREFIX-NUMBER.
  137. (mapcar #'(lambda (x)
  138. ;; (define-key *top-map* (kbd (concat "s-" (write-to-string x)))
  139. ;; (format nil "gselect ~D" x))
  140. (define-key *top-map* (kbd (concat "M-s-" (write-to-string x)))
  141. (format nil "group-~D-start-programs" x))
  142. (define-key *top-map* (kbd (concat "C-s-" (write-to-string x)))
  143. (format nil "~A ~D" "select-window-by-number" x)))
  144. (range 10 :min 0 :step 1))
  145. (define-key *top-map* (kbd (concat "s-1")) "group-1-start-programs")
  146. (define-key *top-map* (kbd (concat "s-2")) "group-2-start-programs")
  147. (define-key *top-map* (kbd (concat "s-3")) "group-3-start-programs")
  148. (define-key *top-map* (kbd (concat "s-4")) "group-4-start-programs")
  149. (define-key *top-map* (kbd (concat "s-5")) "group-5-start-programs")
  150. (define-key *top-map* (kbd (concat "s-6")) "group-6-start-programs")
  151. (define-key *top-map* (kbd (concat "s-7")) "group-7-start-programs")
  152. (define-key *top-map* (kbd (concat "s-8")) "group-8-start-programs")
  153. (define-key *top-map* (kbd (concat "s-9")) "group-9-start-programs")
  154. (define-key *top-map* (kbd (concat "s-0")) "gselect 0")
  155. (define-key *top-map* (kbd (concat "M-s-1")) "group-1-restart-programs")
  156. (define-key *top-map* (kbd (concat "s-Menu")) "xmenu"))
  157. (define-key *root-map* (kbd "C-i") "set-prefix-key C-i")
  158. (define-key *root-map* (kbd "C-t") "set-prefix-key C-t")
  159. (define-key *root-map* (kbd "C-M-c") "run-or-raise-xterm")
  160. (define-key *root-map* (kbd "C-c") "run-or-raise-xterm")
  161. (define-key *root-map* (kbd "C-y") "greenclip")
  162. (define-key *root-map* (kbd "Y") "xclip-kdeconnect-handler")
  163. (define-key *root-map* (kbd "c") "run-or-raise-xterm")
  164. (define-key *root-map* (kbd "e") "emacsclient")
  165. (define-key *root-map* (kbd "quoteleft") "display-0-keys")
  166. (define-key *root-map* (kbd "y") "greenclip")
  167. (define-key *root-map* (kbd "j") "turn-screen-off")
  168. (define-key *root-map* (kbd "J") "suspend")
  169. (defcommand sxhkd-restart () ()
  170. (run-shell-command "sxhkd"))
  171. (define-remapped-keys
  172. '(("(Nightly|Chrome)"
  173. ("C-n" . "Down")
  174. ("C-p" . "Up")
  175. ("M-r" . "Up")
  176. ;; ("C-f" . "Right")
  177. ;; ("C-b" . "Left")
  178. ;; ("C-v" . "Next")
  179. ;; ("M-v" . "Prior")
  180. ;; ("M-w" . "C-c")
  181. ;; ("C-w" . "C-x")
  182. ;; ("C-y" . "C-v")
  183. ;; ("M-<" . "Home")
  184. ;; ("M->" . "End")
  185. ;; ("C-M-b" . "M-Left")
  186. ;; ("C-M-f" . "M-Right")
  187. ;; ("C-k" . ("C-S-End" "C-x"))
  188. )))
  189. (defcommand toggle-bind-delete-window-or-remove-split () ()
  190. (if (lookup-key-sequence *top-map* (list (kbd "s-k")))
  191. (define-key *top-map* (kbd "s-k") nil)
  192. (define-key *top-map* (kbd "s-k") "delete-window-or-remove-split")))
  193. (defcommand toggle-bind-gnext () ()
  194. (if (lookup-key-sequence *top-map* (list (kbd "C-s-n")))
  195. (define-key *top-map* (kbd "C-s-n") nil)
  196. (define-key *top-map* (kbd "C-s-n") "gnext")))
  197. (defcommand toggle-bind-gprev () ()
  198. (if (lookup-key-sequence *top-map* (list (kbd "C-s-p")))
  199. (define-key *top-map* (kbd "C-s-p") nil)
  200. (define-key *top-map* (kbd "C-s-p") "gprev")))