1 -- Authors: pinko, Etan Reisner <deryni@gmail.com>
3 -- Last Changed: Unknown
5 -- Automatically create a winprop for the WClientWin given.
6 -- Basic functionality by pinko
7 -- Extended by Etan Reisner <deryni@gmail.com>
9 --defbindings("WFrame", {
10 ---- add winprop permanentlu
11 -- kpress(META.."W", "autoprop(_sub, _, true)", "_sub:WGroupCW"),
12 ---- add winprop for this session only
13 -- kpress(META.."E", "autoprop(_sub, _, false)", "_sub:WGroupCW"),
14 ---- remove winprop (permanently)
15 -- kpress(META.."Q", "autoprop(_sub, nil, X)"),
18 -- Use autoprop(_sub, nil, X) to remove a winprop
20 local savefile
="autoprops"
23 function autoprop(cwin_group
, dest
, save
)
24 -- if obj_typename(cwin_group) ~= "WGroupCW" then
29 local cwin
= cwin_group
:bottom()
31 if type(dest
)=="nil" then
42 p
=table.join(cwin
:get_ident(), p
)
50 if save
and p
.target
then
51 autoprops
[p
.class
..p
.role
..p
.instance
]=p
55 autoprops
[p
.class
..p
.role
..p
.instance
]=nil
59 local function save_autoprops()
60 ioncore
.write_savefile(savefile
, autoprops
)
63 local function load_autoprops()
64 local d
=ioncore
.read_savefile(savefile
)
69 table.foreach(d
, function(k
, tab
)
72 instance
=tab
.instance
,
76 autoprops
[tab
.class
..tab
.role
..tab
.instance
]=tab
82 ioncore
.get_hook("ioncore_snapshot_hook"):add(save_autoprops
)