about summary refs log tree commit diff
path: root/exwm.el
diff options
context:
space:
mode:
Diffstat (limited to 'exwm.el')
-rw-r--r--exwm.el29
1 files changed, 20 insertions, 9 deletions
diff --git a/exwm.el b/exwm.el
index 814104a86dd2..b6bc164e54ef 100644
--- a/exwm.el
+++ b/exwm.el
@@ -28,14 +28,15 @@
 
 ;; Overview
 ;; --------
-;; EXWM (Emacs X Window Manager) is a full-featured tiling X window manager for
-;; Emacs built on top of XELB.  It features:
+;; EXWM (Emacs X Window Manager) is a full-featured tiling X window manager
+;; for Emacs built on top of [XELB](https://github.com/ch11ng/xelb).
+;; It features:
 ;; + Fully keyboard-driven operations
 ;; + Hybrid layout modes (tiling & stacking)
-;; + Workspace support
+;; + Dynamic workspace support
 ;; + ICCCM/EWMH compliance
-;; ++ (Optional) RandR (multi-monitor) support
-;; ++ (Optional) system tray
+;; + (Optional) RandR (multi-monitor) support
+;; + (Optional) Builtin system tray
 
 ;; Installation & configuration
 ;; ----------------------------
@@ -325,6 +326,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)))
@@ -438,10 +450,9 @@
             ;; FIXME: check (may require other properties set)
             (when (memq xcb:Atom:_NET_WM_STATE_DEMANDS_ATTENTION props)
               (when (= action xcb:ewmh:_NET_WM_STATE_ADD)
-                (let ((idx (cl-position exwm--frame exwm-workspace--list)))
-                  (unless (= idx exwm-workspace-current-index)
-                    (set-frame-parameter exwm--frame 'exwm--urgency t)
-                    (setq exwm-workspace--switch-history-outdated t))))
+                (unless (eq exwm--frame exwm-workspace--current)
+                  (set-frame-parameter exwm--frame 'exwm--urgency t)
+                  (setq exwm-workspace--switch-history-outdated t)))
               ;; xcb:ewmh:_NET_WM_STATE_REMOVE?
               ;; xcb:ewmh:_NET_WM_STATE_TOGGLE?
               )