Patch to moves tabs in tabbar

fuchur <[email protected]>
Newsgroups gmane.comp.window-managers.sawfish
Organization W.W
Message-ID <[email protected]>
Hi,

move-tabs-02.patch:
Add keybindings to move tabs in the tabbar.
(Active tab to left/right start/end with mouse or keyboard)

styletab-adju-icon.patch:
Improve icon size in Styletab theme.

And pleas replace de.po with de.po by this mail.

-- 
Regards,
Fuchur

GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53  C116 E5BC 70D5 B8D7 B2B0
de.po (text/x-gettext-translation, 213.3 KB) - not displayed
move-tabs-02.patch (text/x-patch, 4.2 KB)
diff -urNad lisp.orgi/sawfish/wm/keymaps.jl lisp/sawfish/wm/keymaps.jl
--- lisp.orgi/sawfish/wm/keymaps.jl
+++ lisp/sawfish/wm/keymaps.jl
@@ -135,7 +135,12 @@
 				      "Button2-Off" 'tab-window-add-to-tabgroup
 				      "C-Button2-Off" 'tab-tabgroup-add-to-tabgroup
 				      "Button1-Off2" 'toggle-window-shaded
-				      "Button1-Move" 'move-window-interactively)
+				      "Button1-Move" 'move-window-interactively
+                      "Button1-C-Off" 'tab-move-to-left
+                      "Button3-C-Off" 'tab-move-to-right
+                      "Button1-Super-Off" 'tab-move-to-beginning
+                      "Button3-Super-Off" 'tab-move-to-end)
+
     "Keymap of window tabbar. Mouse-bindings only."
     :group bindings
     :type keymap)
diff -urNad lisp.orgi/sawfish/wm/tabs/tabgroup.jl lisp/sawfish/wm/tabs/tabgroup.jl
--- lisp.orgi/sawfish/wm/tabs/tabgroup.jl
+++ lisp/sawfish/wm/tabs/tabgroup.jl
@@ -139,6 +139,7 @@
       wins))
 
   (define (tab-rank elem list)
+    "Returns the nth position from elem (tab) in a list (tabbar)"
     (if (eq elem (car list))
         0
       (+ 1 (tab-rank elem (cdr list)))))
@@ -409,6 +410,85 @@
 
   (define-command 'tab-raise-right-window tab-raise-right-window)
 
+  (define (move-tab w pos)
+    "Move tab W to pos"
+    (when (window-tabbed-p w)
+      (let* ((wins (tab-group-window-index w))
+            (rank (tab-rank w wins))
+            (list-end (nthcdr rank wins))
+            (list-start wins)
+            right left current new-list)
+        (mapcar (lambda (w)
+                  (setq list-start (remove w list-start))) list-end)
+        (when (eq pos 'next)
+          (if (not (nth (+ rank 1) wins))
+              (tab-move-to-beginning w)
+            (setq list-end (remove w list-end))
+            (setq right (nth (+ rank 1) wins))
+            (setq list-end (remove (nth (+ rank 1) wins) list-end))         
+            (setq current (list w))
+            (if (consp list-start)
+                (setq new-list (append new-list list-start)))
+            (if right
+                (setq new-list (append new-list (list right))))
+            (if (consp current)
+                (setq new-list (append new-list current)))
+            (if (consp list-end)
+                (setq new-list (append new-list list-end)))
+            (setq all-wins (nthcdr 0 new-list))
+            (after-move-resize w)))
+        (when (eq pos 'prev)
+          (setq left (last list-start))  
+          (if (not left)
+              (tab-move-to-end w)
+          (setq list-start (remove left list-start))
+            (setq list-end (nthcdr (+ rank 1) wins))
+            (setq current (list w))
+            (if (consp list-start)
+                (setq new-list (append new-list list-start)))
+            (if (consp current)
+                (setq new-list (append new-list current)))
+            (if left
+                (setq new-list (append new-list (list left))))
+            (if (consp list-end)
+                (setq new-list (append new-list list-end)))
+            (setq all-wins (nthcdr 0 new-list))
+            (after-move-resize w))))))
+
+  (define (tab-move-to-right w)
+    "Move tab to right in the tabbar."
+    (move-tab w 'next))
+
+  (define-command 'tab-move-to-right tab-move-to-right #:spec "%f")
+
+  (define (tab-move-to-left w)
+    "Move tab to left in the tabbar."
+    (move-tab w 'prev))
+  
+  (define-command 'tab-move-to-left tab-move-to-left #:spec "%f")
+
+  (define (move-tab-edge w pos)
+    "Move tab W to pos"
+    (when (window-tabbed-p w)
+      (let ((tabs (remove w (tab-group-window-index w))))
+        (if (eq pos 'end)
+            (setq all-wins (append tabs (cons w nil))))
+        (if (eq pos 'beg)
+            (setq all-wins (append (cons w nil) tabs)))
+        (after-move-resize w))))
+
+  (define (tab-move-to-end w)
+    "Move tab to the end in the tabbar."
+    (move-tab-edge w 'end))
+
+  (define-command 'tab-move-to-end tab-move-to-end #:spec "%f")
+
+  (define (tab-move-to-beginning w)
+    "Move tab to the beginning in the tabbar."
+    (move-tab-edge w 'beg))
+
+  (define-command 'tab-move-to-beginning tab-move-to-beginning #:spec "%f")
+
   (define (map-other-grouped-windows win func)
     ""
     (mapcar func
styletab-adju-icon.patch (text/x-patch, 895 B)
diff -urNad themes.orgi/StyleTab/theme.jl themes/StyleTab/theme.jl
--- themes.orgi/StyleTab/theme.jl
+++ themes/StyleTab/theme.jl
@@ -741,10 +741,10 @@
   (or (table-ref styletab-c-icon-cache w)
       (let ((icon (window-icon-image w)))
         (if icon
-            (let ((scaled (scale-image icon (- styletab-c:title-dimension 7) (- styletab-c:title-dimension 7))))
+            (let ((scaled (scale-image icon (- styletab-c:title-dimension 7) (- styletab-c:title-dimension 8))))
               (table-set styletab-c-icon-cache w scaled)
               scaled)
-          (scale-image top-frame-icon-title-images (- styletab-c:title-dimension 7) (- styletab-c:title-dimension 7))))))
+          (scale-image top-frame-icon-title-images (- styletab-c:title-dimension 7) (- styletab-c:title-dimension 8))))))
 
 (defun brighten-color (color percentage)
   (let* ((red (car (color-rgb color)))
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iEYEARECAAYFAlMzABMACgkQ5bxw1bjXsrCrQgCguq3TYvDPOuG5thXJ3HcNrGX5
Bp4AnAh3+W0T0FX3H2kK4v3EhiBSvp9B
=i2lq
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.