[Sawfish] Re: Add new window as tab patch |
[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]
Hi, On Thu, 12 Apr 2012 06:40:24 +0200 wrote fuchur <flohtransporter@xxxxxxxxx>: >Hi, > >On Tue, 3 Apr 2012 01:24:43 +0200 >wrote fuchur <flohtransporter@xxxxxxxxx>: > >>Hi, >> >>On Fri, 30 Mar 2012 20:16:58 +0200 >>wrote fuchur <flohtransporter@xxxxxxxxx>: >> >>>Hi, >>> >>>On Wed, 28 Mar 2012 23:54:32 +0200 >>>wrote fuchur <flohtransporter@xxxxxxxxx>: >>> >>>>Hi, >>>> >>>>On Tue, 27 Mar 2012 18:51:16 +0200 >>>>wrote fuchur <flohtransporter@xxxxxxxxx>: >>>> >>>>>>Hi, >>>>>> >>>>>>On Mon, 26 Mar 2012 04:01:26 +0200 >>>>>>wrote fuchur <flohtransporter@xxxxxxxxx>: >>>>>> >>>>>>>Hi, >>>>>>> >>>>>>>Here is a patch to add a new window as tab if have one (the first >>>>>>>created if more as one) of the windows the same 'tab-group property". >>>>>>>'tab-group property can set by window-rules and also save in >>>>>>>window-history. You can choose between 12 tab-groups. If you know how >>>>>>>to grow Tab groups or "automatically" update (maybe by window-names) in >>>>>>>window-rules please send a patch. >>>>>>> >>>>>> >>>>>>Here is the same patch as above but with some bugfix. >>>>>>Need more tester/ing. >>>>>> >>>> >>>>Some Windows not call the unmap-notify-hook e.g. gimp and tabgroup >>>>will not work. This patch for local-master-branch fix that. >>>> >>> >>>Add support if the new window/tab and the tab-group not at the same >>>workspace. Apply the patch after the patch above. >>> >> >>Two bugfix patches for tabgroup.jl. Apply after 03-tabgroup-fix.patch >>and 04-tabgroup-fix.patch patches from above to the local-master branch. >> > >This patch for tabgroup allows only add "normal" windows as tabs >(ignores docks dialogs ...). > Here is a all-in-one patch (04.12.10-tabgroup-complete.patch) for tabgroup.jl from all patches from above. Apply to local-master branch. -- Regards, Fuchur GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53 C116 E5BC 70D5 B8D7 B2B0
--- sawfish/lisp/sawfish/wm/tabs/tabgroup.jl.orig 2012-04-12 21:18:08.000000000 +0200 +++ sawfish/lisp/sawfish/wm/tabs/tabgroup.jl 2012-04-12 21:14:00.000000000 +0200 @@ -55,7 +55,7 @@ (define oldgroup nil) (define tab-groups nil) (define tab-refresh-lock t) - (define release-window nil) + (define release-window t) (define last-unmap-id nil) (define in-tab-group-name nil) @@ -135,8 +135,9 @@ (define (tab-delete-window-from-tab-groups w) "Find window's group and remove it." - (if (not release-window) + (if release-window (remove-from-tab-group w)) + (setq release-window t) (when (window-tabbed-p w) (tab-delete-window-from-group w (tab-window-group-index w)) (window-put w 'fixed-position nil) @@ -247,8 +248,11 @@ (define (tab-group-window w win) "Add window W to tabgroup containing WIN." ;; don't add a window as tab, if it already - ;; exists on another workspace - (when (not (cdr (window-get win 'workspaces))) + ;; exists on another workspace or window type + ;; is not a "normal" window (e.g. dock panel ...) + (when (and (not (cdr (window-get win 'workspaces))) + (equal (aref (nth 2 (get-x-property w '_NET_WM_WINDOW_TYPE)) 0) '_NET_WM_WINDOW_TYPE_NORMAL) + (equal (aref (nth 2 (get-x-property win '_NET_WM_WINDOW_TYPE)) 0) '_NET_WM_WINDOW_TYPE_NORMAL)) (let* ((index (tab-window-group-index win)) (index2 (tab-window-group-index w)) (pos (window-position win)) @@ -273,48 +277,51 @@ (when (not (eq index index2)) ;; tabgroup to tabgroup (when (window-tabbed-p w) - (setq release-window t) - (tab-delete-window-from-tab-groups w) - (setq release-window nil)) + (setq release-window nil) + (tab-delete-window-from-tab-groups w)) (if (window-get win 'iconified) (uniconify-window win)) - (if (window-get win 'shaded) (unshade-window win)) - (setq tab-refresh-lock nil) - (if (window-get w 'iconified) (uniconify-window w)) - (if (window-get w 'shaded) (unshade-window w)) - (window-put w 'frame-style group-frame-style) - (window-put w 'type group-frame-type) - (window-put w 'focus-mode group-frame-focus-mode) - (window-put w 'gravity group-frame-gravity) - (window-put w 'title-position group-frame-title-position) - (window-put w 'sticky group-frame-sticky) - (window-put w 'sticky-viewport group-frame-sticky-viewport) - (window-put w 'never-iconify group-frame-never-iconify) - (window-put w 'depth group-frame-depth) - (window-put w 'fixed-position group-frame-fixed-position) - (window-put w 'never-maximize group-frame-never-maximize) - (window-put w 'maximized-vertically group-frame-maximized-vertically) - (window-put w 'maximized-horizontally group-frame-maximized-horizontally) - (window-put w 'maximized-fullscreen group-frame-maximized-fullscreen) - (window-put w 'unmaximized-type group-frame-unmaximized-type) - (window-put w 'unmaximized-geometry group-frame-unmaximized-geometry) - ;; reframe w here, tab-refresh-group expectet - ;; the same frame for w and win - (reframe-window w) - (tab-put-window-in-group w index) - (tab-delete-window-from-group w index2) - (resize-window-to w (car dim) (cdr dim)) - (move-window-to w (car pos) (cdr pos)) - (setq tab-refresh-lock t) - (tab-refresh-group w 'frame) - (set-input-focus w) - (if (not (window-tabbed-p win)) (window-put win 'tabbed t)) - (window-put w 'tabbed t))))) + (let ((group-frame-to-workspaces (car (window-workspaces win)))) + (if (window-get win 'shaded) (unshade-window win)) + (setq tab-refresh-lock nil) + (if (window-get w 'iconified) (uniconify-window w)) + (let ((group-frame-from-workspaces (car (window-workspaces w)))) + (if (window-get w 'shaded) (unshade-window w)) + (window-put w 'frame-style group-frame-style) + (window-put w 'type group-frame-type) + (window-put w 'focus-mode group-frame-focus-mode) + (window-put w 'gravity group-frame-gravity) + (window-put w 'title-position group-frame-title-position) + (window-put w 'sticky group-frame-sticky) + (window-put w 'sticky-viewport group-frame-sticky-viewport) + (window-put w 'never-iconify group-frame-never-iconify) + (window-put w 'depth group-frame-depth) + (window-put w 'fixed-position group-frame-fixed-position) + (window-put w 'never-maximize group-frame-never-maximize) + (window-put w 'maximized-vertically group-frame-maximized-vertically) + (window-put w 'maximized-horizontally group-frame-maximized-horizontally) + (window-put w 'maximized-fullscreen group-frame-maximized-fullscreen) + (window-put w 'unmaximized-type group-frame-unmaximized-type) + (window-put w 'unmaximized-geometry group-frame-unmaximized-geometry) + ;; reframe w here, tab-refresh-group expectet + ;; the same frame for w and win + (reframe-window w) + (tab-put-window-in-group w index) + (tab-delete-window-from-group w index2) + (resize-window-to w (car dim) (cdr dim)) + (move-window-to w (car pos) (cdr pos)) + (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)) + (setq tab-refresh-lock t) + (tab-refresh-group w 'frame) + (set-input-focus w) + (if (not (window-tabbed-p win)) (window-put win 'tabbed t)) + (window-put w 'tabbed t))))))) (define (tab-release-window w) "Release the window from its group." - (setq release-window t) - (tab-delete-window-from-tab-groups w) (setq release-window nil) + (tab-delete-window-from-tab-groups w) (tab-make-new-group w)) (define-command 'tab-release-window tab-release-window #:spec "%f") @@ -419,12 +426,18 @@ (define (in-tab-group win) "Add a new window as tab if have one (the first created if more as one) of the windows the same 'tab-group property" - (when (window-get win 'tab-group) - (setq in-tab-group-name (append in-tab-group-name (cons (cons (window-id win) (window-get win 'tab-group))))) - (let ((open-win-tabgroup (get-window-by-id (car (rassoc (window-get win 'tab-group) in-tab-group-name))))) - (if (and open-win-tabgroup - (not (eq win open-win-tabgroup))) - (tab-group-window win open-win-tabgroup))))) + (when (window-get win 'tab-group) + (setq in-tab-group-name (append in-tab-group-name (cons (cons (window-id win) (window-get win 'tab-group))))) + (let ((open-win-tabgroup (get-window-by-id (car (rassoc (window-get win 'tab-group) in-tab-group-name))))) + ;; unmap-notify-hook gets not always a window-id for all + ;; windows e.g. gimp (it will close more as one window and + ;; also not all call the unmap-notify-hook and/or we get the window-id). + ;; This next "if" will clean the list and remove the "ghosts". + (if (not (eq open-win-tabgroup nil)) + (if (not (eq win open-win-tabgroup)) + (tab-group-window win open-win-tabgroup)) + (setq in-tab-group-name (remove (rassoc (window-get win 'tab-group) in-tab-group-name) in-tab-group-name)) + (in-tab-group win))))) (define (remove-from-tab-group win) "Remove window from in-tab-group-name alist if it have a 'tab-group property"
Attachment:
signature.asc
Description: PGP signature
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |