ewmh.activate: focus and especially raise clients during startup
[awesome.git] / lib / awful / startup_notification.lua.in
blob80a0a3677627c31478d0fce118fd6fab62c00e4a
1 ---------------------------------------------------------------------------
2 -- @author Julien Danjou <julien@danjou.info>
3 -- @copyright 2009 Julien Danjou
4 -- @release @AWESOME_VERSION@
5 ---------------------------------------------------------------------------
7 -- Grab environment we need
8 local ipairs = ipairs
9 local table = table
10 local capi =
12 awesome = awesome,
13 root = root
16 --- Startup notification module for awful
17 -- awful.startup_notification
19 local app_starting = {}
21 local cursor_waiting = "watch"
23 local function update_cursor()
24 if #app_starting > 0 then
25 capi.root.cursor(cursor_waiting)
26 else
27 capi.root.cursor("left_ptr")
28 end
29 end
31 local function unregister_event(event_id)
32 for k, v in ipairs(app_starting) do
33 if v == event_id then
34 table.remove(app_starting, k)
35 update_cursor()
36 break
37 end
38 end
39 end
41 local function register_event(event_id)
42 table.insert(app_starting, event_id)
43 update_cursor()
44 end
46 local function unregister_hook(event) unregister_event(event.id) end
47 local function register_hook(event) register_event(event.id) end
49 capi.awesome.connect_signal("spawn::initiated", register_hook)
50 capi.awesome.connect_signal("spawn::canceled", unregister_hook)
51 capi.awesome.connect_signal("spawn::completed", unregister_hook)
52 capi.awesome.connect_signal("spawn::timeout", unregister_hook)
54 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80