From 726224bfe040df2976a03caa3ea5c06a24f8b002 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Tue, 19 Feb 2019 01:58:16 -0500 Subject: [PATCH] Check if i3 exists when trying to do splits, else just spawn new frames --- .emacs.d/init.el | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index d2888d1..87d008f 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -475,18 +475,23 @@ (add-to-list 'frames-only-mode-use-window-functions 'undo-tree-visualize) (frames-only-mode t) (menu-bar-mode 0) - (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-below', 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)) + (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-below', 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)))) (use-package crux :ensure :bind (("C-a" . crux-move-beginning-of-line)))