From a20aa01ca5cca04aed68e2d7feb21135a635e8a3 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Wed, 8 Nov 2023 13:03:13 +0700 Subject: [PATCH] Emacs: qtile/emacs keybinding integration, but it's laggy... --- .config/emacs/init.org | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/.config/emacs/init.org b/.config/emacs/init.org index 4703048..190e31d 100644 --- a/.config/emacs/init.org +++ b/.config/emacs/init.org @@ -920,10 +920,37 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun (define-key ctl-x-4-map (kbd "-") #'joe/window-split-horizontal) (define-key ctl-x-4-map (kbd "t") #'rotate-window) -(global-set-key (kbd "s-h") #'windmove-left) -(global-set-key (kbd "s-l") #'windmove-right) -(global-set-key (kbd "s-k") #'windmove-up) -(global-set-key (kbd "s-j") #'windmove-down) +(defun joe/qtile-move-dir (dir) + (start-process "qtile-dir" nil "qtile" "cmd-obj" "-o" "layout" "-f" dir)) + +(defun joe/windmove-left () + (interactive) + (if (window-in-direction 'left) + (windmove-left) + (joe/qtile-move-dir "left"))) + +(defun joe/windmove-right () + (interactive) + (if (window-in-direction 'right) + (windmove-right) + (joe/qtile-move-dir "right"))) + +(defun joe/windmove-up () + (interactive) + (if (window-in-direction 'up) + (windmove-up) + (joe/qtile-move-dir "up"))) + +(defun joe/windmove-down () + (interactive) + (if (window-in-direction 'down) + (windmove-down) + (joe/qtile-move-dir "down"))) + +(global-set-key (kbd "s-h") #'joe/windmove-left) +(global-set-key (kbd "s-l") #'joe/windmove-right) +(global-set-key (kbd "s-k") #'joe/windmove-up) +(global-set-key (kbd "s-j") #'joe/windmove-down) ;; There's a bug in Gnome where frames are resized to the wrong dimensions (defun joe/resize-frames ()