Hi, On Tue, 05 Oct 2010 12:51:40 +0900 (JST) wrote Teika Kazura <teika lavabit com>: ... >On Sun, 3 Oct 2010 08:30:37 +0200, fuchur wrote: >>> Would be nice if the tab-options dec-with and margin would be set by themes, >>>instead of users having to change them for each theme. >> >> The problem is i don't know how to set "require" or "open" for >> theme.jl in tab.jl, to get the values from theme.jl something like: >> "(require 'the.current.themes.file)" > >It's not necessary. Simply do `setq' in theme.jl. >And tab.jl has to change them from defcustom to defvar, or maybe it's >better to provide a new `tab-pixel-adjust' function, so that these >values are hidden from the tab.jl. > >Regards, >Teika (Teika kazura) ... I have try it some times but it doesn't work here. Here are to patches, tabbar.patch for tab.jl and sawfish-default-themes.patch for the tabthemes in sawfish. I have use setq in themes and also try defvar and other in tab.jl. But if you compiled tab.jl you got errors and it doesn't work any more. -- Regards, Fuchur GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53 C116 E5BC 70D5 B8D7 B2B0
diff -urNad sawfish.orgi/themes/Elberg-tabbed/theme.jl sawfish/themes/Elberg-tabbed/theme.jl --- sawfish.orgi/themes/Elberg-tabbed/theme.jl 2010-09-23 19:26:57.000000000 +0200 +++ sawfish/themes/Elberg-tabbed/theme.jl 2010-09-23 21:41:03.000000000 +0200 @@ -237,7 +237,7 @@ ;; tab left curve ((background . ,top-lefthollow-images) (top-edge . -19) - (class . tab-l)) + (class . tabbar-left-edge)) ;; tab ( @@ -249,12 +249,12 @@ (text . ,window-name) ;(x-justify . 4) ;(y-justify . center) - (class . tab)) + (class . tabbar)) ;; tab right curve ((background . ,top-righthollow-images) (top-edge . -19) - (class . tab-r)) + (class . tabbar-right-edge)) )) @@ -329,7 +329,7 @@ ;; tab left curve ((background . ,top-lefthollow-images) (top-edge . -19) - (class . tab-l)) + (class . tabbar-left-edge)) ;; tab ( @@ -341,12 +341,12 @@ (text . ,window-name) ;(x-justify . 4) ;(y-justify . center) - (class . tab)) + (class . tabbar)) ;; tab right curve ((background . ,top-righthollow-images) (top-edge . -19) - (class . tab-r)) + (class . tabbar-right-edge)) )) @@ -442,6 +442,35 @@ ((shaped) shaped-frame) ((shaped-transient) shaped-transient-frame)))) - (call-after-property-changed - '(WM_NAME _NET_WM_NAME) (lambda (w prop state) - (reframe-window w)))) + (define create-frames + (lambda () + (defvar tabbar-left-dec-width nil) + (defvar tabbar-right-dec-width nil) + (defvar tabbar-left-margin nil) + (defvar tabbar-right-margin nil) + (defvar tabbar-left-margin-transient nil) + (defvar tabbar-right-margin-transient nil) + (setq tabbar-left-dec-width 11) + (setq tabbar-right-dec-width 11) + (setq tabbar-left-margin 16) + (setq tabbar-right-margin 16) + (setq tabbar-left-margin-transient 0) + (setq tabbar-right-margin-transient 0))) + + (create-frames) + + (define reframe-one + (lambda (w) + (if (eq (window-get w 'current-frame-style) 'Elberg-tabbed) + (create-frames + (rebuild-frame w)) + (rebuild-frame w)))) + + (add-hook + 'after-framing-hook + (lambda (w) + (if (eq (window-get w 'current-frame-style) 'Elberg-tabbed) + (create-frames + (rebuild-frame w))))) + + (call-after-property-changed '(_NET_WM_STATE) reframe-one)) diff -urNad sawfish.orgi/themes/get-S-tabbed/theme.jl sawfish/themes/get-S-tabbed/theme.jl --- sawfish.orgi/themes/get-S-tabbed/theme.jl 2010-09-23 19:26:57.000000000 +0200 +++ sawfish/themes/get-S-tabbed/theme.jl 2010-09-23 21:40:56.000000000 +0200 @@ -2,7 +2,6 @@ ;; Based off of my arctic Enlightenment theme.... - (let* ( ;;(font (get-font "-*-lucida-medium-r-normal-*-*-100-*-*-p-*-iso8859-1")) @@ -243,17 +242,17 @@ (top-edge . -16) ;;(left-edge . 15) ;;(right-edge . 40) - (class . tab)) + (class . tabbar)) ;; tab ((background . ,title-left-l-images) (top-edge . -16) - (class . tab-l)) + (class . tabbar-left-edge)) ;; tab ((background . ,title-left-r-images) (top-edge . -16) - (class . tab-r)) + (class . tabbar-right-edge)) ((background . ,menu-images) (top-edge . -12) @@ -311,10 +310,35 @@ ((shaped) shaped-frame) ((shaped-transient) shaped-transient-frame)))) - ;; TODO: figure out how to store this info in this file correctly - ;;(custom-set-typed-variable'tab-left-dec-width '5 'number) - ;;(custom-set-typed-variable'tab-right-dec-width '5 'number) - ;;(custom-set-typed-variable'tab-left-margin '14 'number) - ;;(custom-set-typed-variable'tab-right-margin '38 'number) + (define create-frames + (lambda () + (defvar tabbar-left-dec-width nil) + (defvar tabbar-right-dec-width nil) + (defvar tabbar-left-margin nil) + (defvar tabbar-right-margin nil) + (defvar tabbar-left-margin-transient nil) + (defvar tabbar-right-margin-transient nil) + (setq tabbar-left-dec-width 5) + (setq tabbar-right-dec-width 5) + (setq tabbar-left-margin 14) + (setq tabbar-right-margin 38) + (setq tabbar-left-margin-transient 0) + (setq tabbar-right-margin-transient 0))) - ) + (create-frames) + + (define reframe-one + (lambda (w) + (if (eq (window-get w 'current-frame-style) 'get-S-tabbed) + (create-frames + (rebuild-frame w)) + (rebuild-frame w)))) + + (add-hook + 'after-framing-hook + (lambda (w) + (if (eq (window-get w 'current-frame-style) 'get-S-tabbed) + (create-frames + (rebuild-frame w))))) + + (call-after-property-changed '(_NET_WM_STATE) reframe-one))
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 2010-09-24 17:31:56.000000000 +0200 +++ sawfish/lisp/sawfish/wm/tabs/tab.jl 2010-09-24 17:33:10.000000000 +0200 @@ -46,36 +46,6 @@ (defgroup tabs "Tabs") - (defcustom tab-left-dec-width 11 "Width of tab's left-edge decoration" - :group tabs - :type number - :after-set reframe-all-windows) - - (defcustom tab-right-dec-width 11 "Width of tab's right-edge decoration" - :group tabs - :type number - :after-set reframe-all-windows) - - (defcustom tab-left-margin 66 "Width of tab area's left-edge decoration" - :group tabs - :type number - :after-set reframe-all-windows) - - (defcustom tab-right-margin 68 "Width of tab area's right-edge decoration" - :group tabs - :type number - :after-set reframe-all-windows) - - (defcustom tab-left-margin-transient 44 "Width of tab area's left-edge-transient decoration" - :group tabs - :type number - :after-set reframe-all-windows) - - (defcustom tab-right-margin-transient 24 "Width of tab area's right-edge-transient decoration" - :group tabs - :type number - :after-set reframe-all-windows) - (defcustom tab-raise-on-hover nil "Raise Tabs on Hover" :group tabs @@ -94,13 +64,13 @@ (margin-l (if (or (eq (window-get win 'type) 'transient) (eq (window-get win 'type) 'shaped-transient)) - tab-left-margin-transient - tab-left-margin)) + tabbar-left-margin-transient + tabbar-left-margin)) (margin-r (if (or (eq (window-get win 'type) 'transient) (eq (window-get win 'type) 'shaped-transient)) - tab-right-margin-transient - tab-right-margin)) + tabbar-right-margin-transient + tabbar-right-margin)) (tabarea-width (- dim-x margin-l margin-r)) (tabarea-height (- dim-y margin-l margin-r)) (numtabs (length (tab-group-window-list group))) @@ -117,23 +87,23 @@ (define (tab-title-text-width win) "Width of the title text area is the tabwidth minus decorations" (let* ((tabwidth (nth 6 (get-tab-pos win)))) - (+ tabwidth - (- tab-left-dec-width) - (- tab-right-dec-width)))) - + (+ tabwidth + (- tabbar-left-dec-width) + (- tabbar-right-dec-width)))) + (define (tab-title-text-height win) "Height of the title text area is the tabheight minus decorations by a left or right titlebar themes" (let* ((tabheight (nth 9 (get-tab-pos win)))) (when (> tabheight 0) (+ tabheight - (- tab-left-dec-width) - (- tab-right-dec-width))))) + (- tabbar-left-dec-width) + (- tabbar-right-dec-width))))) (define (tab-left-edge win) "Compute left edge of tab" (let* ((left (nth 4 (get-tab-pos win))) (margin-l (nth 2 (get-tab-pos win)))) - (+ left margin-l))) + (+ left margin-l))) (define (tab-bottom-edge win) "Compute bottom edge of tab by a left or right titlebar themes" @@ -147,7 +117,7 @@ (margin-l (nth 2 (get-tab-pos win))) (dim-x (nth 0 (get-tab-pos win)))) (when (> dim-x margin-l) ;; don't display outside from frame - (+ right margin-l (- tab-right-dec-width))))) + (+ right margin-l (- tabbar-right-dec-width))))) (define (tab-top-dec-pos win) "Compute position of tab's top-edge decoration by a left or right titlebar themes" @@ -156,54 +126,54 @@ (dim-y (nth 1 (get-tab-pos win)))) (when (> dim-y margin-l) ;; don't display outside from frame ;; use double size for icon support - (+ top margin-l (- (* tab-right-dec-width 2)))))) + (+ top margin-l (- (* tabbar-right-dec-width 2)))))) (define (tab-title-left-edge win) "Compute left edge of tab" - (+ (tab-left-edge win) tab-left-dec-width)) + (+ (tab-left-edge win) tabbar-left-dec-width)) (define (tab-title-bottom-edge win) "Compute bottom edge of tab by a left or right titlebar themes" - (+ (tab-bottom-edge win) tab-left-dec-width)) + (+ (tab-bottom-edge win) tabbar-left-dec-width)) - ;; new class : tab - (define-frame-class 'tab + ;; new classes tabs : tabbar-left-edge tabbar tabbar-right-edge + ;; + (define-frame-class 'tabbar-left-edge + `((cursor . left_ptr) + (left-edge . ,tab-left-edge)) t) + + (define-frame-class 'tabbar `((cursor . left_ptr) (x-justify . 12) (y-justify . center) (left-edge . ,tab-title-left-edge) (width . ,tab-title-text-width))) - (set-frame-part-value 'tab 'keymap 'title-keymap) + (set-frame-part-value 'tabbar 'keymap 'title-keymap) - ;; side tab arena - (define-frame-class 'tab-s + (define-frame-class 'tabbar-right-edge + `((cursor . left_ptr) + (left-edge . ,tab-right-dec-pos)) t) + + ;; new classes tabs on side : tabbar-side-top-edge tabbar-side tabbar-side-bottom-edge + ;; + (define-frame-class 'tabbar-side-top-edge + `((cursor . left_ptr) + (bottom-edge . ,tab-top-dec-pos)) t) + + (define-frame-class 'tabbar-side `((cursor . left_ptr) (x-justify . 12) (y-justify . center) (bottom-edge . ,tab-title-bottom-edge) (height . ,tab-title-text-height))) - (set-frame-part-value 'tab-s 'keymap 'title-keymap) + (set-frame-part-value 'tabbar-side 'keymap 'title-keymap) - (define-frame-class 'tab-l - `((cursor . left_ptr) - (left-edge . ,tab-left-edge)) t) - - ;; side tab arena bottom end - (define-frame-class 'tab-ls + (define-frame-class 'tabbar-side-bottom-edge `((cursor . left_ptr) (bottom-edge . ,tab-bottom-edge)) t) - (define-frame-class 'tab-r - `((cursor . left_ptr) - (left-edge . ,tab-right-dec-pos)) t) - - ;; side tab arena top end - (define-frame-class 'tab-rs - `((cursor . left_ptr) - (bottom-edge . ,tab-top-dec-pos)) t) - (define (mygroup win) (if (marked-windows) (progn 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 2010-09-24 17:31:56.000000000 +0200 +++ sawfish/lisp/sawfish/wm/tabs/tabgroup.jl 2010-09-24 17:39:23.000000000 +0200 @@ -116,6 +116,7 @@ (tab-build-group (tab-group-position old) (tab-group-dimensions old) l)) ;; releas from sawfish "default" group adopt by tab-group-window (add-window-to-new-group win) + (tab-refresh-group win 'frame) (window-put win 'fixed-position nil) (tab-refresh-group (car l) 'frame)))) @@ -224,6 +225,7 @@ (window-put w 'frame-style group-frame-style) ;; ugly hack, don't know why it's needed, but new groups are ;; listed with pos (0,0): + (tab-refresh-group w 'reframe) (tab-refresh-group win 'move) (add-window-to-group w group-id) (tab-put-window-in-group w index)
Attachment:
signature.asc
Description: PGP signature