X-Git-Url: https://git.decadent.org.uk/gitweb/?p=ion3.git;a=blobdiff_plain;f=mod_statusbar%2Fmod_statusbar.lua;h=9bae08cd8dd1c4fd5cf7eb919224a9d39a8a9f34;hp=aeef9cb34a6c6db8b3cc4e4bdc89ae7c192d4d50;hb=e3aec18706513a87eaa7839dfdaf7e0fcd0d8d2a;hpb=8366314611bf30a0f31d25bf5f5023186fa87692 diff --git a/mod_statusbar/mod_statusbar.lua b/mod_statusbar/mod_statusbar.lua index aeef9cb..9bae08c 100644 --- a/mod_statusbar/mod_statusbar.lua +++ b/mod_statusbar/mod_statusbar.lua @@ -1,12 +1,9 @@ -- -- ion/mod_statusbar/mod_statusbar.lua -- --- Copyright (c) Tuomo Valkonen 2004-2006. +-- Copyright (c) Tuomo Valkonen 2004-2009. -- --- Ion is free software; you can redistribute it and/or modify it under --- the terms of the GNU Lesser General Public License as published by --- the Free Software Foundation; either version 2.1 of the License, or --- (at your option) any later version. +-- See the included file LICENSE for details. -- -- This is a slight abuse of the package.loaded variable perhaps, but @@ -194,7 +191,7 @@ function mod_statusbar.rcv_statusd(str) end -local function get_modules() +function mod_statusbar.get_modules() local mods={} local specials={["filler"]=true, ["systray"]=true} @@ -236,15 +233,20 @@ function mod_statusbar.rcv_statusd_err(str) end end - --DOC --- Load modules and launch ion-statusd with configuration table \var{cfg}. +-- Load modules and launch \file{ion-statusd} with configuration +-- table \var{cfg}. The options for each \file{ion-statusd} monitor +-- script should be contained in the corresponding sub-table of \var{cfg}. function mod_statusbar.launch_statusd(cfg) if statusd_pid>0 then return end - local mods=get_modules() + -- Launch tried, don't do it automatically after reading + -- configuration. + mod_statusbar.no_autolaunch=true + + local mods=mod_statusbar.get_modules() -- Load modules for m in pairs(mods) do @@ -254,9 +256,10 @@ function mod_statusbar.launch_statusd(cfg) end -- Lookup ion-statusd - local statusd=ioncore.lookup_script("ion-statusd") + local statusd_script="ion-statusd" + local statusd=ioncore.lookup_script(statusd_script) if not statusd then - ioncore.warn(TR("Could not find %s", script)) + ioncore.warn(TR("Could not find %s", statusd_script)) return end @@ -268,7 +271,7 @@ function mod_statusbar.launch_statusd(cfg) local cfg=mod_statusbar.cfg_statusd(cfg or {}) local params="" table.foreach(mods, function(k) params=params.." -m "..k end) - local cmd=statusd.." -q -c "..cfg..params + local cmd=statusd.." -c "..cfg..params local rcv=coroutine.wrap(mod_statusbar.rcv_statusd) local rcverr=mod_statusbar.rcv_statusd_err @@ -292,7 +295,23 @@ end -- Initialisation and default settings {{{ --DOC --- Create a statusbar. +-- Create a statusbar. The possible parameters in the +-- table \var{param} are: +-- +-- \begin{tabularx}{\linewidth}{llX} +-- Variable & Type & Description \\ +-- \var{template} & string & The template; see +-- Section \ref{sec:statusbar}. \\ +-- \var{pos} & string & Position: \codestr{tl}, \codestr{tr}, +-- \codestr{bl} or \codestr{br} +-- (for the obvious combinations of +-- top/left/bottom/right). \\ +-- \var{screen} & integer & Screen number to create the statusbar on. \\ +-- \var{fullsize} & boolean & If set, the statusbar will waste +-- space instead of adapting to layout. \\ +-- \var{systray} & boolaen & Swallow (KDE protocol) systray icons. \\ +-- \end{tabularx} +-- function mod_statusbar.create(param) local scr=ioncore.find_screen_id(param.screen or 0) if not scr then @@ -335,6 +354,6 @@ package.loaded["mod_statusbar"]=true dopath('cfg_statusbar', true) -- Launch statusd if the user didn't launch it. -if statusd_pid<=0 then +if not mod_statusbar.no_autolaunch then mod_statusbar.launch_statusd() end