[Sawfish] Patches for styletab and compton

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


Hi,

Two patches for sawfish.

Changes:
01-styletab.patch
Lock recolor in styletab with timer until theme is loaded
sawfish now start 70% - 80% faster if you use the styletab theme.

02-compton.patch
Compton now starts with a delay from 3 seconds if you start or restart
sawfish, this fix the "flashing". 
Stop compton bevor you close sawfish.

-- 
Regards,
Fuchur

GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53  C116 E5BC 70D5 B8D7 B2B0
diff -urNad sawfish.orgi/themes/StyleTab/theme.jl sawfish/themes/StyleTab/theme.jl
--- sawfish.orgi/themes/StyleTab/theme.jl
+++ sawfish/themes/StyleTab/theme.jl
@@ -2598,7 +2598,7 @@
 (define frame nil)
 (define button-alist nil)
 (define current-title styletab-c:titlebar-place)
-(define recolor-lock t)
+(define recolor-lock nil)
 (define current-type nil)
 
 ;; botton list table
@@ -2877,39 +2877,33 @@
 ;; reframe-with-style, resize bottons
 ;; reset icon cache
 (define (clear-icon-cache-reframe)
-  (when recolor-lock
-    (setq recolor-lock nil)
+  (when (not recolor-lock)
     (recolor-all-buttons)
     (setq styletab-c-icon-cache (make-weak-table eq-hash eq))
     (make-buttons)
-    (reframe-with-style)
-    (setq recolor-lock t)))
+    (reframe-with-style)))
+
 
 (define (color-changed)
-  (when recolor-lock
-    (setq recolor-lock nil)
+  (when (not recolor-lock)
     (recolor-all)
-    (reframe-with-style)
-    (setq recolor-lock t)))
+    (reframe-with-style)))
 
 (define (bright-changed)
-  (when recolor-lock
-    (setq recolor-lock nil)
+  (when (not recolor-lock)
     (recolor-tab)
     (recolor-all-buttons)
-    (reframe-with-style)
-    (setq recolor-lock t)))
+    (reframe-with-style)))
 
 (define (botton-color-changed botton)
-  (when recolor-lock
-    (setq recolor-lock nil)
+  (when (not recolor-lock)
     (botton)
-    (reframe-with-style)
-    (setq recolor-lock t)))
+    (reframe-with-style)))
 
 (define (reload-frame-style-reframe)
-  (reload-frame-style theme-name)
-  (reframe-with-style))
+  (when (not recolor-lock)
+    (reload-frame-style theme-name)
+    (reframe-with-style)))
 
 (define (frame-style-name w)
   (when (eq (window-get w 'current-frame-style) theme-name)
@@ -2942,9 +2936,21 @@
           ((shaped-transient)
            (make-frame w 'shaped-transient-frame current-title)))))
 
-;; initialize theme
-(color-changed)
-(make-buttons)
+(define (timer-theme-load)
+  (color-changed)
+  (make-buttons)
+  ;; Lock recolor untill all defcustom loaded.                                                                                                             
+  ;; Then recolor the theme with images from                                                                                                               
+  ;; the hashtables and reframe the theme                                                                                                                  
+  (require 'rep.io.timers)
+  (setq recolor-lock
+        (make-timer (lambda ()
+                      (setq recolor-lock nil)
+                      (color-changed))
+                    (quotient 1000 1000) (mod 1000 1000))))
+
+;; initialize theme                                                                                                                                        
+(timer-theme-load)
 
 (add-frame-style theme-name get-frame)
 
--- sawfish.orgi/lisp/sawfish/wm/prg/compton.jl
+++ sawfish/lisp/sawfish/wm/prg/compton.jl
@@ -39,6 +39,7 @@
   (define switch-opacity nil)
   (define update-opacity nil)
   (define stop-compton nil)
+  (define timer-load-compton nil)
 
   (defgroup window-effects "Window Effects"
     :group appearance)
@@ -386,13 +387,14 @@
                            (window-opacity w))))))
 
     (define (switch-opacity)
-      (if opacity-enable
-          (start-compton)
-        (stop-compton))
-      (map-windows (lambda (w)
-                     (if opacity-enable
-                         (window-opacity w)
-                       (dim-window w (get-opacity '100))))))
+      (when (not timer-load-compton)
+        (if opacity-enable
+            (start-compton)
+          (stop-compton))
+        (map-windows (lambda (w)
+                       (if opacity-enable
+                           (window-opacity w)
+                         (dim-window w (get-opacity '100)))))))
 
     (define (max-window w)
       (if shadows-crop-maximized
@@ -403,13 +405,22 @@
 
     (define (before-resize w)
       (dim-window w (get-opacity opacity-by-resize)))
-
+    
     (define (tab-release w)
       (if (and (car w)
                (not (cdr w)))
-           (if opacity-enable
-               (window-opacity (car w))
-             (dim-window (car w) (get-opacity '100)))))
+          (if opacity-enable
+              (window-opacity (car w))
+            (dim-window (car w) (get-opacity '100)))))
+
+    (define (timer-compton-load)
+      (setq timer-load-compton
+            (make-timer (lambda ()
+                          (setq timer-load-compton nil)
+                          (switch-opacity))
+                        (quotient 3000 1000) (mod 3000 1000))))
+    
+    (timer-compton-load)
 
     (add-hook 'window-maximized-hook (lambda (w) (if opacity-enable (max-window w))))
     (add-hook 'window-unmaximized-hook (lambda (w) (if opacity-enable (max-window w))))
@@ -422,4 +433,5 @@
     (add-hook 'after-move-hook (lambda (w) (if opacity-enable (window-opacity w))))
     (add-hook 'before-resize-hook (lambda (w) (if opacity-enable (before-resize w))))
     (add-hook 'after-resize-hook (lambda (w) (if opacity-enable (window-opacity w))))
-    (add-hook 'after-initialization-hook switch-opacity)))
+    (add-hook 'after-initialization-hook switch-opacity)
+    (add-hook 'before-exit-hook stop-compton)))

Attachment: signature.asc
Description: PGP signature



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