[sawfish] Tabs-NG: - add support for tabbed windows to send-to/copy-to-next/previous-workspace - add tab-group
- From: Christopher Bratusek <chrisb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sawfish] Tabs-NG: - add support for tabbed windows to send-to/copy-to-next/previous-workspace - add tab-group
- Date: Fri, 18 Feb 2011 18:38:51 +0000 (UTC)
commit e293609719fe14cb751c3459d1db77a22b7674cf
Author: Christopher Roy Bratusek <zanghar freenet de>
Date: Fri Feb 18 19:36:53 2011 +0100
Tabs-NG:
- add support for tabbed windows to send-to/copy-to-next/previous-workspace
- add tab-group-windows-index (returns list of tabbed windows)
- don't add a window to tabgroup, if it already exists on another workspace
lisp/sawfish/wm/tabs/tabgroup.jl | 82 +++++++++++++++++++++----------------
lisp/sawfish/wm/workspace.jl | 26 +++++++-----
themes/StyleTab/theme.jl | 8 ++--
3 files changed, 66 insertions(+), 50 deletions(-)
---
diff --git a/lisp/sawfish/wm/tabs/tabgroup.jl b/lisp/sawfish/wm/tabs/tabgroup.jl
index 871ea19..82c41dc 100644
--- a/lisp/sawfish/wm/tabs/tabgroup.jl
+++ b/lisp/sawfish/wm/tabs/tabgroup.jl
@@ -29,6 +29,7 @@
tab-find-window
tab-rank
tab-group-window-list
+ tab-group-windows-index
tab-group-window)
(open rep
@@ -112,6 +113,12 @@
(t
(loop (+ index 1))))))
+ (define (tab-group-windows-index win)
+ "Return the windows of the group containing win."
+ (let* ((index (tab-window-group-index win))
+ (wins (tab-group-window-list (nth index tab-groups))))
+ wins))
+
(define (tab-rank elem list)
(if (eq elem (car list))
0
@@ -235,41 +242,44 @@ sticky, unsticky, fixed-position."
;; Entry points
(define (tab-group-window w win)
"Add window W to tabgroup containing WIN."
- ;; from tabgroup to tabgroup
- (when (window-tabbed-p w)
- (tab-delete-window-from-tab-groups w))
- ;; sort windows/tabs (depth)
- (tab-refresh-group win 'raise)
- (raise-window w)
- (set-input-focus w)
- (let* ((index (tab-window-group-index win))
- (index2 (tab-window-group-index w))
- ;; adopt window settings for the new tab
- (group-frame-style (window-get win 'frame-style))
- (group-frame-type (window-get win 'type))
- (group-frame-sticky (window-get win 'sticky))
- (group-frame-fixed-position (window-get win 'fixed-position))
- (group-frame-title-position (window-get win 'title-position))
- (group-frame-depth (window-get win 'depth)))
- (when (not (eq index index2))
- (if (window-get w 'shaded) (unshade-window w))
- (if (window-get win 'shaded) (unshade-window win))
- (window-put w 'frame-style group-frame-style)
- (window-put w 'type group-frame-type)
- (window-put w 'title-position group-frame-title-position)
- (window-put w 'sticky group-frame-sticky)
- (window-put w 'depth group-frame-depth)
- (window-put w 'fixed-position group-frame-fixed-position)
- ;; reframe w here, tab-refresh-group expectet
- ;; the same frame for w and win
- (reframe-window w)
- (tab-refresh-group win 'move)
- (tab-put-window-in-group w index)
- (tab-delete-window-from-group w index2)
- (tab-refresh-group win 'frame)
- (tab-refresh-group w 'move)
- (if (not (window-tabbed-p win)) (window-put win 'tabbed t))
- (window-put w 'tabbed t))))
+ ;; don't add a window as tab, if it exists
+ ;; on another workspace or viewport
+ (when (not (cdr (window-get win 'workspaces)))
+ ;; from tabgroup to tabgroup
+ (when (window-tabbed-p w)
+ (tab-delete-window-from-tab-groups w))
+ ;; sort windows/tabs (depth)
+ (tab-refresh-group win 'raise)
+ (raise-window w)
+ (set-input-focus w)
+ (let* ((index (tab-window-group-index win))
+ (index2 (tab-window-group-index w))
+ ;; adopt window settings for the new tab
+ (group-frame-style (window-get win 'frame-style))
+ (group-frame-type (window-get win 'type))
+ (group-frame-sticky (window-get win 'sticky))
+ (group-frame-fixed-position (window-get win 'fixed-position))
+ (group-frame-title-position (window-get win 'title-position))
+ (group-frame-depth (window-get win 'depth)))
+ (when (not (eq index index2))
+ (if (window-get w 'shaded) (unshade-window w))
+ (if (window-get win 'shaded) (unshade-window win))
+ (window-put w 'frame-style group-frame-style)
+ (window-put w 'type group-frame-type)
+ (window-put w 'title-position group-frame-title-position)
+ (window-put w 'sticky group-frame-sticky)
+ (window-put w 'depth group-frame-depth)
+ (window-put w 'fixed-position group-frame-fixed-position)
+ ;; reframe w here, tab-refresh-group expectet
+ ;; the same frame for w and win
+ (reframe-window w)
+ (tab-refresh-group win 'move)
+ (tab-put-window-in-group w index)
+ (tab-delete-window-from-group w index2)
+ (tab-refresh-group win 'frame)
+ (tab-refresh-group w 'move)
+ (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."
@@ -357,5 +367,5 @@ sticky, unsticky, fixed-position."
(add-hook 'add-to-workspace-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'frame))))
(add-hook 'destroy-notify-hook tab-delete-window-from-tab-groups))
- (gaol-add tab-refresh-group)
+ (gaol-add tab-refresh-group tab-group-windows-index)
)
diff --git a/lisp/sawfish/wm/workspace.jl b/lisp/sawfish/wm/workspace.jl
index 438e7c1..f648c89 100644
--- a/lisp/sawfish/wm/workspace.jl
+++ b/lisp/sawfish/wm/workspace.jl
@@ -692,19 +692,25 @@ a window"
(define (send-to-next-workspace w count #!optional copy select)
"Move the window to the next workspace."
+ (require 'sawfish.wm.tabs.tabgroup)
(ws-call-with-workspace
(lambda (space)
(let ((was-focused (eq w (input-focus)))
- (orig-space (if (window-in-workspace-p
- w current-workspace)
- current-workspace
- (car (window-workspaces w)))))
- (when orig-space
- (copy-window-to-workspace w orig-space space was-focused)
- (when select
- (select-workspace space was-focused))
- (unless copy
- (move-window-to-workspace w orig-space space was-focused)))))
+ (orig-space (if (window-in-workspace-p
+ w current-workspace)
+ current-workspace
+ (car (window-workspaces w))))
+ (wins (tab-group-windows-index w)))
+ (when orig-space
+ (mapcar (lambda (w)
+ (copy-window-to-workspace w orig-space space)) wins)
+ (when select
+ (select-workspace space was-focused))
+ (unless copy
+ (mapcar (lambda (w)
+ (move-window-to-workspace w orig-space space)) wins))
+ (when (and was-focused (window-visible-p w))
+ (set-input-focus w)))))
count workspace-send-boundary-mode))
(define (send-to-previous-workspace w count #!optional copy select)
diff --git a/themes/StyleTab/theme.jl b/themes/StyleTab/theme.jl
index e2195bd..181c3ff 100644
--- a/themes/StyleTab/theme.jl
+++ b/themes/StyleTab/theme.jl
@@ -540,14 +540,14 @@
(defvar prev-button-keymap
(bind-keys (make-keymap)
- "Button3-Off" 'send-group-to-next-workspace
+ "Button3-Off" 'send-to-next-workspace
"Button2-Click" 'popup-workspace-list
- "Button1-Off" 'send-group-to-previous-workspace))
+ "Button1-Off" 'send-to-previous-workspace))
(defvar next-button-keymap
(bind-keys (make-keymap)
- "Button3-Off" 'send-group-to-previous-workspace
+ "Button3-Off" 'send-to-previous-workspace
"Button2-Click" 'popup-workspace-list
- "Button1-Off" 'send-group-to-next-workspace))
+ "Button1-Off" 'send-to-next-workspace))
(define-frame-class 'prev-button '((keymap . prev-button-keymap)))
(define-frame-class 'next-button '((keymap . next-button-keymap)))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]