2 -- ion/share/ioncore_ext.lua -- Ioncore Lua library
4 -- Copyright (c) Tuomo Valkonen 2004-2009.
6 -- See the included file LICENSE for details.
9 -- This is a slight abuse of the package.loaded variable perhaps, but
10 -- library-like packages should handle checking if they're loaded instead of
11 -- confusing the user with require/includer differences.
12 if package
.loaded
["ioncore"] then return end
18 -- Maximum number of bytes to read from pipes
19 ioncore
.RESULT_DATA_LIMIT
=1024^
2
21 -- Bindings, winprops, hooks, menu database and extra commands
22 dopath('ioncore_luaext')
23 dopath('ioncore_bindings')
24 dopath('ioncore_winprops')
25 dopath('ioncore_misc')
27 dopath('ioncore_menudb')
28 dopath('ioncore_tabnum')
29 dopath('ioncore_quasiact')
31 -- Modifier setup compatibility kludge
34 -- Historically, the options now called 'META' and 'ALTMETA' were called 'MOD1' and 'MOD2'.
35 -- The code below makes sure:
36 -- * the default values for those settings are 'Mod4+' (the 'windows key') and ''
37 -- * that setting either META/ALTMETA or MOD1/MOD2 will specify the primary and secondary meta keys
38 -- * that getting either META/ALTMETA or MOD1/MOD2 will return the (default or configured) primary and secondary meta keys
40 local function getmod(t
, s
)
42 return rawget(t
, "MOD1") or "Mod4+"
44 return rawget(t
, "META") or "Mod4+"
45 elseif s
=="ALTMETA" then
46 return rawget(t
, "MOD2") or ""
48 return rawget(t
, "ALTMETA") or ""
54 local oldmeta
, newmeta
=getmetatable(_G
), {}
56 newmeta
=table.copy(oldmeta
)
57 oldindex
=oldmeta
.__index
59 newmeta
.__index
=getmod
60 setmetatable(_G
, newmeta
)
64 -- Export some important functions into global namespace.
87 -- Mark ourselves loaded.
88 package
.loaded
["ioncore"]=true
92 local function dummy_gettext_hack()
93 -- Extra translations for context menus etc. I don't want extra
94 -- TR calls in the configuration files, or parsing the string
95 -- parameters to kpress etc. for translations.