1 -- Authors: Etan Reisner <deryni@gmail.com>
2 -- License: MIT, see http://opensource.org/licenses/mit-license.php
3 -- Last Changed: 2007-07-22
7 Email: deryni@unreliablesource.net
8 Summary: Maintains the _NET_CLIENT_LIST property (and the _NET_CLIENT_LIST_STACKING property incorrectly) on the root window.
9 Last Updated: 2007-07-22
11 Copyright (c) Etan Reisner 2007
13 This software is released under the terms of the MIT license. For more
14 information, see http://opensource.org/licenses/mit-license.php .
17 local atom_window
= ioncore
.x_intern_atom("WINDOW", false)
18 local atom_client_list
= ioncore
.x_intern_atom("_NET_CLIENT_LIST", false)
19 local atom_client_list_stacking
= ioncore
.x_intern_atom("_NET_CLIENT_LIST_STACKING", false)
21 local function add_client(cwin
)
26 local rootwin
= cwin
:rootwin_of()
29 ioncore
.clientwin_i(function (cwin
)
31 list
[list
.n
] = cwin
:xid()
36 ioncore
.x_change_property(rootwin
:xid(), atom_client_list
, atom_window
,
38 ioncore
.x_change_property(rootwin
:xid(), atom_client_list_stacking
,
39 atom_window
, 32, "replace", list
)
42 local function remove_client(xid
)
43 local rootwin
= ioncore
.current():rootwin_of()
46 ioncore
.clientwin_i(function (cwin
)
48 list
[list
.n
] = cwin
:xid()
53 ioncore
.x_change_property(rootwin
:xid(), atom_client_list
, atom_window
,
55 ioncore
.x_change_property(rootwin
:xid(), atom_client_list_stacking
,
56 atom_window
, 32, "replace", list
)
59 local function net_mark_supported(atom
)
60 if (ioncore
.rootwin
) then
61 local rootwin
= ioncore
.rootwin()
62 local atom_atom
= ioncore
.x_intern_atom("ATOM", false)
63 local atom_net_supported
= ioncore
.x_intern_atom("_NET_SUPPORTED", false)
64 ioncore
.x_change_property(rootwin
:xid(), atom_net_supported
, atom_atom
,
69 add_client(ioncore
.current())
74 hook
= ioncore
.get_hook("clientwin_mapped_hook")
79 hook
= ioncore
.get_hook("clientwin_unmapped_hook")
81 hook
:add(remove_client
)
84 net_mark_supported(atom_client_list
);