Re: [Sawfish] Patch for tab.jl

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


Hi,

On Fri, 24 Aug 2012 03:14:43 +0200
wrote fuchur <flohtransporter@xxxxxxxxx>:

>Hi,
>
>On Fri, 24 Aug 2012 00:37:49 +0200
>wrote Christopher Roy Bratusek <nano@xxxxxxxxxxxxx>:
>
>>On Thursday 23 August 2012 21:10:42 fuchur wrote:
>>> Hi,
>>> 
>>> This patch removes "/usr/share/sawfish/lisp/sawfish/wm/util/marks.jl"
>>> It seems marks.jl is only for tab.jl. But with a pair small changes
>>> in tab.jl we don't need marks.jl
>>> 
>>> I also add a check if the select window for a tab exists (if not
>>> exists (maybe you have close the window), then tabs will
>>> not work until you restart sawfish, the patch fix that)
>>> 
>>> And also now the cursor changes if you select a window as tab.
>>
>>Thanks, commited.
>
>Here is already an update, sorry. We always set the default cursor to
>left_ptr. But i am not sure that always the default cursor is left_ptr.
>To make sure to have always the default cursor set by
>gtk-mouse-theme-selector or other programs we should use also this
>patch.
>
>

Two patches: 
With add-group-as-tabs.patch we have a function and keybinding to
add a complete tabgroup to a window or other tabgroup as tabs. The
keybinding works by the first or second command if you select
a group/window, it makes no difference.

tabgroup-bugfix-01.patch have many bugfix for tabsupport (tabgroup.jl)


-- 
Regards,
Fuchur

GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53  C116 E5BC 70D5 B8D7 B2B0
diff -urNad sawfish.orig/lisp/sawfish/wm/keymaps.jl sawfish/lisp/sawfish/wm/keymaps.jl
--- sawfish.orig/lisp/sawfish/wm/keymaps.jl
+++ sawfish/lisp/sawfish/wm/keymaps.jl
@@ -121,7 +121,8 @@
 				     "Button2-Move" 'resize-window-interactively
 				     "Button1-Off2" 'toggle-window-shaded
 				     "Button1-Move" 'move-window-interactively
-				     "Button2-Off" 'tab-add-to-group)
+				     "Button2-Off" 'tab-add-to-group
+				     "C-Button2-Off" 'tabgroup-add-to-group)
     "Keymap of window title bar. Mouse-bindings only."
     :group bindings
     :type keymap)
@@ -130,6 +131,7 @@
 				      "Button1-Off2" 'toggle-window-shaded
 				      "Button1-Move" 'move-window-interactively
 				      "Button2-Off" 'tab-add-to-group
+				      "C-Button2-Off" 'tabgroup-add-to-group
 				      "Button3-Click" 'tab-release-window
 				      "Button3-Move" 'move-window-interactively)
     "Keymap of window tabbar. Mouse-bindings only."
