Emacs window navigation stumpsom integration

This commit is contained in:
Ian Keane 2026-09-05 20:54:09 -04:00
parent 20bcc0d97f
commit a64efec920
2 changed files with 56 additions and 4 deletions

View file

@ -462,10 +462,23 @@ If PERSISTENT is t, smart-kill will hide the window instead of killing it."
;;; Top-level bindings
(define-key *top-map* (kbd "s-d") "rofi-run")
(define-key *top-map* (kbd "s-w") "rofi-pull-window")
(define-key *top-map* (kbd "s-h") "move-focus left")
(define-key *top-map* (kbd "s-j") "move-focus down")
(define-key *top-map* (kbd "s-k") "move-focus up")
(define-key *top-map* (kbd "s-l") "move-focus right")
(defun emacs-window-p (win)
(and win (string= (window-class win) "Emacs")))
(defcommand smart-move-focus (direction) ((:direction "Direction: "))
"If the focused window is Emacs and it has a window in DIRECTION, move
focus there via windmove. Otherwise move focus to the next StumpWM frame."
(if (and (emacs-window-p (current-window))
(search "t" (run-shell-command
(format nil "emacsclient -e '(if (ignore-errors (windmove-~(~a~) nil) t) t nil)'" direction)
t)))
nil
(move-focus direction)))
(define-key *top-map* (kbd "s-h") "smart-move-focus left")
(define-key *top-map* (kbd "s-j") "smart-move-focus down")
(define-key *top-map* (kbd "s-k") "smart-move-focus up")
(define-key *top-map* (kbd "s-l") "smart-move-focus right")
(define-key *top-map* (kbd "s-p") "next-in-frame")
(define-key *top-map* (kbd "s-n") "prev-in-frame")
(define-key *top-map* (kbd "s-q") "smart-kill")