]> git.decadent.org.uk Git - ion3.git/blob - debian/cfg_kludge_flash.lua
69e03b0fdbc9d4c9da0966202fa9f095c71dff9b
[ion3.git] / debian / cfg_kludge_flash.lua
1 -- Flash player opens full-screen windows from Firefox.  It closes
2 -- them if they lose focus, but also if they get focus too quickly.
3 -- Therefore set focus 200 ms after such a window is mapped (this may
4 -- need to be adjusted on slower computers).
5
6 _NET_WM_STATE = ioncore.x_intern_atom('_NET_WM_STATE', false)
7 _NET_WM_STATE_FULLSCREEN = ioncore.x_intern_atom('_NET_WM_STATE_FULLSCREEN',
8                                                  false)
9
10 function is_fullscreen(cwin)
11     local state = ioncore.x_get_window_property(cwin:xid(), _NET_WM_STATE, 4,
12                                                 1, true)
13     if state then
14         for k, v in pairs(state) do
15             if v == _NET_WM_STATE_FULLSCREEN then
16                 return true
17             end
18         end
19     end
20     return false
21 end
22
23 defwinprop {
24     class = 'Firefox-bin',
25     match = function(prop, cwin, id) return is_fullscreen(cwin); end,
26     switchto = false,
27     flash_fullscreen = true,
28 }
29
30 ioncore.get_hook('clientwin_do_manage_alt'):add(
31     function(cwin, table)
32         local winprop = ioncore.getwinprop(cwin)
33         if winprop and winprop.flash_fullscreen then
34             local timer = ioncore.create_timer()
35             timer:set(200, function() cwin:goto() end)
36             return true
37         else
38             return false
39         end
40     end
41 )