1 -- statusbar_workspace.lua
3 -- Show current workspace name or number in the statusbar.
5 -- Put any of these in cfg_statusbar.lua's template-line:
9 -- %workspace_name_pager
10 -- %workspace_num_name_pager
12 -- This is an internal statusbar monitor and does NOT require
13 -- a dopath statement (effective after a 2006-02-12 build).
16 -- author: Rico Schiekel <fire at paranetic dot de>
19 -- added 2006-02-14 by Canaan Hadley-Voth:
20 -- * %workspace_pager shows a list of workspace numbers
21 -- with the current one indicated:
25 -- i=WIonWS, f=WFloatWS, p=WPaneWS, c=WClientWin/other
27 -- * %workspace_frame - name of the active frame.
29 -- * Added statusbar_ to the filename (since it *is*
30 -- an internal statusbar monitor) so that it works without
33 -- * Removed timer. Only needs to run on hook.
34 -- Much faster this way.
37 -- update for ion-3rc-20070506 on 2007-05-09
38 -- by Kevin Granade <kevin dot granade at gmail dot com>
40 -- Updated to use new wx_ api
41 -- Replaced region_activated_hook with region_notify_hook
42 -- Added %workspace_name_pager, which works similarly to %workspace_pager,
43 -- but instead displays the name of each workspace
44 -- Added display for WGroupWS to %workspace_pager, displayed as 'g'
47 local function update_frame()
49 ioncore
.defer( function()
50 local cur
=ioncore
.current()
51 if obj_is(cur
, "WClientWin") and
52 obj_is(cur
:parent(), "WMPlex") then
56 mod_statusbar
.inform('workspace_frame', fr
)
57 mod_statusbar
.update()
61 local function update_workspace()
62 local scr
=ioncore
.find_screen_id(0)
63 local curws
= scr
:mx_current()
67 local name_pager_plus
=""
68 local curindex
= scr
:get_index(curws
)+1
72 wstype
=obj_typename(tmpws
)
73 if wstype
=="WIonWS" then
75 elseif wstype
=="WFloatWS" then
77 elseif wstype
=="WPaneWS" then
79 elseif wstype
=="WGroupWS" then
85 name_pager_plus
=name_pager_plus
.." ["..tmpws
:name().."]"
86 name_pager
=name_pager
.." ["..tmpws
:name().."]"
87 pager
=pager
.." ["..(i
)..c
.."] "
89 name_pager_plus
=name_pager_plus
.." "..(i
)..":"..tmpws
:name()
90 name_pager
=name_pager
.." "..tmpws
:name()
91 pager
=pager
.." "..(i
)..c
.." "
97 -- Older versions without an ioncore.current() should
101 ioncore
.defer( function()
102 mod_statusbar
.inform('workspace_pager', pager
)
103 mod_statusbar
.inform('workspace_name', curws
:name())
104 mod_statusbar
.inform('workspace_name_pager', name_pager
)
105 mod_statusbar
.inform('workspace_num_name_pager', name_pager_plus
)
106 mod_statusbar
.update()
110 ioncore
.get_hook("region_notify_hook"):add(update_workspace
)