Feature: support ewmh _NET_NUMBER_OF_DESKTOPS
Patch status: needinfo
Patch by Tony Crisci
Long description:
This property is set on the root window. http://standards.freedesktop.org/wm-spec/1.3/ar01s03.html > _NET_NUMBER_OF_DESKTOPS, CARDINAL/32 > This property SHOULD be set and updated by the Window Manager to indicate the number of virtual desktops.
To apply this patch, use:
curl http://cr.i3wm.org/patch/515/raw.patch | git am
b/include/atoms.xmacro
21 |
@@ -16,6 +16,7 @@ xmacro(_NET_WM_STRUT_PARTIAL) |
22 |
xmacro(_NET_CLIENT_LIST) |
23 |
xmacro(_NET_CLIENT_LIST_STACKING) |
24 |
xmacro(_NET_CURRENT_DESKTOP) |
25 |
+xmacro(_NET_NUMBER_OF_DESKTOPS) |
26 |
xmacro(_NET_ACTIVE_WINDOW) |
27 |
xmacro(_NET_STARTUP_ID) |
28 |
xmacro(_NET_WORKAREA) |
b/include/ewmh.h
33 |
@@ -10,7 +10,8 @@ |
34 |
#pragma once |
35 |
|
36 |
/** |
37 |
- * Updates _NET_CURRENT_DESKTOP with the current desktop number. |
38 |
+ * Updates _NET_CURRENT_DESKTOP with the current desktop number and |
39 |
+ * _NET_NUMBER_OF_DESKTOPS to the total number of desktops. |
40 |
* |
41 |
* EWMH: The index of the current desktop. This is always an integer between 0 |
42 |
* and _NET_NUMBER_OF_DESKTOPS - 1. |
b/src/ewmh.c
47 |
@@ -12,7 +12,8 @@ |
48 |
#include "all.h" |
49 |
|
50 |
/* |
51 |
- * Updates _NET_CURRENT_DESKTOP with the current desktop number. |
52 |
+ * Updates _NET_CURRENT_DESKTOP with the current desktop number and |
53 |
+ * _NET_NUMBER_OF_DESKTOPS to the total number of desktops. |
54 |
* |
55 |
* EWMH: The index of the current desktop. This is always an integer between 0 |
56 |
* and _NET_NUMBER_OF_DESKTOPS - 1. |
57 |
@@ -33,11 +34,13 @@ void ewmh_update_current_desktop(void) { |
58 |
if (ws == focused_ws) { |
59 |
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, |
60 |
A__NET_CURRENT_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, &idx); |
61 |
- return; |
62 |
} |
63 |
++idx; |
64 |
} |
65 |
} |
66 |
+ |
67 |
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, |
68 |
+ A__NET_NUMBER_OF_DESKTOPS, XCB_ATOM_CARDINAL, 32, 1, &idx); |
69 |
} |
70 |
|
71 |
/* |