about summary refs log tree commit diff
path: root/exwm.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-07-19T02·30+0800
committerChris Feng <chris.w.feng@gmail.com>2016-07-19T02·30+0800
commit622618ac6e401857b335b7e5dd1969cb9e1f948b (patch)
tree3078eed712ceeec916d83ec951f6d3c50fcbb010 /exwm.el
parent73d890aad4e06cc722a00ed40532a7df07a83550 (diff)
Improve the handling of workspaces
* exwm-workspace.el (exwm-workspace--prompt-for-workspace):
Add an optional argument to modify prompt.
(exwm-workspace-switch, exwm-workspace-swap)
(exwm-workspace-move, exwm-workspace-move-window): Use it.

* exwm-workspace.el (exwm-workspace-number): Re-introduce the variable
(now it stands for the initial workspace number).
(exwm-workspace--init): Create remaining initial workspaces.

* exwm-workspace.el (exwm-workspace-add, exwm-workspace-delete):
New commands for adding/deleting workspaces.
(exwm-workspace--switch-map): Add "+"/"-" to increase/descrease
workspace number.

* exwm-workspace.el (exwm-workspace-switch): Automatically add missing
workspaces.

* exwm.el (exwm--on-ClientMessage): Support _NET_NUMBER_OF_DESKTOPS
client message for adjusting workspace number.
Diffstat (limited to 'exwm.el')
-rw-r--r--exwm.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/exwm.el b/exwm.el
index 9151fdc5c38c..f7d027ebcfc2 100644
--- a/exwm.el
+++ b/exwm.el
@@ -325,6 +325,17 @@
           id (slot-value obj 'window)
           data (slot-value (slot-value obj 'data) 'data32))
     (cond
+     ;; _NET_NUMBER_OF_DESKTOPS.
+     ((= type xcb:Atom:_NET_NUMBER_OF_DESKTOPS)
+      (let ((current (exwm-workspace--count))
+            (requested (elt data 0)))
+        ;; Only allow increasing/decreasing the workspace number by 1.
+        (cond
+         ((< current requested)
+          (make-frame))
+         ((and (> current requested)
+               (> current 1))
+          (delete-frame (car (last exwm-workspace--list)))))))
      ;; _NET_CURRENT_DESKTOP.
      ((= type xcb:Atom:_NET_CURRENT_DESKTOP)
       (exwm-workspace-switch (elt data 0)))