Skip to content

Instantly share code, notes, and snippets.

@tom-seddon
Created November 27, 2014 13:55
Show Gist options
  • Save tom-seddon/6593178459d15c964d67 to your computer and use it in GitHub Desktop.
Save tom-seddon/6593178459d15c964d67 to your computer and use it in GitHub Desktop.
(defun wm-layout-pyramid ()
(wm-reset-layout)
(let* ((options '(nil ;0
nil ;1
(h) ;2
(h 1 v) ;3
(h h 2 v) ;4
(h h 1 v 2 v) ;5
(h h 1 v 2 v v) ;6
(h h 1 v v 3 v v) ;7
(h h v 2 v v 3 v v) ;8
(h h v 2 v v 3 v v v) ;9
(h h v 2 v v v 4 v v v) ;10
(h h v v 3 v v v 4 v v v) ;11
))
(wm-windows (frame-parameter nil 'wm-windows))
(option (nth (length wm-windows) options)))
(if option
(progn
(lexical-let ((original-window (selected-window)))
(mapc (lambda (x)
(cond
((numberp x)
(other-window x))
((equal x 'h)
(split-window-horizontally))
((equal x 'v)
(split-window-vertically))))
option)
(balance-windows)
(select-window original-window)
(mapc (lambda (x)
(wm-restore-window x)
(other-window 1))
wm-windows)
(select-window original-window)
(other-window (frame-parameter nil 'wm-focus))
)
(let ((n -1))
(setf (frame-parameter nil 'wm-windows-alist) (mapcar (lambda (window) (cons window (incf n)))
(wm-emacs-windows))))
)
(wm-layout-grid))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment