stumpwm/key-mapping.lisp @ 46fd11ae3808

Merge
author Steve Losh <steve@stevelosh.com>
date Thu, 13 Jun 2024 12:30:10 -0400
parents cf74bfa5845a
children eb9f31c299b8
(in-package :stumpwm-user)

;;; Conventions:
;;;
;;; * Hyper-dir: move focus
;;; * Hyper-Shift-dir: move window
;;; * Hyper-Shift-Control-dir: swap window
;;; * Hyper-F*: hardware
;;; * Shift-F*: timers
;;; * Hyper-Super-*: layout
;;; * Hyper-*: miscellaneous
;;; * Super-GAMERMOUSE: duplicate stuff to avoid swapping back


(defmacro define-top-keys (&body keyforms)
  `(progn ,@(loop :for form :in keyforms
                  :collect `(define-key *top-map*
                              (kbd ,(first form))
                              ,(second form)))))


(define-top-keys ;; miscellaneous
  ("H-m" "terminal")
  ("H-M" "mark")
  ("H-SunPageUp" "st-font-up")
  ("H-SunPageDown" "st-font-down")
  ("H-z" "fullscreen")
  ("H-F4" "switch-yubikeys")
  ("H-\\" "pass-personal")
  ("H-|" "generate-password")
  ("s-1" "pass-um-1")
  ("s-2" "pass-um-2")
  ("H-b" "browser")
  ("H-O" "spotify")
  ("H-o" "files")
  ("H-P" "papers")
  ("F26"   "prev")
  ("S-F26" "next")
  ("H-q" "exec lock-screen")
  ("H-y" "screenshot")
  ("H-f" "save-fucked-screenshot")
  ("H-F" "delete-fucked-screenshot")
  ("H-r" "rain")
  ("H-V" "vlc")
  ("H-e" "budget")
  ("H-E" "spend")
  ("S-XF86AudioMute" "terminal-font-size-show")
  ("S-XF86AudioRaiseVolume" "terminal-font-size-down") ; todo unfuck the backwards mapping in qmk
  ("S-XF86AudioLowerVolume" "terminal-font-size-up")
  ("C-BackSpace" "clear-notifications"))

(define-top-keys ;; clipboard
  ("H-c" "show-clipboard-history")
  ("H-C" "clear-clipboard-history")
  ("H-u" "generate-random-uuid")
  ("H-B" "bee-movie-script"))

(define-top-keys ;; movement
  ("H-h" "move-focus* left")
  ("H-j" "move-focus down")
  ("H-k" "move-focus up")
  ("H-l" "move-focus* right")

  ("H-H" "move-window left")
  ("H-J" "move-window down")
  ("H-K" "move-window up")
  ("H-L" "move-window right")

  ("H-1" "gselect 1")
  ("H-2" "gselect 2")
  ("H-3" "gselect 3")
  ("H-4" "gselect 4")
  ("H-5" "gselect 5")
  ("H-6" "gselect 6")

  ("KP_End"       "gselect 1")
  ("KP_Down"      "gselect 2")
  ("KP_Page_Down" "gselect 3")
  ("KP_Left"      "gselect 4")
  ("KP_Begin"     "gselect 5")
  ("KP_Right"     "gselect 6")
  ("KP_Home"      "gselect 7")
  ("KP_Up"        "gselect 8")
  ("KP_Page_Up"   "gselect 9")

  ("H-!" "gmove 1")
  ("H-@" "gmove 2")
  ("H-#" "gmove 3")
  ("H-$" "gmove 4")
  ("H-%" "gmove 5")
  ("H-^" "gmove 6")

  ("C-H-H" "exchange-direction left")
  ("C-H-J" "exchange-direction down")
  ("C-H-K" "exchange-direction up")
  ("C-H-L" "exchange-direction right")

  ("H-`" "next")
  ("S-H-`" "prev")
  ("H-n" "next-in-frame")
  ("H-p" "prev-in-frame")
  ("H-N" "pull-hidden-next")
  ("H-," "pull-from-windowlist"))


(define-top-keys ;; splitting
  ("H-s" "sane-vsplit")
  ("H-v" "sane-hsplit")
  ("H-=" "balance-frames"))

(define-top-keys ;; killing
  ("H-w" "delete")
  ("H-W" "kill")
  ("H-BackSpace" "remove")
  ("S-H-BackSpace" "kill-and-remove")
  ("H-Delete" "gkill"))

(define-top-keys ;; naming
  ("H-'" "title"))

(define-top-keys ;; sound
  ("H-F1" "mute")
  ("H-F2" "volume-down")
  ("H-F3" "volume-up")
  ("XF86AudioMute" "exec mute")
  ("XF86AudioRaiseVolume" "volume-down") ; todo unfuck the backwards mapping in qmk
  ("XF86AudioLowerVolume" "volume-up"))