diff -urNad sawfish.orig/lisp/sawfish/wm/tabs/tab.jl sawfish/lisp/sawfish/wm/tabs/tab.jl
--- sawfish.orig/lisp/sawfish/wm/tabs/tab.jl
+++ sawfish/lisp/sawfish/wm/tabs/tab.jl
@@ -177,14 +177,27 @@
 the second."
     (if marked-window
         (progn
-          (tab-group-window marked-window win)
+          (mapcar (lambda (w) (tab-group-window w win)) marked-window)
           (default-cursor select-cursor)
           (setq marked-window nil))
       (default-cursor (get-cursor 'clock))
-      (setq marked-window win)))
+      (setq marked-window (cons win))))
 
   (define-command 'tab-add-to-group tab-add-to-group #:spec "%W")
 
+  (define (tabgroup-add-to-group win)
+    "Add a tabgroup to a tabgroup. Apply this command on a window 
+from the tabgroup, then on another. The tabgroup will be added to 
+the tabgroup containig the second."
+    (if marked-window
+        (progn
+          (setq marked-window (tab-group-window-index (car marked-window)))
+          (tab-add-to-group win))
+      (default-cursor (get-cursor 'clock))
+      (setq marked-window (tab-group-window-index win))))
+
+  (define-command 'tabgroup-add-to-group tabgroup-add-to-group #:spec "%W")
+
   (define (check-win)
     (if (and marked-window
              (not (window-id marked-window)))
--- sawfish.orgi/lisp/sawfish/wm/tabs/tabgroup.jl	2012-08-28 00:31:22.000000000 +0200
+++ sawfish/lisp/sawfish/wm/tabs/tabgroup.jl	2012-08-28 00:20:19.000000000 +0200
@@ -51,7 +51,6 @@
 
   (define-structure-alias tabgroup sawfish.wm.tabs.tabgroup)
 
-  (define current-win nil)
   (define all-wins nil)
   (define oldgroup nil)
   (define tab-groups nil)
@@ -279,7 +278,8 @@
           ;; tabgroup to tabgroup
           (when (window-tabbed-p w)
             (setq release-window nil)
-            (tab-delete-window-from-tab-groups w))
+            (tab-delete-window-from-tab-groups w)
+            (setq index2 (tab-window-group-index w)))
           (if (window-get win 'iconified) (uniconify-window win))
           (let ((group-frame-to-workspaces (car (window-workspaces win))))
             (if (window-get win 'shaded) (unshade-window win))
@@ -361,51 +361,39 @@
              (lambda (w) (eq w win))
              (tab-group-window-list (tab-find-window win)))) )
 
-  (define (tab-group-raise win)
-    (if (window-tabbed-p win)
-        (tab-refresh-group win 'raise)))
-
-  (define (tab-group-sticky win)
-    (if (window-get win 'sticky)
-        (tab-refresh-group win 'sticky)
-      (tab-refresh-group win 'unsticky)))
-
   (define (before-move-resize win)
     "Releas win from the tabgroup and iconify the rest from the group."
     (when (not (window-get win 'fixed-position))
-      (when (eq all-wins nil)
-        (let* ((index (tab-window-group-index win))
-               (wins (tab-group-window-list (nth index tab-groups)))
-               (tabs (remove win (tab-group-window-list (nth index tab-groups))))
-               (default-window-animator 'none))
-          (tab-delete-window-from-group win index)
-          (reframe-window win)
-          (setq tab-refresh-lock nil)
-          (mapcar (lambda (w)
-                    (when (window-get w 'never-iconify)
-                      (window-put w 'never-iconify nil)
-                      (window-put w 'never-iconify-opaque t))
-                    (iconify-window w)) tabs)
-          (setq all-wins wins)
-          (setq current-win win))
-        (setq tab-refresh-lock t))))
+      (let* ((default-window-animator 'none)
+             (index (tab-window-group-index win))
+             (wins (tab-group-window-list (nth index tab-groups)))
+             (tabs (remove win (tab-group-window-list (nth index tab-groups)))))
+        (tab-delete-window-from-group win index)
+        (reframe-window win)
+        (setq tab-refresh-lock nil)
+        (mapcar (lambda (w)
+                  (when (window-get w 'never-iconify)
+                    (window-put w 'never-iconify nil)
+                    (window-put w 'never-iconify-opaque t))
+                  (iconify-window w)) tabs)
+        (setq all-wins wins))
+      (setq tab-refresh-lock t)))
 
   (define (after-move-resize win)
     "Add all tabs to the tabgroup from win. (Releas and iconify by before-move-resize)"
     (setq tab-refresh-lock nil)
-    (let* ((wins all-wins)
-	   (default-window-animator 'none)
+    (let* ((default-window-animator 'none)
+           (wins all-wins)
            (pos (window-position win))
            (dim (window-dimensions win))
            index index-old)
-      (when (and (cdr wins)
-                 (eq win current-win))
+      (when (cdr wins)
         (setq index (tab-window-group-index (car wins)))
         (mapcar (lambda (w)
-                  (when (not (eq index (tab-window-group-index w)))
-                    (setq index-old (tab-window-group-index w))
-                    (tab-put-window-in-group w index)
-                    (tab-delete-window-from-group w index-old))
+                  (setq index-old (tab-window-group-index w))
+                  (tab-put-window-in-group w index)
+                  (tab-delete-window-from-group w index-old)
+                  (setq index (tab-window-group-index w))
                   (move-window-to w (car pos) (cdr pos))
                   (resize-window-to w (car dim) (cdr dim))
                   (uniconify-window w)
@@ -414,8 +402,7 @@
                     (window-put w 'never-iconify t))
                   (window-put w 'tabbed t)) wins)
         (raise-window win)
-        (setq all-wins nil)
-        (setq current-win nil))
+        (setq all-wins nil))
       (setq tab-refresh-lock t)
       (when (window-tabbed-p win)
         (tab-refresh-group win 'move)
@@ -445,6 +432,11 @@
     (when (window-get win 'tab-group)
       (setq in-tab-group-name (remove (assoc last-unmap-id in-tab-group-name) in-tab-group-name))))
 
+  (define (tab-group-sticky win)
+    (if (window-get win 'sticky)
+        (tab-refresh-group win 'sticky)
+      (tab-refresh-group win 'unsticky)))
+
   (unless batch-mode
     (add-hook 'after-add-window-hook in-tab-group)
     (add-hook 'unmap-notify-hook unmap-id)
@@ -469,13 +461,13 @@
                          (tab-refresh-group win 'depth)
                          (tab-refresh-group win 'frame))))))
 
-    (add-hook 'focus-in-hook (lambda (win) (tab-group-raise win)))
     (when (eq move-outline-mode 'opaque)
       (add-hook 'before-move-hook (lambda (win) (if (window-tabbed-p win) (before-move-resize win)))))
     (add-hook 'after-move-hook  (lambda (win) (after-move-resize win)))
     (when (eq resize-outline-mode 'opaque)
       (add-hook 'before-resize-hook (lambda (win) (if (window-tabbed-p win) (before-move-resize win)))))
     (add-hook 'after-resize-hook  (lambda (win) (after-move-resize win)))
+    (add-hook 'focus-in-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'raise))))
     (add-hook 'shade-window-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'shade))))
     (add-hook 'unshade-window-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'unshade))))
     (add-hook 'iconify-window-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'iconify))))
@@ -485,5 +477,4 @@
     (add-hook 'add-to-workspace-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'frame))))
     (add-hook 'destroy-notify-hook tab-delete-window-from-tab-groups))
 
-  (gaol-add tab-refresh-group tab-group-window-index)
-  )
+  (gaol-add tab-refresh-group tab-group-window-index))

Attachment: signature.asc
Description: PGP signature



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/