[Sawfish] Add support for sticky in viewport and sticky in workspace for tabs

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


Hi,

With this patch i have add support for sticky viewport and sticky
workspace for tabs/group in tabgroup.jl.

-- 
Regards,
Fuchur

GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53  C116 E5BC 70D5 B8D7 B2B0
diff -urNad sawfish.orgi/lisp/sawfish/wm/tabs/tabgroup.jl sawfish/lisp/sawfish/wm/tabs/tabgroup.jl
--- sawfish.orgi/lisp/sawfish/wm/tabs/tabgroup.jl
+++ sawfish/lisp/sawfish/wm/tabs/tabgroup.jl
@@ -235,11 +235,20 @@
                           (window-put w 'unmaximized-geometry group-frame-unmaximized-geometry)
                           (tab-move-resize-frame-window-to w (car pos) (cdr pos) (car dim) (cdr dim))) unfocus)))
              ((eq prop 'sticky)
-              (mapcar (lambda (w)
-                        (make-window-sticky w)) unfocus))
-             ((eq prop 'unsticky)
-              (mapcar (lambda (w)
-                        (make-window-unsticky w)) unfocus))
+              (let ((workspace-sticky (window-sticky-p/workspace win))
+                    (viewport-sticky (window-sticky-p/viewport win))
+                    tab-workspace-sticky tab-viewport-sticky)
+                (mapcar (lambda (w)
+                          (setq tab-workspace-sticky (window-sticky-p/workspace w))
+                          (setq tab-viewport-sticky (window-sticky-p/viewport w))
+                          (if (not (eq workspace-sticky tab-workspace-sticky))
+                              (if workspace-sticky
+                                  (make-window-sticky/workspace w)
+                                (make-window-unsticky/workspace w)))
+                          (if (not (eq viewport-sticky tab-viewport-sticky))
+                              (if viewport-sticky
+                                  (make-window-sticky/viewport w)
+                                (make-window-unsticky/viewport w)))) unfocus)))
              ((eq prop 'shade)
               (mapcar (lambda (w)
                         (shade-window w)) unfocus))
@@ -276,7 +285,7 @@
              (group-frame-maximized-fullscreen (window-get win 'maximized-fullscreen))
              (group-frame-unmaximized-type (window-get win 'unmaximized-type))
              (group-frame-unmaximized-geometry (window-get win 'unmaximized-geometry))
-             group-frame-to-workspaces group-frame-from-workspaces win-is-sticky)
+             group-frame-to-workspaces group-frame-from-workspaces is-sticky-w is-sticky-v)
         (when (not (eq index index2))
           ;; tabgroup to tabgroup
           (when (window-tabbed-p w)
@@ -286,9 +295,9 @@
           (if (window-get win 'iconified) (uniconify-window win))
           (if (window-get win 'shaded) (unshade-window win))
           (setq tab-refresh-lock nil)
-          (when (window-sticky-p win) 
-            (make-window-unsticky win)
-            (setq win-is-sticky 't))
+          (if (window-sticky-p/workspace win) (setq is-sticky-w 't))
+          (if (window-sticky-p/viewport win) (setq is-sticky-v 't))
+          (if (window-sticky-p win) (make-window-unsticky win))
           (setq group-frame-to-workspaces (car (window-workspaces win)))
           (if (window-sticky-p w) (make-window-unsticky w))
           (setq group-frame-from-workspaces (car (window-workspaces w)))
@@ -318,10 +327,17 @@
           (when (and group-frame-to-workspaces group-frame-from-workspaces
                      (not (eq group-frame-to-workspaces group-frame-from-workspaces)))
             (move-window-to-workspace w group-frame-from-workspaces group-frame-to-workspaces))
+          (if (and is-sticky-w is-sticky-v)
+              (progn 
+                (make-window-sticky win)
+                (make-window-sticky w))
+            (when is-sticky-w 
+              (make-window-sticky/workspace win)
+              (make-window-sticky/workspace w))
+            (when is-sticky-v 
+              (make-window-sticky/viewport win)
+              (make-window-sticky/viewport w)))
           (setq tab-refresh-lock t)
-          (when win-is-sticky 
-            (make-window-sticky win)
-            (make-window-sticky w))
           (tab-refresh-group w 'frame)
           (set-input-focus w)
           (if (not (window-tabbed-p win)) (window-put win 'tabbed t))
@@ -369,23 +385,26 @@
              (lambda (w) (eq w win))
              (tab-group-window-list (tab-find-window win)))) )
 
+  (define (before-move win)
+    (when (not (window-get win 'fixed-position))
+      (before-move-resize win)))
+
   (define (before-move-resize win)
     "Releas win from the tabgroup and iconify the rest from the group."
-    (when (not (window-get win 'fixed-position))
-      (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)))
+    (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)"
@@ -440,11 +459,6 @@
     (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)
@@ -453,7 +467,7 @@
                 (when (window-tabbed-p win)
                   (setq args (car args))
                   (cond ((eq 'sticky args)
-                         (tab-group-sticky win)
+                         (tab-refresh-group win 'sticky)
                          (tab-refresh-group win 'frame))
                         ((eq 'fixed-position args)
                          (tab-refresh-group win 'fixed-position)
@@ -470,7 +484,7 @@
                          (tab-refresh-group win 'frame))))))
 
     (when (eq move-outline-mode 'opaque)
-      (add-hook 'before-move-hook (lambda (win) (if (window-tabbed-p win) (before-move-resize win)))))
+      (add-hook 'before-move-hook (lambda (win) (if (window-tabbed-p win) (before-move 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)))))

Attachment: signature.asc
Description: PGP signature



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