Control Pipe
"Michal Nazarewicz" <[email protected]>
| Newsgroups | gmane.comp.gnome.apps.gkrellm |
|---|---|
| Organization | http://mina86.com/ |
| Message-ID | <[email protected]> |
Hello,
I've just written a patch for GKrellM which adds a "control pipe" which
may be used to change configuration or control plugins which are aware of
this feature. At the beginning it starts a thread which reads lines from
~/.gkrellm2/ctlpipe (can be with (undocumented) --pipe command line
option). When a line is available in the pipe the thread executes
parse_monitor_config_keyword() so that plugin gets notified about the
command by it's load_user_config() function.
I'm also attaching a gk-echo plugin which shows basic mechanism of the
control pipe as well as a patch to GKrellM Background Changer plugin which
makes it possible to force background change from the command line. It's
enough to lunch (patched) GKrellM with a (patched) GKrellM Background
Changer plugin and then run:
echo bgchg ctl change-background >~/.gkrellm2/ctlpipe
To see gk-echo in action it's enought to run:
echo echo whatever >~/.gkrellm2/ctlpipe
Any comments or suggestions? Any chances it'll get to GKrellM's code? I'm
aware that pipes are not the best solution as there may be some problems
if two processes try to write data to it. In that case it may get messy
but on the other hand it works with a simple 'echo' shell-built in
command. :)
The only issue I've noticed at the moment is that select() doesn't seem to
work as expected. What I mean is that it doesn't return 1 when there's
data in the pipe as expected but instead waits and returns 0.
--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--
_______________________________________________
Gkrellm mailing list
[email protected]
http://ninja.linux-phreak.biz/mailman/listinfo/gkrellm
gk-echo.c.gz
(application/x-gzip, 334 B) - not displayed
gkrellm-2.2.9-with-ctl.diff.gz
(application/x-gzip, 1.8 KB) - not displayed
gkrellmbgchg2-0.1.6-with-ctl.diff.gz
(application/x-gzip, 480 B) - not displayed
makefile.gk-echo.gz
(application/x-gzip, 324 B) - not displayed