Japanese translation of message catalog for Sawfish Window-Manager
修订版 | f309e60ed5c4bd7714069aea917b0a2db04159f1 (tree) |
---|---|
时间 | 1999-07-26 00:00:38 |
作者 | john <john> |
Commiter | john |
(cycle-through-workspaces, delete-workspaces-when-empty,
uniconify-to-current-workspace, static-workspace-menus): new variables
(workspace-menu, window-menu): dynamic menu constructors
(iconify-window, uniconify-window): new commands
@@ -1,4 +1,5 @@ | ||
1 | 1 | ;; workspace.jl -- similar to virtual desktops |
2 | +;; $Id$ | |
2 | 3 | |
3 | 4 | (provide 'workspace) |
4 | 5 |
@@ -6,6 +7,22 @@ | ||
6 | 7 | |
7 | 8 | (defvar ws-current-workspace nil) |
8 | 9 | |
10 | +(defvar cycle-through-workspaces nil | |
11 | + "When non-nil, moving through workspaces is cyclical, instead of stopping | |
12 | +when the first or last has been reached.") | |
13 | + | |
14 | +(defvar delete-workspaces-when-empty t | |
15 | + "When non-nil, workspaces are immediately deleted once they contain no | |
16 | +windows.") | |
17 | + | |
18 | +(defvar uniconify-to-current-workspace t | |
19 | + "When non-nil, windows that are uniconified appear on the current | |
20 | +workspace.") | |
21 | + | |
22 | +(defvar static-workspace-menus | |
23 | + '(("Next" next-workspace) | |
24 | + ("Previous" previous-workspace))) | |
25 | + | |
9 | 26 | |
10 | 27 | ;; Low level functions |
11 | 28 |
@@ -13,7 +30,9 @@ | ||
13 | 30 | (defun ws-add-window-to-space (w space) |
14 | 31 | (rplacd space (nconc (cdr space) (list w))) |
15 | 32 | (window-put w 'workspace space) |
16 | - (when (and ws-current-workspace (eq space ws-current-workspace)) | |
33 | + (when (and ws-current-workspace | |
34 | + (eq space ws-current-workspace) | |
35 | + (not (window-get w 'iconified))) | |
17 | 36 | (show-window w))) |
18 | 37 | |
19 | 38 | (defun ws-add-window (w) |
@@ -25,14 +44,16 @@ | ||
25 | 44 | (setq ws-workspaces (list ws-current-workspace))) |
26 | 45 | (rplacd ws-current-workspace |
27 | 46 | (nconc (delq w (cdr ws-current-workspace)) (list w)))) |
28 | - (window-put w 'workspace ws-current-workspace))) | |
47 | + (window-put w 'workspace ws-current-workspace) | |
48 | + (unless (window-visible-p w) | |
49 | + (show-window w)))) | |
29 | 50 | |
30 | 51 | (defun ws-remove-window (w) |
31 | 52 | (let |
32 | 53 | ((space (window-get w 'workspace))) |
33 | 54 | (when space |
34 | 55 | (rplacd space (delq w (cdr space))) |
35 | - (when (null (cdr space)) | |
56 | + (when (and delete-workspaces-when-empty (null (cdr space))) | |
36 | 57 | ;; workspace is now empty |
37 | 58 | (when (eq ws-current-workspace space) |
38 | 59 | (ws-switch-workspace (or (nth 1 (memq space ws-workspaces)) |
@@ -63,7 +84,6 @@ | ||
63 | 84 | (or tem (and cycle (car ws-workspaces)))))) |
64 | 85 | |
65 | 86 | (defun ws-find-previous-workspace (&optional cycle) |
66 | - (interactive) | |
67 | 87 | (when (cdr ws-workspaces) |
68 | 88 | (let |
69 | 89 | ((tem ws-workspaces)) |
@@ -73,25 +93,78 @@ | ||
73 | 93 | (car tem))))) |
74 | 94 | |
75 | 95 | (defun ws-switch-workspace (space) |
76 | - (when ws-current-workspace | |
77 | - (mapc 'hide-window (cdr ws-current-workspace)) | |
78 | - (call-hook 'leave-workspace-hook (list ws-current-workspace))) | |
79 | - (setq ws-current-workspace space) | |
80 | - (when ws-current-workspace | |
81 | - (mapc 'show-window (cdr ws-current-workspace)) | |
82 | - (call-hook 'enter-workspace-hook (list ws-current-workspace)))) | |
96 | + (unless (eq ws-current-workspace space) | |
97 | + (when ws-current-workspace | |
98 | + (mapc 'hide-window (cdr ws-current-workspace)) | |
99 | + (call-hook 'leave-workspace-hook (list ws-current-workspace))) | |
100 | + (setq ws-current-workspace space) | |
101 | + (when ws-current-workspace | |
102 | + (mapc #'(lambda (w) | |
103 | + (unless (window-get w 'iconified) | |
104 | + (show-window w))) (cdr ws-current-workspace)) | |
105 | + (call-hook 'enter-workspace-hook (list ws-current-workspace))))) | |
106 | + | |
107 | + | |
108 | +;; menu constructors | |
109 | + | |
110 | +(defun workspace-menu () | |
111 | + (let | |
112 | + ((tem ws-workspaces) | |
113 | + (i 0) | |
114 | + menu) | |
115 | + (while tem | |
116 | + (setq menu (cons (list (format nil "space %d%s" | |
117 | + (1+ i) | |
118 | + (if (eq (car tem) ws-current-workspace) | |
119 | + " *" "")) | |
120 | + `(lambda () | |
121 | + (ws-switch-workspace (nth ,i ws-workspaces)))) | |
122 | + menu)) | |
123 | + (setq tem (cdr tem)) | |
124 | + (setq i (1+ i))) | |
125 | + (nconc (nreverse menu) (list nil) static-workspace-menus))) | |
126 | + | |
127 | +(defun window-menu () | |
128 | + (let | |
129 | + (menu space win name) | |
130 | + (setq space ws-workspaces) | |
131 | + (while space | |
132 | + (setq win (cdr (car space))) | |
133 | + (while win | |
134 | + (when (window-mapped-p (car win)) | |
135 | + (setq name (window-name (car win))) | |
136 | + (setq menu (cons (list (concat | |
137 | + (and (window-get (car win) 'iconified) ?\[) | |
138 | + (if (> (length name) 20) | |
139 | + (concat (substring name 0 20) "...") | |
140 | + name) | |
141 | + (and (window-get (car win) 'iconified) ?\]) | |
142 | + (and (eq (input-focus) (car win)) " *")) | |
143 | + `(lambda () | |
144 | + (display-window | |
145 | + (get-window-by-id | |
146 | + ,(window-id (car win)))))) | |
147 | + menu))) | |
148 | + (setq win (cdr win))) | |
149 | + (setq space (cdr space)) | |
150 | + (when space | |
151 | + (setq menu (cons nil menu)))) | |
152 | + (nreverse menu))) | |
83 | 153 | |
84 | 154 | |
85 | 155 | ;; Commands |
86 | 156 | |
87 | 157 | (defun next-workspace () |
158 | + "Display the next workspace." | |
88 | 159 | (interactive) |
89 | 160 | (let |
90 | - ((space (ws-find-next-workspace t))) | |
161 | + ((space (ws-find-next-workspace cycle-through-workspaces))) | |
91 | 162 | (when space |
92 | 163 | (ws-switch-workspace space)))) |
93 | 164 | |
94 | 165 | (defun send-to-next-workspace (window) |
166 | + "Move WINDOW to the next workspace. If no next workspace exists, one will be | |
167 | +created." | |
95 | 168 | (interactive "f") |
96 | 169 | (let |
97 | 170 | ((space (or (ws-find-next-workspace) |
@@ -100,13 +173,16 @@ | ||
100 | 173 | (ws-add-window-to-space window space))) |
101 | 174 | |
102 | 175 | (defun previous-workspace () |
176 | + "Display the previous workspace." | |
103 | 177 | (interactive) |
104 | 178 | (let |
105 | - ((space (ws-find-previous-workspace t))) | |
179 | + ((space (ws-find-previous-workspace cycle-through-workspaces))) | |
106 | 180 | (when space |
107 | 181 | (ws-switch-workspace space)))) |
108 | 182 | |
109 | 183 | (defun send-to-previous-workspace (window) |
184 | + "Move WINDOW to the previous workspace. If no such workspace exists, one | |
185 | +will be created." | |
110 | 186 | (interactive "f") |
111 | 187 | (let |
112 | 188 | ((space (or (ws-find-previous-workspace) |
@@ -115,8 +191,44 @@ | ||
115 | 191 | (ws-add-window-to-space window space))) |
116 | 192 | |
117 | 193 | |
194 | +;; iconification (but without icons) | |
195 | + | |
196 | +(defun iconify-window (w) | |
197 | + (interactive "f") | |
198 | + (unless (window-get w 'iconified) | |
199 | + (window-put w 'iconified t) | |
200 | + (when (window-visible-p w) | |
201 | + (hide-window w)) | |
202 | + (call-hook 'iconify-window-hook (list w)))) | |
203 | + | |
204 | +(defun uniconify-window (w) | |
205 | + (interactive "f") | |
206 | + (when (window-get w 'iconified) | |
207 | + (window-put w 'iconified nil) | |
208 | + (cond ((eq (window-get w 'workspace) ws-current-workspace) | |
209 | + (show-window w)) | |
210 | + (uniconify-to-current-workspace | |
211 | + (ws-remove-window w) | |
212 | + (ws-add-window w))) | |
213 | + (call-hook 'uniconify-window-hook (list w)))) | |
214 | + | |
215 | +(defun display-window (w) | |
216 | + "Display the workspace containing window W." | |
217 | + (interactive "f") | |
218 | + (when w | |
219 | + (if (and (window-get w 'iconified) uniconify-to-current-workspace) | |
220 | + (uniconify-window w) | |
221 | + (let | |
222 | + ((space (window-get w 'workspace))) | |
223 | + (when (and space (not (eq space ws-current-workspace))) | |
224 | + (ws-switch-workspace space)) | |
225 | + (uniconify-window w) | |
226 | + (warp-cursor-to-window w))))) | |
227 | + | |
228 | + | |
118 | 229 | ;; initialisation |
119 | 230 | |
120 | -(add-hook 'add-window-hook 'ws-add-window t) | |
121 | -(add-hook 'destroy-notify-hook 'ws-remove-window t) | |
122 | -(mapc 'ws-add-window (managed-windows)) | |
231 | +(unless (memq 'ws-add-window add-window-hook) | |
232 | + (add-hook 'add-window-hook 'ws-add-window t) | |
233 | + (add-hook 'destroy-notify-hook 'ws-remove-window t) | |
234 | + (mapc 'ws-add-window (managed-windows))) |
@@ -1,4 +1,5 @@ | ||
1 | 1 | ;; workspace.jl -- similar to virtual desktops |
2 | +;; $Id$ | |
2 | 3 | |
3 | 4 | (provide 'workspace) |
4 | 5 |
@@ -6,6 +7,22 @@ | ||
6 | 7 | |
7 | 8 | (defvar ws-current-workspace nil) |
8 | 9 | |
10 | +(defvar cycle-through-workspaces nil | |
11 | + "When non-nil, moving through workspaces is cyclical, instead of stopping | |
12 | +when the first or last has been reached.") | |
13 | + | |
14 | +(defvar delete-workspaces-when-empty t | |
15 | + "When non-nil, workspaces are immediately deleted once they contain no | |
16 | +windows.") | |
17 | + | |
18 | +(defvar uniconify-to-current-workspace t | |
19 | + "When non-nil, windows that are uniconified appear on the current | |
20 | +workspace.") | |
21 | + | |
22 | +(defvar static-workspace-menus | |
23 | + '(("Next" next-workspace) | |
24 | + ("Previous" previous-workspace))) | |
25 | + | |
9 | 26 | |
10 | 27 | ;; Low level functions |
11 | 28 |
@@ -13,7 +30,9 @@ | ||
13 | 30 | (defun ws-add-window-to-space (w space) |
14 | 31 | (rplacd space (nconc (cdr space) (list w))) |
15 | 32 | (window-put w 'workspace space) |
16 | - (when (and ws-current-workspace (eq space ws-current-workspace)) | |
33 | + (when (and ws-current-workspace | |
34 | + (eq space ws-current-workspace) | |
35 | + (not (window-get w 'iconified))) | |
17 | 36 | (show-window w))) |
18 | 37 | |
19 | 38 | (defun ws-add-window (w) |
@@ -25,14 +44,16 @@ | ||
25 | 44 | (setq ws-workspaces (list ws-current-workspace))) |
26 | 45 | (rplacd ws-current-workspace |
27 | 46 | (nconc (delq w (cdr ws-current-workspace)) (list w)))) |
28 | - (window-put w 'workspace ws-current-workspace))) | |
47 | + (window-put w 'workspace ws-current-workspace) | |
48 | + (unless (window-visible-p w) | |
49 | + (show-window w)))) | |
29 | 50 | |
30 | 51 | (defun ws-remove-window (w) |
31 | 52 | (let |
32 | 53 | ((space (window-get w 'workspace))) |
33 | 54 | (when space |
34 | 55 | (rplacd space (delq w (cdr space))) |
35 | - (when (null (cdr space)) | |
56 | + (when (and delete-workspaces-when-empty (null (cdr space))) | |
36 | 57 | ;; workspace is now empty |
37 | 58 | (when (eq ws-current-workspace space) |
38 | 59 | (ws-switch-workspace (or (nth 1 (memq space ws-workspaces)) |
@@ -63,7 +84,6 @@ | ||
63 | 84 | (or tem (and cycle (car ws-workspaces)))))) |
64 | 85 | |
65 | 86 | (defun ws-find-previous-workspace (&optional cycle) |
66 | - (interactive) | |
67 | 87 | (when (cdr ws-workspaces) |
68 | 88 | (let |
69 | 89 | ((tem ws-workspaces)) |
@@ -73,25 +93,78 @@ | ||
73 | 93 | (car tem))))) |
74 | 94 | |
75 | 95 | (defun ws-switch-workspace (space) |
76 | - (when ws-current-workspace | |
77 | - (mapc 'hide-window (cdr ws-current-workspace)) | |
78 | - (call-hook 'leave-workspace-hook (list ws-current-workspace))) | |
79 | - (setq ws-current-workspace space) | |
80 | - (when ws-current-workspace | |
81 | - (mapc 'show-window (cdr ws-current-workspace)) | |
82 | - (call-hook 'enter-workspace-hook (list ws-current-workspace)))) | |
96 | + (unless (eq ws-current-workspace space) | |
97 | + (when ws-current-workspace | |
98 | + (mapc 'hide-window (cdr ws-current-workspace)) | |
99 | + (call-hook 'leave-workspace-hook (list ws-current-workspace))) | |
100 | + (setq ws-current-workspace space) | |
101 | + (when ws-current-workspace | |
102 | + (mapc #'(lambda (w) | |
103 | + (unless (window-get w 'iconified) | |
104 | + (show-window w))) (cdr ws-current-workspace)) | |
105 | + (call-hook 'enter-workspace-hook (list ws-current-workspace))))) | |
106 | + | |
107 | + | |
108 | +;; menu constructors | |
109 | + | |
110 | +(defun workspace-menu () | |
111 | + (let | |
112 | + ((tem ws-workspaces) | |
113 | + (i 0) | |
114 | + menu) | |
115 | + (while tem | |
116 | + (setq menu (cons (list (format nil "space %d%s" | |
117 | + (1+ i) | |
118 | + (if (eq (car tem) ws-current-workspace) | |
119 | + " *" "")) | |
120 | + `(lambda () | |
121 | + (ws-switch-workspace (nth ,i ws-workspaces)))) | |
122 | + menu)) | |
123 | + (setq tem (cdr tem)) | |
124 | + (setq i (1+ i))) | |
125 | + (nconc (nreverse menu) (list nil) static-workspace-menus))) | |
126 | + | |
127 | +(defun window-menu () | |
128 | + (let | |
129 | + (menu space win name) | |
130 | + (setq space ws-workspaces) | |
131 | + (while space | |
132 | + (setq win (cdr (car space))) | |
133 | + (while win | |
134 | + (when (window-mapped-p (car win)) | |
135 | + (setq name (window-name (car win))) | |
136 | + (setq menu (cons (list (concat | |
137 | + (and (window-get (car win) 'iconified) ?\[) | |
138 | + (if (> (length name) 20) | |
139 | + (concat (substring name 0 20) "...") | |
140 | + name) | |
141 | + (and (window-get (car win) 'iconified) ?\]) | |
142 | + (and (eq (input-focus) (car win)) " *")) | |
143 | + `(lambda () | |
144 | + (display-window | |
145 | + (get-window-by-id | |
146 | + ,(window-id (car win)))))) | |
147 | + menu))) | |
148 | + (setq win (cdr win))) | |
149 | + (setq space (cdr space)) | |
150 | + (when space | |
151 | + (setq menu (cons nil menu)))) | |
152 | + (nreverse menu))) | |
83 | 153 | |
84 | 154 | |
85 | 155 | ;; Commands |
86 | 156 | |
87 | 157 | (defun next-workspace () |
158 | + "Display the next workspace." | |
88 | 159 | (interactive) |
89 | 160 | (let |
90 | - ((space (ws-find-next-workspace t))) | |
161 | + ((space (ws-find-next-workspace cycle-through-workspaces))) | |
91 | 162 | (when space |
92 | 163 | (ws-switch-workspace space)))) |
93 | 164 | |
94 | 165 | (defun send-to-next-workspace (window) |
166 | + "Move WINDOW to the next workspace. If no next workspace exists, one will be | |
167 | +created." | |
95 | 168 | (interactive "f") |
96 | 169 | (let |
97 | 170 | ((space (or (ws-find-next-workspace) |
@@ -100,13 +173,16 @@ | ||
100 | 173 | (ws-add-window-to-space window space))) |
101 | 174 | |
102 | 175 | (defun previous-workspace () |
176 | + "Display the previous workspace." | |
103 | 177 | (interactive) |
104 | 178 | (let |
105 | - ((space (ws-find-previous-workspace t))) | |
179 | + ((space (ws-find-previous-workspace cycle-through-workspaces))) | |
106 | 180 | (when space |
107 | 181 | (ws-switch-workspace space)))) |
108 | 182 | |
109 | 183 | (defun send-to-previous-workspace (window) |
184 | + "Move WINDOW to the previous workspace. If no such workspace exists, one | |
185 | +will be created." | |
110 | 186 | (interactive "f") |
111 | 187 | (let |
112 | 188 | ((space (or (ws-find-previous-workspace) |
@@ -115,8 +191,44 @@ | ||
115 | 191 | (ws-add-window-to-space window space))) |
116 | 192 | |
117 | 193 | |
194 | +;; iconification (but without icons) | |
195 | + | |
196 | +(defun iconify-window (w) | |
197 | + (interactive "f") | |
198 | + (unless (window-get w 'iconified) | |
199 | + (window-put w 'iconified t) | |
200 | + (when (window-visible-p w) | |
201 | + (hide-window w)) | |
202 | + (call-hook 'iconify-window-hook (list w)))) | |
203 | + | |
204 | +(defun uniconify-window (w) | |
205 | + (interactive "f") | |
206 | + (when (window-get w 'iconified) | |
207 | + (window-put w 'iconified nil) | |
208 | + (cond ((eq (window-get w 'workspace) ws-current-workspace) | |
209 | + (show-window w)) | |
210 | + (uniconify-to-current-workspace | |
211 | + (ws-remove-window w) | |
212 | + (ws-add-window w))) | |
213 | + (call-hook 'uniconify-window-hook (list w)))) | |
214 | + | |
215 | +(defun display-window (w) | |
216 | + "Display the workspace containing window W." | |
217 | + (interactive "f") | |
218 | + (when w | |
219 | + (if (and (window-get w 'iconified) uniconify-to-current-workspace) | |
220 | + (uniconify-window w) | |
221 | + (let | |
222 | + ((space (window-get w 'workspace))) | |
223 | + (when (and space (not (eq space ws-current-workspace))) | |
224 | + (ws-switch-workspace space)) | |
225 | + (uniconify-window w) | |
226 | + (warp-cursor-to-window w))))) | |
227 | + | |
228 | + | |
118 | 229 | ;; initialisation |
119 | 230 | |
120 | -(add-hook 'add-window-hook 'ws-add-window t) | |
121 | -(add-hook 'destroy-notify-hook 'ws-remove-window t) | |
122 | -(mapc 'ws-add-window (managed-windows)) | |
231 | +(unless (memq 'ws-add-window add-window-hook) | |
232 | + (add-hook 'add-window-hook 'ws-add-window t) | |
233 | + (add-hook 'destroy-notify-hook 'ws-remove-window t) | |
234 | + (mapc 'ws-add-window (managed-windows))) |