]> code.delx.au - dotemacs/commitdiff
Shackle rules for different frame sizes
authorJames Bunton <jamesbunton@delx.net.au>
Sun, 28 Oct 2018 23:00:58 +0000 (10:00 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Sun, 28 Oct 2018 23:01:53 +0000 (10:01 +1100)
lisp/my-shackle.el
packages/shackle

index 7739afe61303b33e261a2f4c586fa7c7e23e9ff6..66d9d2d9c8712ae769faf74eaa77946b12a01b00 100644 (file)
@@ -2,12 +2,32 @@
 
 (require 'shackle)
 
-(setq shackle-rules '(((:custom buffer-file-name) :other t)
-                      (direx:direx-mode :align left :size 40 :select t)
-                      ("*magit-.*-popup*" :regexp t :align right :size 63 :select t)
-                      (magit-status-mode :align below :size 20 :select t)
-                      ("*Flycheck error messages*" :align below :size 15 :select nil)
-                      ((magit-diff-mode magit-revision-mode) :align right)))
+(defun my/shackle-rules ()
+  (let ((rules-common
+         '(((:custom buffer-file-name) :other t)
+           (direx:direx-mode :align left :size 40 :select t)
+           ("*Flycheck error messages*" :align below :size 15 :select nil)))
+        (rules-wide
+         '(("magit-.*-popup" :regexp t :align right :select t)
+           ((magit-log-mode magit-status-mode) :align bottom :size 15 :select t)
+           ((magit-diff-mode magit-revision-mode) :align right :size 80)))
+        (rules-narrow-tall
+         '(("magit-.*-popup" :regexp t :align bottom :select t)
+           (magit-status-mode :align bottom :size 25 :select t)
+           ((magit-diff-mode magit-revision-mode) :align bottom :size 25)))
+        (rules-narrow-short
+         '(("magit-.*-popup" :regexp t :align bottom :select t)
+           (magit-status-mode :align bottom :size 0.8 :select t)
+           ((magit-diff-mode magit-revision-mode) :align bottom :size 0.65))))
+    (cond
+     ((>= (frame-text-cols) 120)
+      (append rules-common rules-wide))
+     ((>= (frame-text-lines) 30)
+      (append rules-common rules-narrow-tall))
+     (t
+      (append rules-common rules-narrow-short)))))
+
+(setq shackle-rules #'my/shackle-rules)
 
 (setq shackle-default-rule '(:align below :select t :size 15))
 
index 4189c1c773aab533969b587f7801ffbcd1d7d613..1e40f3519518b0efef76c70e8f6e5666b8eb5745 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 4189c1c773aab533969b587f7801ffbcd1d7d613
+Subproject commit 1e40f3519518b0efef76c70e8f6e5666b8eb5745