Skip to content

Commit

Permalink
basic windows layout utility
Browse files Browse the repository at this point in the history
  • Loading branch information
larsen committed Nov 15, 2015
1 parent 592272f commit cb37d71
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions larsen-functions.el
@@ -1,4 +1,33 @@
(defun osx-notify (title message) (defun osx-notify (title message)
(start-process "osx-notify" nil "terminal-notifier" "-title" title "-message" message)) (start-process "osx-notify" nil "terminal-notifier" "-title" title "-message" message))


;; Windows layout

(defun change-split-type (split-fn &optional arg)
"Change 3 window style from horizontal to vertical and vice-versa"
(let ((bufList (mapcar 'window-buffer (window-list))))
(select-window (get-largest-window))
(funcall split-fn arg)
(mapcar* 'set-window-buffer (window-list) bufList)))

(defun change-split-type-2 (&optional arg)
"Changes splitting from vertical to horizontal and vice-versa"
(interactive "P")
(let ((split-type (lambda (&optional arg)
(delete-other-windows-internal)
(if arg (split-window-vertically)
(split-window-horizontally)))))
(change-split-type split-type arg)))

(defvar *larsen/split-layout-type* t)

(defun toggle-split-layout ()
(interactive)
(progn (change-split-type-2 *larsen/split-layout-type*)
(if *larsen/split-layout-type*
(setq *larsen/split-layout-type* nil)
(setq *larsen/split-layout-type* t))))

(global-set-key (kbd "M-<f1>") 'toggle-split-layout)

(provide 'larsen-functions) (provide 'larsen-functions)

0 comments on commit cb37d71

Please sign in to comment.