]> git.decadent.org.uk Git - ion3.git/blob - ioncore/ioncore_misc.lua
[svn-inject] Installing original source of ion3
[ion3.git] / ioncore / ioncore_misc.lua
1 --
2 -- ion/share/ioncore_misc.lua
3 -- 
4 -- Copyright (c) Tuomo Valkonen 2004-2006.
5 --
6 -- Ion is free software; you can redistribute it and/or modify it under
7 -- the terms of the GNU Lesser General Public License as published by
8 -- the Free Software Foundation; either version 2.1 of the License, or
9 -- (at your option) any later version.
10 --
11
12
13 local group_tmpl={type="WGroupWS", switchto=true}
14
15 --DOC
16 -- Create new workspace on screen \var{scr}. The table \var{tmpl}
17 -- may be used to override parts of \code{default_ws_params},
18 -- and \var{no_default} may be set to \code{true} to complete ignore it.
19 function ioncore.create_ws(scr, tmpl, no_default)
20     local dflt=(not no_default and ioncore.get().default_ws_params) or {}
21     local t=table.join(table.join(tmpl or {}, dflt), group_tmpl)
22     
23     return scr:attach_new(t)
24 end
25
26
27 --DOC
28 -- Find an object with type name \var{t} managing \var{obj} or one of
29 -- its managers.
30 function ioncore.find_manager(obj, t)
31     while obj~=nil do
32         if obj_is(obj, t) then
33             return obj
34         end
35         obj=obj:manager()
36     end
37 end
38
39
40 --DOC
41 -- gettext+string.format
42 function ioncore.TR(s, ...)
43     return string.format(ioncore.gettext(s), unpack(arg))
44 end
45
46
47 --[[DOC
48 -- Run \var{cmd} with the environment variable DISPLAY set to point to the
49 -- root window of the X screen \var{reg} is on.
50 function ioncore.exec_on(reg, cmd)
51     return ioncore.do_exec_rw(reg:rootwin_of(), cmd)
52 end
53 --]]