| [Sawfish] Update StyleTab patch. |
[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]
Hi, I have add support for sticky viewport in StyleTab. Now if you select a window to add as tab the tabbar is "hightlight" with a custom color. I have add some links in StylTabs styles "Default, Glass, Reduce, Smoothly, WixDa" folders, without the new links the two pachtes will crash sawfish. Download complete styles here: http://mitglied.lycos.de/fuchur2004/StyleTab.tar.bz2 Now my todo/buglist for sawfish is empty :). -- Regards, Fuchur GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53 C116 E5BC 70D5 B8D7 B2B0
diff -urNad sawfish.orgi/lisp/sawfish/wm/tabs/tab.jl sawfish/lisp/sawfish/wm/tabs/tab.jl
--- sawfish.orgi/lisp/sawfish/wm/tabs/tab.jl
+++ sawfish/lisp/sawfish/wm/tabs/tab.jl
@@ -170,6 +170,9 @@
(define-frame-class 'tabbar-vertical-bottom-edge
`((bottom-edge . ,tab-bottom-edge)) t)
+ (define (emit-marked-hook w)
+ (call-window-hook 'window-state-change-hook w (list '(marked))))
+
;; This function is for interactive use. Use tab-group-window for lisp.
(define (tab-add-to-group win)
"Add a window to a tabgroup. Apply this command on a window, then
@@ -178,11 +181,17 @@
(when (net-wm-window-type-normal-p win)
(if marked-window
(progn
- (mapcar (lambda (w) (tab-group-window w win)) marked-window)
+ (mapcar (lambda (w)
+ (window-put w 'marked nil)
+ (emit-marked-hook w)
+ (tab-group-window w win)) marked-window)
(default-cursor select-cursor)
+ (window-put win 'marked nil)
(setq marked-window nil))
+ (window-put win 'marked t)
(default-cursor (get-cursor 'clock))
- (setq marked-window (cons win)))))
+ (setq marked-window (cons win)))
+ (emit-marked-hook win)))
(define-command 'tab-add-to-group tab-add-to-group #:spec "%W")
@@ -196,7 +205,10 @@
(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)))))
+ (setq marked-window (tab-group-window-index win))
+ (mapcar (lambda (w)
+ (window-put w 'marked t)
+ (emit-marked-hook w)) marked-window))))
(define-command 'tabgroup-add-to-group tabgroup-add-to-group #:spec "%W")
--- sawfish.orgi/themes/StyleTab/theme.jl 2012-08-29 21:48:01.000000000 +0200
+++ sawfish/themes/StyleTab/theme.jl 2012-08-30 21:07:44.000000000 +0200
@@ -60,6 +60,18 @@
:options (Default Reduce Glass WixDa Smoothly Brown Darkblue Blue Pink Green)
:after-set (lambda () (color-changed)))
+(defcustom styletab-c:tabbar-marked t "Customize tabbar color if window marked to add as tab."
+ :group (appearance StyleTab:group)
+ :type boolean
+ :after-set (lambda () (botton-color-changed recolor-tab)))
+
+(defcustom styletab-c:tabbar-marked-color (get-color "#DF0000")
+ "Color of tabbar if window marked to add as tab."
+ :group (appearance StyleTab:group)
+ :type color
+ :depends styletab-c:tabbar-marked
+ :after-set (lambda () (botton-color-changed recolor-tab)))
+
(defcustom styletab-c:hightlight-tabbar nil "Also hightlighted tabbars."
:group (appearance StyleTab:group)
:type boolean
@@ -777,7 +789,6 @@
(table-set styletab-c-frame-cache img image)
image)))
-
(define (base-tables-images w)
(let ((focus (do-recolor (do-make-get-image (concat (symbol-name styletab-c:styles) "/" w "-f.png"))
(if (eq styletab-c:custom-frame-colors t)
@@ -795,6 +806,12 @@
(if (eq styletab-c:custom-frame-colors t)
(get-recolor-dark 0 styletab-c:focus-frame-color)
(get-recolor-dark 0 (get-color (nth 0 (proposals-colors)))))))
+ (focus-m (do-recolor (do-make-get-image (concat (symbol-name styletab-c:styles) "/" w "-marked-f.png"))
+ (if (eq styletab-c:tabbar-marked t)
+ styletab-c:tabbar-marked-color
+ (if (eq styletab-c:custom-frame-colors t)
+ (get-recolor-bright 20 styletab-c:focus-frame-color)
+ (get-recolor-bright 20 (get-color (nth 0 (proposals-colors))))))))
(highl (do-recolor (do-make-get-image (concat (symbol-name styletab-c:styles) "/" w "-h.png"))
(if (eq styletab-c:custom-frame-colors t)
(get-recolor-bright
@@ -804,10 +821,29 @@
(if (eq styletab-c:hightlight-tabbar t)
(/ (nth 2 (proposals-colors)) 2) 0)
(get-color (nth 0 (proposals-colors)))))))
+ (highl-m (do-recolor (do-make-get-image (concat (symbol-name styletab-c:styles) "/" w "-marked-h.png"))
+ (if (eq styletab-c:tabbar-marked t)
+ (if (eq styletab-c:hightlight-tabbar t)
+ (get-recolor-bright 20 styletab-c:tabbar-marked-color)
+ styletab-c:tabbar-marked-color)
+ (if (eq styletab-c:custom-frame-colors t)
+ (get-recolor-bright
+ (if (eq styletab-c:hightlight-tabbar t)
+ (/ (* styletab-c:active-hightlight-brighten 40) 2) 20)
+ styletab-c:focus-frame-color) (get-recolor-bright
+ (if (eq styletab-c:hightlight-tabbar t)
+ (/ (nth 2 (proposals-colors)) 2) 0)
+ (get-recolor-bright 20 (get-color (nth 0 (proposals-colors)))))))))
(inact (do-recolor (do-make-get-image (concat (symbol-name styletab-c:styles) "/" w "-i.png"))
(if (eq styletab-c:custom-frame-colors t)
(get-recolor-dark (* styletab-c:inactive-dimout 20) styletab-c:unfocus-frame-color)
(get-recolor-dark (nth 1 (proposals-colors)) (get-color (nth 0 (proposals-colors)))))))
+ (inact-m (do-recolor (do-make-get-image (concat (symbol-name styletab-c:styles) "/" w "-marked-i.png"))
+ (if (eq styletab-c:tabbar-marked t)
+ styletab-c:tabbar-marked-color
+ (if (eq styletab-c:custom-frame-colors t)
+ (get-recolor-bright 20 styletab-c:focus-frame-color)
+ (get-recolor-bright 20 (get-color (nth 0 (proposals-colors))))))))
(in-hi (do-recolor (do-make-get-image (concat (symbol-name styletab-c:styles) "/" w "-ih.png"))
(if (eq styletab-c:custom-frame-colors t)
(get-recolor-bright
@@ -818,9 +854,25 @@
(get-recolor-bright (if (eq styletab-c:hightlight-tabbar t)
(- (/ (nth 3 (proposals-colors)) 2) (nth 1 (proposals-colors)))
(- (nth 1 (proposals-colors))))
- (get-color (nth 0 (proposals-colors))))))))
+ (get-color (nth 0 (proposals-colors)))))))
+ (in-hi-m (do-recolor (do-make-get-image (concat (symbol-name styletab-c:styles) "/" w "-marked-ih.png"))
+ (if (eq styletab-c:tabbar-marked t)
+ (if (eq styletab-c:hightlight-tabbar t)
+ (get-recolor-bright 20 styletab-c:tabbar-marked-color)
+ styletab-c:tabbar-marked-color)
+ (if (eq styletab-c:custom-frame-colors t)
+ (get-recolor-bright
+ (if (eq styletab-c:hightlight-tabbar t)
+ (/ (* styletab-c:active-hightlight-brighten 40) 2) 20)
+ styletab-c:focus-frame-color) (get-recolor-bright
+ (if (eq styletab-c:hightlight-tabbar t)
+ (/ (nth 2 (proposals-colors)) 2) 0)
+ (get-recolor-bright 20 (get-color (nth 0 (proposals-colors))))))))))
(table-unset styletab-c-frame-cache w)
- (table-set styletab-c-frame-cache w `((focused . ,focus) (highlighted .. ,highl) (inactive . ,inact) (inactive-highlighted . ,in-hi)))))
+ (table-set styletab-c-frame-cache w `((focused . ,focus) (highlighted .. ,highl) (inactive . ,inact) (inactive-highlighted . ,in-hi)))
+ (table-unset styletab-c-frame-cache (concat w "-m"))
+ (table-set styletab-c-frame-cache
+ (concat w "-m") `((focused . ,focus-m) (highlighted . ,highl-m) (inactive . ,inact-m) (inactive-highlighted . ,in-hi-m)))))
(define (base-button-tables-images w)
(let ((focus (do-recolor (do-make-get-image (concat (symbol-name styletab-c:styles) "/" w "-f.png"))
@@ -1320,14 +1372,18 @@
((class . tabbar-horizontal)
(x-justify . ,(lambda (w) (- styletab-c:title-dimension 12)))
(y-justify . ,(lambda (w) (+ (/ styletab-c:title-dimension 2) -7)))
- (background . ,(lambda (w) (table-ref styletab-c-frame-cache '"top-frame-tab")))
+ (background . ,(lambda (w) (if (window-get w 'marked)
+ (table-ref styletab-c-frame-cache '"top-frame-tab-m")
+ (table-ref styletab-c-frame-cache '"top-frame-tab"))))
(foreground . ,title-colors-images)
(top-edge . ,title-edge-s)
(height . ,title-height-s)
(text . ,window-name))
((class . tabbar-horizontal-left-edge)
(foreground . ,(lambda (w) (window-icon w)))
- (background . ,(lambda (w) (table-ref styletab-c-frame-cache '"top-frame-tab-left-icon")))
+ (background . ,(lambda (w) (if (window-get w 'marked)
+ (table-ref styletab-c-frame-cache '"top-frame-tab-left-icon-m")
+ (table-ref styletab-c-frame-cache '"top-frame-tab-left-icon"))))
(cursor . hand2)
(top-edge . ,title-edge-s)
(height . ,title-height-s)
@@ -1335,7 +1391,9 @@
(y-justify . 2)
(x-justify . ,(lambda (w) (+ 3 (icon-edge w)))))
((class . tabbar-horizontal-right-edge)
- (background . ,(lambda (w) (table-ref styletab-c-frame-cache '"top-frame-tab-right")))
+ (background . ,(lambda (w) (if (window-get w 'marked)
+ (table-ref styletab-c-frame-cache '"top-frame-tab-right-m")
+ (table-ref styletab-c-frame-cache '"top-frame-tab-right"))))
(width . ,tabbar-right-edge-width)
(height . ,title-height-s)
(top-edge . ,title-edge-s))
@@ -1356,14 +1414,18 @@
((class . tabbar-horizontal)
(x-justify . ,(lambda (w) (- styletab-c:title-dimension 12)))
(y-justify . ,(lambda (w) (+ (/ styletab-c:title-dimension 2) -7)))
- (background . ,(lambda (w) (table-ref styletab-c-frame-cache '"bottom-frame-tab")))
+ (background . ,(lambda (w) (if (window-get w 'marked)
+ (table-ref styletab-c-frame-cache '"bottom-frame-tab-m")
+ (table-ref styletab-c-frame-cache '"bottom-frame-tab"))))
(foreground . ,title-colors-images)
(bottom-edge . ,title-edge-s)
(height . ,title-height-s)
(text . ,window-name))
((class . tabbar-horizontal-left-edge)
(foreground . ,(lambda (w) (window-icon w)))
- (background . ,(lambda (w) (table-ref styletab-c-frame-cache '"bottom-frame-tab-left-icon")))
+ (background . ,(lambda (w) (if (window-get w 'marked)
+ (table-ref styletab-c-frame-cache '"bottom-frame-tab-left-icon-m")
+ (table-ref styletab-c-frame-cache '"bottom-frame-tab-left-icon"))))
(cursor . hand2)
(bottom-edge . ,title-edge-s)
(height . ,title-height-s)
@@ -1371,7 +1433,9 @@
(y-justify . 2)
(x-justify . ,(lambda (w) (+ 3 (icon-edge w)))))
((class . tabbar-horizontal-right-edge)
- (background . ,(lambda (w) (table-ref styletab-c-frame-cache '"bottom-frame-tab-right")))
+ (background . ,(lambda (w) (if (window-get w 'marked)
+ (table-ref styletab-c-frame-cache '"bottom-frame-tab-right-m")
+ (table-ref styletab-c-frame-cache '"bottom-frame-tab-right"))))
(width . ,tabbar-right-edge-width)
(height . ,title-height-s)
(bottom-edge . ,title-edge-s))
@@ -1393,7 +1457,9 @@
(width . 2))
((class . tabbar-vertical-top-edge)
(foreground . ,(lambda (w) (window-icon w)))
- (background . ,(lambda (w) (table-ref styletab-c-frame-cache '"left-frame-tab-top")))
+ (background . ,(lambda (w) (if (window-get w 'marked)
+ (table-ref styletab-c-frame-cache '"left-frame-tab-top-m")
+ (table-ref styletab-c-frame-cache '"left-frame-tab-top"))))
(cursor . hand2)
(height . ,(lambda (w) (+ 2 (title-height-s w))))
(width . ,title-height-s)
@@ -1403,12 +1469,16 @@
((class . tabbar-vertical)
(x-justify . 12)
(y-justify . center)
- (background . ,(lambda (w) (table-ref styletab-c-frame-cache '"left-frame-tab")))
+ (background . ,(lambda (w) (if (window-get w 'marked)
+ (table-ref styletab-c-frame-cache '"left-frame-tab-m")
+ (table-ref styletab-c-frame-cache '"left-frame-tab"))))
(left-edge . ,title-edge-s)
(width . ,title-height-s))
((class . tabbar-vertical-bottom-edge)
(foreground . ,(lambda (w) (window-icon w)))
- (background . ,(lambda (w) (table-ref styletab-c-frame-cache '"left-frame-tab-bottom-icon")))
+ (background . ,(lambda (w) (if (window-get w 'marked)
+ (table-ref styletab-c-frame-cache '"left-frame-tab-bottom-icon-m")
+ (table-ref styletab-c-frame-cache '"left-frame-tab-bottom-icon"))))
(left-edge . ,title-edge-s)
(height . ,title-height-s)
(width . ,title-height-s)
@@ -1431,7 +1501,9 @@
(width . 2))
((class . tabbar-vertical-top-edge)
(foreground . ,(lambda (w) (window-icon w)))
- (background . ,(lambda (w) (table-ref styletab-c-frame-cache '"right-frame-tab-top")))
+ (background . ,(lambda (w) (if (window-get w 'marked)
+ (table-ref styletab-c-frame-cache '"right-frame-tab-top-m")
+ (table-ref styletab-c-frame-cache '"right-frame-tab-top"))))
(cursor . hand2)
(height . ,(lambda (w) (+ 2 (title-height-s w))))
(width . ,title-height-s)
@@ -1441,12 +1513,16 @@
((class . tabbar-vertical)
(x-justify . 12)
(y-justify . center)
- (background . ,(lambda (w) (table-ref styletab-c-frame-cache '"right-frame-tab")))
+ (background . ,(lambda (w) (if (window-get w 'marked)
+ (table-ref styletab-c-frame-cache '"right-frame-tab-m")
+ (table-ref styletab-c-frame-cache '"right-frame-tab"))))
(right-edge . ,title-edge-s)
(width . ,title-height-s))
((class . tabbar-vertical-bottom-edge)
(foreground . ,(lambda (w) (window-icon w)))
- (background . ,(lambda (w) (table-ref styletab-c-frame-cache '"right-frame-tab-bottom-icon")))
+ (background . ,(lambda (w) (if (window-get w 'marked)
+ (table-ref styletab-c-frame-cache '"right-frame-tab-bottom-icon-m")
+ (table-ref styletab-c-frame-cache '"right-frame-tab-bottom-icon"))))
(right-edge . ,title-edge-s)
(height . ,title-height-s)
(width . ,title-height-s)
@@ -1658,7 +1734,8 @@
(define top-frame-sticky-button
`((class . sticky-button)
(background . ,(lambda (w) (table-ref styletab-c-frame-cache '"top-frame-button")))
- (foreground . ,(lambda (w) (if (window-get w 'sticky)
+ (foreground . ,(lambda (w) (if (or (window-get w 'sticky)
+ (window-get w 'sticky-viewport))
(table-ref styletab-c-frame-cache '"top-frame-unsticky-button")
(table-ref styletab-c-frame-cache '"top-frame-sticky-button"))))
(cursor . hand2)
@@ -1669,7 +1746,8 @@
(define bottom-frame-sticky-button
`((class . sticky-button)
(background . ,(lambda (w) (table-ref styletab-c-frame-cache '"bottom-frame-button")))
- (foreground . ,(lambda (w) (if (window-get w 'sticky)
+ (foreground . ,(lambda (w) (if (or (window-get w 'sticky)
+ (window-get w 'sticky-viewport))
(table-ref styletab-c-frame-cache '"bottom-frame-unsticky-button")
(table-ref styletab-c-frame-cache '"bottom-frame-sticky-button"))))
(cursor . hand2)
@@ -1680,7 +1758,8 @@
(define left-frame-sticky-button
`((class . sticky-button)
(background . ,(lambda (w) (table-ref styletab-c-frame-cache '"left-frame-button")))
- (foreground . ,(lambda (w) (if (window-get w 'sticky)
+ (foreground . ,(lambda (w) (if (or (window-get w 'sticky)
+ (window-get w 'sticky-viewport))
(table-ref styletab-c-frame-cache '"left-frame-unsticky-button")
(table-ref styletab-c-frame-cache '"left-frame-sticky-button"))))
(cursor . hand2)
@@ -1691,7 +1770,8 @@
(define right-frame-sticky-button
`((class . sticky-button)
(background . ,(lambda (w) (table-ref styletab-c-frame-cache '"right-frame-button")))
- (foreground . ,(lambda (w) (if (window-get w 'sticky)
+ (foreground . ,(lambda (w) (if (or (window-get w 'sticky)
+ (window-get w 'sticky-viewport))
(table-ref styletab-c-frame-cache '"right-frame-unsticky-button")
(table-ref styletab-c-frame-cache '"right-frame-sticky-button"))))
(cursor . hand2)
@@ -1730,7 +1810,7 @@
(define top-frame-prev-button
`((class . previous-workspace-button)
(background . ,(lambda (w) (table-ref styletab-c-frame-cache '"top-frame-button")))
- (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-first-workspace) 1)) (window-get w 'sticky))
+ (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-first-workspace) 1)) (window-get w 'sticky) (window-get w 'sticky-viewport))
(table-ref styletab-c-frame-cache '"top-frame-prev-last-button")
(table-ref styletab-c-frame-cache '"top-frame-prev-button"))))
(cursor . hand2)
@@ -1741,7 +1821,7 @@
(define bottom-frame-prev-button
`((class . previous-workspace-button)
(background . ,(lambda (w) (table-ref styletab-c-frame-cache '"bottom-frame-button")))
- (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-first-workspace) 1)) (window-get w 'sticky))
+ (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-first-workspace) 1)) (window-get w 'sticky) (window-get w 'sticky-viewport))
(table-ref styletab-c-frame-cache '"bottom-frame-prev-last-button")
(table-ref styletab-c-frame-cache '"bottom-frame-prev-button"))))
(cursor . hand2)
@@ -1752,7 +1832,7 @@
(define left-frame-prev-button
`((class . previous-workspace-button)
(background . ,(lambda (w) (table-ref styletab-c-frame-cache '"left-frame-button")))
- (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-first-workspace) 1)) (window-get w 'sticky))
+ (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-first-workspace) 1)) (window-get w 'sticky) (window-get w 'sticky-viewport))
(table-ref styletab-c-frame-cache '"left-frame-prev-last-button")
(table-ref styletab-c-frame-cache '"left-frame-prev-button"))))
(cursor . hand2)
@@ -1763,7 +1843,7 @@
(define right-frame-prev-button
`((class . previous-workspace-button)
(background . ,(lambda (w) (table-ref styletab-c-frame-cache '"right-frame-button")))
- (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-first-workspace) 1)) (window-get w 'sticky))
+ (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-first-workspace) 1)) (window-get w 'sticky) (window-get w 'sticky-viewport))
(table-ref styletab-c-frame-cache '"right-frame-prev-last-button")
(table-ref styletab-c-frame-cache '"right-frame-prev-button"))))
(cursor . hand2)
@@ -1774,7 +1854,7 @@
(define top-frame-next-button
`((class . next-workspace-button)
(background . ,(lambda (w) (table-ref styletab-c-frame-cache '"top-frame-button")))
- (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-last-workspace) 1)) (window-get w 'sticky))
+ (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-last-workspace) 1)) (window-get w 'sticky) (window-get w 'sticky-viewport))
(table-ref styletab-c-frame-cache '"top-frame-next-last-button")
(table-ref styletab-c-frame-cache '"top-frame-next-button"))))
(cursor . hand2)
@@ -1785,7 +1865,7 @@
(define bottom-frame-next-button
`((class . next-workspace-button)
(background . ,(lambda (w) (table-ref styletab-c-frame-cache '"bottom-frame-button")))
- (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-last-workspace) 1)) (window-get w 'sticky))
+ (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-last-workspace) 1)) (window-get w 'sticky) (window-get w 'sticky-viewport))
(table-ref styletab-c-frame-cache '"bottom-frame-next-last-button")
(table-ref styletab-c-frame-cache '"bottom-frame-next-button"))))
(cursor . hand2)
@@ -1796,7 +1876,7 @@
(define left-frame-next-button
`((class . next-workspace-button)
(background . ,(lambda (w) (table-ref styletab-c-frame-cache '"left-frame-button")))
- (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-last-workspace) 1)) (window-get w 'sticky))
+ (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-last-workspace) 1)) (window-get w 'sticky) (window-get w 'sticky-viewport))
(table-ref styletab-c-frame-cache '"left-frame-next-last-button")
(table-ref styletab-c-frame-cache '"left-frame-next-button"))))
(cursor . hand2)
@@ -1807,7 +1887,7 @@
(define right-frame-next-button
`((class . next-workspace-button)
(background . ,(lambda (w) (table-ref styletab-c-frame-cache '"right-frame-button")))
- (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-last-workspace) 1)) (window-get w 'sticky))
+ (foreground . ,(lambda (w) (if (or (window-in-workspace-p w (- (get-last-workspace) 1)) (window-get w 'sticky) (window-get w 'sticky-viewport))
(table-ref styletab-c-frame-cache '"right-frame-next-last-button")
(table-ref styletab-c-frame-cache '"right-frame-next-button"))))
(cursor . hand2)
@@ -2505,6 +2585,10 @@
(when (eq (window-get w 'current-frame-style) theme-name)
(reframe-window w))))
+(define (reframe-marked w)
+ (when (eq (window-get w 'current-frame-style) theme-name)
+ (reframe-window w)))
+
;; reframe-with-style, resize bottons
;; reset icon cache
(define (clear-icon-cache-reframe)
@@ -2571,6 +2655,7 @@
(add-frame-style theme-name get-frame)
+(call-after-state-changed '(marked) reframe-marked)
(call-after-state-changed '(maximized sticky fixed-position stacking) reframe-one)
(add-hook 'remove-from-workspace-hook reframe-one)
Attachment:
signature.asc
Description: PGP signature
| Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |