An indicator for the Unity panel that show arbitrary text. You can use it to show system information, a fortune cookie or daily joke, or even as simple IM.
indicator-text
listens for text input on various sources. It then simply
outputs the text to the panel.
Panel showing output from conky.
Panel showing arbitrary text from colleague.
After using WindowMaker for many years, I tried the Unity desktop. One thing I immediately missed were the dock apps. At least, I wanted to show some system information such as current CPU load and memory usage.
There exist some indicators for this purpose. However, I found that they do not fit into the desktop aesthetically. This is why I wrote this indicator.
$ sudo apt-get install libgtk-3-dev libappindicator3-dev
$ git clone https://github.com/eglimi/indicator-text.git
$ cd indicator-text
$ make
$ ./indicator-text
Ubuntu uses .desktop
files to manage autostart. You may use the one provided
with the sources.
$ sudo cp ./indicator-text /usr/local/bin
$ cp ./indicator-text.desktop $HOME/.config/autostart/
Currently, there is no pre-compiled package. I might be able to provide one, if somebody is interested. Just write a feature request.
Currently, indicator-text
supports the following input.
- stdin
- UDP messages on port 3434
More channels could be easily added if somebody is interested. Again, write a feature request.
The most simple way is to use the stdin
channel. For this, simply start the
program and type something. When you hit ENTER
, you should see your text in
the panel.
This is already very useful because it means that text can be piped into the
program. Since this is a common pattern in Linux, many programs have the option
to have their output sent to stdout
. If the program does this repeatedly,
this is all we need.
$ repeating_prg | ./indicator-text
This is the more flexible way, because it does make less assumptions about the
program generating the text. Using this channel, a program can send its text
either directly to the appropriate host and port, or through stdout
and a
program such as socat or
netcat.
Using this technique, there can be several programs sending text to the panel.
The general pattern is to start indicator-text
, and sending text from other
sources independently.
$ ./indicator-text -u
$ echo "hello panel, it's me!" | socat - UDP:localhost:3434
One can simply start socat
as shown above and start typing. This mimics the
first use case with stdin
, but with the advantage that multiple sources can
send messages.
Perhaps the most useful usage is to show important system information.
indicator-text
itself does not have any means to provide such information.
Instead, it can be used together with a system monitor such as
conky.
Install conky
$ sudo apt-get install conky-cli
Create a conky configuration that shows the your most important information in
one line. The example from the screenshot uses the following configuaration.
Copy it to $HOME/.conkyrc
.
background no
out_to_console yes
out_to_x no
update_interval 2.0
use_spacer |
TEXT
cpu: ${cpu cpu0}% | mem: ${memperc}% | ↑: ${upspeedf}K ↓:${downspeedf}K
Start it with either
$ conky | ./indicator-text
Or using UDP
$ ./indicator-text -u
$ conky | socat - UDP:localhost:3434
In order to autostart conky
and indicator-text
, you can create a script
with the following content and adjust indicator-text.desktop
to reference
this script. Or alternatively, again, start conky and indicator-text separately
and use UDP.
#!/bin/sh
/usr/bin/conky | /usr/local/bin/indicator-text
There are several fortune cookies available on your system. See a list an select your favourite fortunes.
$ apt-cache search fortunes
$ sudo apt-get install fortunes
Start indicator-text
and send the fortune text (a bit complicated because we
have only one line).
$ ./indicator-text
$ fortune -s | tr -d '\n' | sed -e 's/$/\n/' | socat - UDP:localhost:3434
This program is distributed under the terms of the MIT license. See LICENSE file.