Make split-window-below-i3 behave nicer in a terminal or missing i3

This commit is contained in:
Adam Goldsmith 2021-01-04 13:13:32 -05:00
parent 6b97d19487
commit ab3907d9fa

View File

@ -532,23 +532,26 @@
(defun x-focus-frame (FRAME &optional NOACTIVATE)) (defun x-focus-frame (FRAME &optional NOACTIVATE))
(frames-only-mode t) (frames-only-mode t)
(menu-bar-mode 0) (menu-bar-mode 0)
(if (executable-find "i3")
(progn (defun split-window-below-i3 ()
(defun split-window-below-i3 () "It's like `split-window-below', but uses i3 stuff when available"
"It's like `split-window-below', but uses i3 stuff" (interactive)
(interactive) (cond ((not (display-graphic-p)) (split-window-below))
(call-process "i3" nil nil nil "split v") ((executable-find "i3")
(make-frame)) (call-process "i3" nil nil nil "split v")
(defun split-window-right-i3 () (make-frame))
"It's like `split-window-right', but uses i3 stuff" (t (make-frame))))
(interactive)
(call-process "i3" nil nil nil "split h") (defun split-window-right-i3 ()
(make-frame)) "It's like `split-window-right', but uses i3 stuff when available"
(bind-key "C-x 2" 'split-window-below-i3) (interactive)
(bind-key "C-x 3" 'split-window-right-i3)) (cond ((not (display-graphic-p)) (split-window-right))
(progn ((executable-find "i3")
(bind-key "C-x 2" 'make-frame-command) (call-process "i3" nil nil nil "split h")
(bind-key "C-x 3" 'make-frame-command)))) (make-frame))
(t (make-frame))))
(bind-key "C-x 2" 'split-window-below-i3)
(bind-key "C-x 3" 'split-window-right-i3))
(use-package crux :ensure (use-package crux :ensure
:bind (("C-a" . crux-move-beginning-of-line))) :bind (("C-a" . crux-move-beginning-of-line)))