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))
(frames-only-mode t)
(menu-bar-mode 0)
(if (executable-find "i3")
(progn
(defun split-window-below-i3 ()
"It's like `split-window-below', but uses i3 stuff"
(interactive)
(call-process "i3" nil nil nil "split v")
(make-frame))
(defun split-window-right-i3 ()
"It's like `split-window-right', but uses i3 stuff"
(interactive)
(call-process "i3" nil nil nil "split h")
(make-frame))
(bind-key "C-x 2" 'split-window-below-i3)
(bind-key "C-x 3" 'split-window-right-i3))
(progn
(bind-key "C-x 2" 'make-frame-command)
(bind-key "C-x 3" 'make-frame-command))))
(defun split-window-below-i3 ()
"It's like `split-window-below', but uses i3 stuff when available"
(interactive)
(cond ((not (display-graphic-p)) (split-window-below))
((executable-find "i3")
(call-process "i3" nil nil nil "split v")
(make-frame))
(t (make-frame))))
(defun split-window-right-i3 ()
"It's like `split-window-right', but uses i3 stuff when available"
(interactive)
(cond ((not (display-graphic-p)) (split-window-right))
((executable-find "i3")
(call-process "i3" nil nil nil "split h")
(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
:bind (("C-a" . crux-move-beginning-of-line)))