Re: Patch to save memory and speed up StyleTab

fuchur <[email protected]>
Newsgroups gmane.comp.window-managers.sawfish
Organization W.W
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

On Sun, 4 May 2014 14:47:45 +0200
wrote fuchur <[email protected]>:

>Here i have more for testing. I have completes cabinets gui.
>Patches "10-tab-tiler-add.patch 11-tab-tiler-add.patch" apply after all
>other patches from this thread

Patch 12-tab-tiler-add.patch:

Changes:
Improve move window to next/prev workspace.
Splitline length is now dynamic. (Width from cabinet).

Apply patch after all other patches from this thread.

- -- 
Regards,
Fuchur

GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53  C116 E5BC 70D5 B8D7 B2B0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iEYEARECAAYFAlNpCaQACgkQ5bxw1bjXsrAr5wCffe5EL1SZjhlzu9vIMRKQDN/C
A68An1P59Kl3/PkfFrZh+MctxM2q0viY
=3GI+
-----END PGP SIGNATURE-----
12-tab-tiler-add.patch (text/x-patch, 3.6 KB)
diff -urNad sawfish.orgi/lisp/sawfish/wm/ext/cabinet.jl sawfish/lisp/sawfish/wm/ext/cabinet.jl
--- sawfish.orgi/lisp/sawfish/wm/ext/cabinet.jl
+++ sawfish/lisp/sawfish/wm/ext/cabinet.jl
@@ -308,7 +308,7 @@
     "The text part shown on cabinet item"
     ;; if we remove a window we temporary need this if
     (if (not (numberp (window-id w)))
-        "Window is gone" 
+        "Window is gone"
       (concat (when (window-get w 'marked)
                 " »»")
               (when (window-tabbed-p w)
@@ -360,9 +360,15 @@
   (define command-timer nil)
   (define bad-key nil)
   (define focus-by-tab nil)
+  (define split-line-length nil)
 
   ;; item-format package
   (define (cabinet-item-text-format w)
+    (let ((split-length (quotient (length (cabinet-item-text w)) 2)))
+      (if (> split-length split-line-length)
+          (if (> split-length 40)
+              (setq split-line-length (- split-length 5))
+            (setq split-line-length split-length))))
     (cons (cabinet-item-text w)
           (cond
            ((window-iconified-p w) cabinet:iconified-item-forground)
@@ -410,16 +416,21 @@
                             0 nil))
           nil)
          (t (loop (cdr fow-nrl)))))))
-  
+
   (define (cabinet-split-line)
-    (make-item nil
-               (format nil "===================%s========================="
-                       (if workspace-mode
-                           (format nil " %s/%s "
-                                   current-workspace
-                                   (cdr (workspace-limits)))
-                         "ALL"))
-               cabinet:split-line-forground))
+    (let ((lenght '0)
+          line enil mode)
+      (while (< lenght split-line-length) 
+        (setq line (concat line "»")) 
+        (setq enil (concat enil "«")) 
+        (setq lenght (1+ lenght)))
+      (setq mode (if workspace-mode
+                     (format nil "%s/%s"
+                             current-workspace
+                             (cdr (workspace-limits)))
+                   "ALL"))
+      (make-item nil (format nil (concat line mode enil))
+                 cabinet:split-line-forground)))
 
   (define (draw-items wl input-line)
     (when (x-window-p cabinet-window)
@@ -712,15 +723,23 @@
     "Call marked hook if window marked"
     (call-window-hook 'window-state-change-hook cmd (list '(marked))))
 
+  (define (get-last-workspace)
+    (aref (nth 2 (get-x-property 'root '_NET_NUMBER_OF_DESKTOPS)) 0))
+  
   (defvar move-window-to-next-workspace
     (lambda (w)
-      (let ((nw (+ (car (window-get w 'workspaces)) 1)))
-        (send-to-next-workspace w nw))))
-
+      (unless (window-sticky-p w)
+        (let ((nw (+ (car (window-get w 'workspaces)) 1)))
+          (if (< nw (get-last-workspace))
+              (send-window-to-workspace-from-first w nw))))))
+  
   (defvar move-window-to-previous-workspace
     (lambda (w)
-      (let ((nw (- (car (window-get w 'workspaces)) 1)))
-        (send-to-next-workspace w nw))))
+      (unless (window-sticky-p w)
+        (let ((nw (- (car (window-get w 'workspaces)) 1)))
+          (if (> nw '-1)
+              (send-window-to-workspace-from-first w nw))))))
+
 
   (defvar move-window-to-top-left
     (lambda (w)
@@ -891,6 +910,7 @@
                             (quotient cabinet:raise-window-timeout 1000) (mod cabinet:raise-window-timeout 1000))))
         (when (eq cabinet:manipulation-on-selected 'None) 
           (set-input-focus nil)))
+      (setq split-line-length nil)
       (draw-items (append (mapcar cabinet-item-format wlist-for-manipulation)
                           (list (cabinet-split-line))
                           (mapcar cabinet-item-format wlist-for-display))
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.