Revert "link mute/volumeup/volumedown keys to respective amixer commands"
[notion/jeffpc.git] / ioncore / ioncore_tabnum.lua
blob24f8a18c88f7fe07e10c267fdd5fefa4b469d925
1 --
2 -- ion/share/ioncore_tabnum.lua -- Ioncore tab numbering support
3 --
4 -- Copyright (c) Tuomo Valkonen 2007-2009.
5 --
6 -- See the included file LICENSE for details.
7 --
9 ioncore.tabnum={}
11 local framestate={}
13 local function do_show(frame)
14 if obj_exists(frame) then
15 frame:set_grattr('numbered', 'set')
16 framestate[frame]='set'
17 else
18 framestate[frame]=nil
19 end
20 end
22 --DOC
23 -- Show tab numbers on \var{frame}, clearing them when submap
24 -- grab is released the next time. If \var{delay} is given, in
25 -- milliseconds, the numbers are not actually displayed until this
26 -- time has passed.
27 function ioncore.tabnum.show(frame, delay)
28 if delay and delay>0 then
29 local tmr=ioncore.create_timer()
30 framestate[frame]=tmr
31 tmr:set(delay, function() do_show(frame) end)
32 else
33 do_show(frame)
34 end
35 end
37 --DOC
38 -- Clear all tab numbers set by \fnref{ioncore.tabnum.show}.
39 function ioncore.tabnum.clear()
40 local st=framestate
41 framestate={}
43 for f, s in pairs(st) do
44 if s=='set' then
45 if obj_exists(f) then
46 f:set_grattr('numbered', 'unset')
47 end
48 elseif obj_is(s, "WTimer") then
49 s:reset()
50 end
51 end
52 end
54 ioncore.get_hook("ioncore_submap_ungrab_hook")
55 :add(ioncore.tabnum.clear)