Wikia

Sawfish

Xinerama aware grow-pack.jl

773pages on
this wiki
Talk0
Browse all patches

Author Edit

Nolan Leake

Synopsis Edit

Makes grow-pack.jl xinerama aware.  After applying, pack-window-* will stop at head boundaries.  A second pack in the same direction will then move it onto the adjacent head

Patch testing Edit

  1. Copy/paste the patch listed below into some file, eg. TEST.diff.
  2. If you don't have sawfish sources yet, have one, as described get it from GIT repo.
  3. Go into the directory where sawfish sources reside, eg. cd sawfish
  4. Test if the patch applies cleanly with this command:
    patch -p1 --ignore-whitespace --dry-run < TEST.diff
    in case of problems try also: -p0 or -p2
  5. If it applies cleanly, then remove the --dry-run from above command and run it again, otherwise ask on the mailing list.
  6. Compile sawfish: ./autogen.sh && make
  7. Install it for testing, but it depends on your linux distribution.
    1. It is always better to install sawfish as your distribution package, but it is different for each distribution.
    2. So you may try make install, which will install sawifish in /usr/local/share/sawfish/ (if you have write access). But then make sure that you run the correct version and delete it from that directory afterwards, to avoid any conflicts.
  8. Se also

PS: edit this template if you feel that those instructions can be improved.

Patch Edit

--- grow-pack.jl.old    2009-10-30 11:31:00.000000000 -0700
+++ grow-pack.jl        2009-10-30 13:28:04.000000000 -0700
@@ -176,10 +176,28 @@
 
   ;; Implementation part.
 
+  (define (bump-get-head w direction)
+    (let* ((frame-dims (window-frame-dimensions w))
+           (frame-pos (window-position w))
+           (head1 (current-head w))
+           (head2 (find-head
+                   (case direction
+                     ((left) (- (car frame-pos) 1))
+                     ((right) (+ (car frame-pos) (car frame-dims)))
+                     (t (car frame-pos)))
+                   (case direction
+                     ((up) (- (cdr frame-pos) 1))
+                     ((down) (+ (cdr frame-pos) (cdr frame-dims)))
+                     (t (cdr frame-pos))))))
+      (if head2 head2 head1)))
+
   (define (bump-distance w direction maximize min-dist)
     (let* ((a (window-position w))
           (z (window-frame-dimensions w))
           (depth (window-get w 'depth))
+           (head (bump-get-head w direction))
+           (head-dims (head-dimensions head))
+           (head-offs (head-offset head))
           bump cmp
           xa xz
           min-next border xborders)
@@ -192,7 +210,9 @@
                                        ,(y xa) . ,(+ (y xa) (y xz))))
                  a (y a)
                  z (+ a (y z))
-                 bump 0
+                 bump (if (eq direction 'up)
+                           (cdr head-offs)
+                         (car head-offs))
                  cmp <=)
          (setq border (+ (x a) (x z))
                min-next (+ border min-dist)
@@ -200,7 +220,9 @@
                                      ,(y xa) . ,(+ (y xa) (y xz))))
                a (y a)
                z (+ a (y z))
-               bump ((if (eq direction 'down) screen-height screen-width))
+               bump (if (eq direction 'down)
+                         (+ (cdr head-offs) (cdr head-dims))
+                       (+ (car head-offs) (car head-dims)))
                cmp >=)))
       (if (cmp bump min-next)
          (mapc

The same patch, but for version 1.6, GIT.

--- grow-pack.jl-orig	2009-11-14 07:09:52.000000000 +0100
+++ grow-pack.jl	2009-11-14 07:12:34.000000000 +0100
@@ -159,10 +159,28 @@
 
   ;; Implementation part.
 
+  (define (bump-get-head w direction)
+    (let* ((frame-dims (window-frame-dimensions w))
+           (frame-pos (window-position w))
+           (head1 (current-head w))
+           (head2 (find-head
+                   (case direction
+                     ((left) (- (car frame-pos) 1))
+                     ((right) (+ (car frame-pos) (car frame-dims)))
+                     (t (car frame-pos)))
+                   (case direction
+                     ((up) (- (cdr frame-pos) 1))
+                     ((down) (+ (cdr frame-pos) (cdr frame-dims)))
+                     (t (cdr frame-pos))))))
+      (if head2 head2 head1)))
+
   (define (bump-distance w direction maximize min-dist)
     (let* ((a (window-position w))
 	   (z (window-frame-dimensions w))
 	   (depth (window-get w 'depth))
+	   (head (bump-get-head w direction))
+	   (head-dims (head-dimensions head))
+	   (head-offs (head-offset head))
 	   bump cmp
 	   xa xz
 	   min-next border xborders)
@@ -175,7 +193,9 @@
 					,(y xa) . ,(+ (y xa) (y xz))))
 		  a (y a)
 		  z (+ a (y z))
-		  bump 0
+	          bump (if (eq direction 'up)
+	                   (cdr head-offs)
+	                   (car head-offs))
 		  cmp <=)
 	  (setq border (+ (x a) (x z))
 		min-next (+ border min-dist)
@@ -183,7 +203,9 @@
 				      ,(y xa) . ,(+ (y xa) (y xz))))
 		a (y a)
 		z (+ a (y z))
-		bump ((if (eq direction 'down) screen-height screen-width))
+	        bump (if (eq direction 'down)
+	                 (+ (cdr head-offs) (cdr head-dims))
+	                 (+ (car head-offs) (car head-dims)))
 		cmp >=)))
       (if (cmp bump min-next)
 	  (mapc

Community's reasons for inclusion or rejection Edit

Patch submitters, please vote also! Yes, obviously your vote will be positive, but it's the place to give your explanation why this patch is good for all Sawfish users, and why it is correct - good reasons for inclusion.

When voting anonymously please write your name, so that it can be associated with your posts on the mailing list. If you are logged in you can sign yourself by typing four tilda characters: ~~~~.

  • Please vote with: Yes vote: yes., No vote: no., Try vote: let's try in experimental., Wtf vote: pondering. or Suspend wait for next release.
  • Yes vote: yes. Surely not supporting Xinerama was a simple oversight. - Nolan Leake
  • Yes vote: yes. This patch is awesome. It even works on my three displays! But:
  • it won't work for somebody with four displays. Such a person will be unpleasantly surprised. (edit: my mistake Janek Kozicki 12:49, December 29, 2009 (UTC))
  • it doesn't support shrink-yank. So I can grow-pack windows towards xinerama edges, but I can't shrink-yank...
Maybe someone with better lisp skills could try to improve those two points above? But even without them I'll be using this patch. I was missing this functionality for ages! Janek Kozicki 06:22, November 14, 2009 (UTC)

Around Wikia's network

Random Wiki