I wanted that workspace names show when I switch ion3 workspaces (saw that in wmaker) and I came to the following solution.
I've used following lua code to attach to the screen_content_switched_hook
------------------------------------------------------
function workspace_switch_osd(f)
ioncore.exec("sh -c \"killall osd_cat;echo \""..f:name(f).."\"|osd_cat -d 1
-A center -p middle -f '-*-*-*-*-*-*-*-320-*-*-*-*-*-*' -o -60 -c yellow -O 2
&\"")
end
function screen_workspace_switched_setup_hook()
local hk=ioncore.get_hook("screen_content_switched_hook")
hk:add(workspace_switch_osd)
end
screen_workspace_switched_setup_hook()
------------------------------------------------------
Since I've not found how to get workspace name, I've created new
function in ioncore module:
------------------------------------------------------
Synopsis:
string WScreen.name(WScreen scr)
Description:
Return name of screen scr.
------------------------------------------------------
The patch that implements the function is attached. It is against SVN
revision 1911 (almost latest ATM).
Index: ioncore/screen.c
===================================================================
--- ioncore/screen.c (revision 1911)
+++ ioncore/screen.c (working copy)
@@ -442,8 +442,22 @@
return scr->id;
}
+/*EXTL_DOC
+ * Return the name for screen \var{scr}.
+ */
+EXTL_EXPORT_MEMBER
+const char *screen_name(WScreen *scr)
+{
+ WRegion *reg;
+
+ reg=mplex_lcurrent(&(scr->mplex), 1);
+ if (reg == NULL)
+ return "";
+ return region_name(reg);
+}
+
static bool screen_managed_may_destroy(WScreen *scr, WRegion *reg)
{
WRegion *r2;
I'm not sure if this is the rigth way. I'm not very experienced with lua yet. If someone knows how to get workspace name from within screen_content_switched_hook in lua-only way - please reply to this mail. Also any other comments are very welcome :) -- Nedko Arnaudov <GnuPG KeyID: DE1716B0>
pgp1wmGuK1UDw.pgp
Description: PGP signature