(define-top-keys ;; screen
  ("H-F5" "rotate-brightness-down")
  ("H-F6" "rotate-brightness-up")
  ("H-F7" "screen-laptop")
  ("H-F8" "screen-external"))

(define-top-keys ;; layout
  ("s-H-o" "only")
  ("s-H-t" "restore-from-file thirds")
  ("s-H-m" "restore-from-file dev")
  ("s-H-s" "restore-from-file streaming")
  ("s-H-w" "restore-from-file work")
  ("s-H-z" "restore-from-file zoom"))

(define-top-keys ;; timers
  ("s-F7"  "tea-timer")
  ("s-F9"  "run-pop-timer")
  ("s-F8"  "set-pop-timer")
  ("s-p"   "posture-start")
  ("s-P"   "posture-stop")
  ("s-y"   "posture-answer-yes")
  ("s-h"   "posture-answer-meh")
  ("s-n"   "posture-answer-no")
  ("s-\\"  "posture-toggle-pause")
  ("s-o"   "posture-snooze"))

(define-top-keys ;; stump
  ("Pause" "terminal") ; jesus christ
  ("H-F9"  "sleep-machine")
  ("H-F10" "toggle-stumptray")
  ("H-F11" "toggle-current-mode-line")
  ("H-F12" "refresh-heads"))

(defvar *keymap/igv* (make-sparse-keymap))

(define-key *keymap/igv* (kbd "s") "igv/toggle-supplementary-alignments")

(define-top-keys ;; alternate maps
  ("H-i" *keymap/igv*))


;;; The G A M E R M O U S E:
;;;
;;; +----------+----------+----------+                 _____
;;; |          |    ^     |          |                /     \            +--------+
;;; |          |    |     |          |               |       |           |        |
;;; |          |   move   |          |        group  |       |  group    |        |
;;; +----------+----------+----------+        <----- |       | ----->    |        |
;;; |          |          |          |               |       |           |        |
;;; |  move    |          |   move   |               |       |           |        |
;;; |   <--    |          |   -->    |                \_____/            |  kill  |
;;; +----------+----------+----------+                                   |        |
;;; |          |   move   |          |                                   |        |
;;; |          |    |     |          |              +---------+          |        |
;;; |          |    v     |          |              |         |          |        |
;;; +----------+----------+----------+              |  next   |          |        |
;;; |  split   |  FULL    |  split   |              |         |          +--------+
;;; |   [-]    |  SCREEN  |   [|]    |              +---------+
;;; |          |          |          |              |         |
;;; +----------+----------+----------+              |  prev   |
;;;                                                 |         |
;;;                                                 +---------+
(define-top-keys ;; GAMER MOUSE
  ("s-$" "move-window left")
  ("s-*" "move-window down")
  ("s-@" "move-window up")
  ("s-^" "move-window right")
  ("M-s-Left"  "gprev")
  ("M-s-Right" "gnext")
  ("s-Home" "next-in-frame")
  ("s-End"  "prev-in-frame")
  ("s-+" "sane-hsplit")
  ("s-)" "sane-vsplit")
  ("s-_" "fullscreen") 
  ("s-Delete" "remove")
  )


;; (stumpwm::unbind-remapped-keys)
(define-remapped-keys
  '(("st-256color"
     ("s-c" . "C-C")
     ("s-v" . "C-V")
     ("C-=" . "S-C-SunPageUp")
     ("C--" . "S-C-SunPageDown")
     ("C-0" . "S-C-Home"))
    ("(firefox|Google-chrome|Chromium-browser)"
     ("s-[" . "C-S-Tab")
     ("s-]" . "C-Tab")
     ("C-a" . "Home")
     ("C-e" . "End")
     ;; I always try to hit ctrl-d to kill a browser window because I'm so used
     ;; to terminal windows, and it ends up bookmarking the damn page.  In the
     ;; interest of not having a random collection of bookmarks grow over time,
     ;; I'll just add a mapping to compensate for my stupid brain.
     ("C-d" . "C-w")
     ;; todo debug why this breaks a really fast C-a-k roll
     ;; ("C-a" . "Home")
     ;; ("C-e" . "End")
     ("s-a" . "C-a")
     ("s-d" . "C-d")
     ("s-l" . "C-l")
     ("s-t" . "C-t")
     ("s-w" . "C-w")
     ("s-r" . "C-r")
     ("s-f" . "C-f")
     ("s-z" . "C-z")
     ("s-x" . "C-x")
     ("s-c" . "C-c")
     ("s-v" . "C-v"))
    (""
     ("s-z" . "C-z")
     ("s-x" . "C-x")
     ("s-c" . "C-c")
     ("s-v" . "C-v"))))