5

Is there a way to display something (a warning, a persistent icon that I could change, anything) in the system-tray in Unity? I need to be able to control it from a bash script.

Ideally this would be a command that could control an area in the systray and give messages about the status of the script I'm running. So probably it does not have to be Unity specific, just be compatible with it.

5
  • Some time ago I've read of a gui toolkit that allows displaying text in systray icon. Probably on either webupd8 or noobslab blogs. It's possible to do it in Python but requires some knowledge. Otherwise.... not sure whatelse can be done Mar 1, 2016 at 3:00
  • You may have to code an Application Indicator. It is not too hard. For a start see how other people did it in these projects: askubuntu.com/questions/30334/…
    – Takkat
    Mar 1, 2016 at 8:17
  • Look into conky. It's a great onscreen app Mar 1, 2016 at 8:31
  • @SergiyKolodyazhnyy Happy New Year! I just wanted to point out you were correct about webupd8 and I have posted an answer below that shows it in action. Jan 3, 2022 at 17:01

3 Answers 3

3

Indicator System Monitor

indicator system monitor

The closest method I've found to satisfy your requirements is (webupd8.org - Ubuntu appindicator that displays bash) that displays text on the Unity system tray / application indicator bar. The sample above comes from two bash scripts: multi-timer and display-auto-brightness.

Install and Configure Sysmonitor Indicator

You need to install indicator-sysmonitor from ppa:

sudo add-apt-repository ppa:fossfreedom/indicator-sysmonitor
sudo apt-get update
sudo apt-get install indicator-sysmonitor

Then run the gui and configure it with the script name that updates the system tray.

Sample scripts to output to system tray

Here are a few examples from the WebUpd8 link above:

  • Display the current CPU frequency for the first core:

    echo $(grep "cpu MHz" /proc/cpuinfo | head -1 | cut -d ' ' -f3 | cut -d '.' -f1) MHz

  • Check if a website is up (smiley face) or down (sad face):

    if wget -O /dev/null webupd8.org > /dev/null; then echo "☺"; else echo "☹"; fi

2

Did you look into notify-send? Works great for temporary messages, I think it's in all of the Ubuntu desktops (definitely in XFCE) or should be available with a quick apt command.

Has options like:

-u, --urgency=LEVEL Specifies the urgency level (low, normal, critical).

-t, --expire-time=TIME
          Specifies the timeout in milliseconds at which to expire
          the notification.

-i, --icon=ICON[,ICON...]
          Specifies an icon filename or stock icon to display.

-c, --category=TYPE[,TYPE...]
          Specifies the notification category.

Man page also says:

SEE ALSO
The Desktop Notification Spec on http://www.galago-project.org/specs/notification/

2
  • This is a useful command, but I need something to permanently display a status of a service in the notification area. Mar 1, 2016 at 5:15
  • The expire time option could be used to not expire a message for a day or two... but they still disappear if clicked on... probably more useful to notify of a change in something (status, etc)
    – Xen2050
    Mar 2, 2016 at 5:56
1

Take a look at alltray; maybe it's your solution.

From its website:

Description

With AllTray you can dock any application with no native tray icon (like Evolution, Thunderbird, Terminals) into the system tray. A high-light feature is that a click on the "close" button will minimize back to system tray. It works well with Gnome, KDE, XFCE 4*, Fluxbox* and WindowMaker*. Xmms is supported in particular.

Options

These programs follow the usual GNU command line syntax, with long options starting with two dashes ('-'). A summary of options is included below.

-h --help | Show summary of options.

-v --version | Show version of program.

-d --debug | Show debug messages.

-s --show | Do not hide window after start.

-i --icon | Use a PNG image as an icon.

-l --large_icons | allow large icons (> 24x24).

-st --sticky | visible on all workspaces.

-x --borderless | Remove windows decorations border, title, frame... from parent.

-m --menu | Add entry "menu text:command" to popdown menu.

-t --title | Show title change for seconds. Probably most usefull for xmms.

-g --geometry | initial position. see man X.

Installation (command in a terminal)

sudo apt-get install alltray

Cheers

1
  • 1
    Please improve your answer by adding essential steps on how to use alltray, how to install it, etc. As it stands, this post is a link-only answer and more suitable as comment rather than an answer Jul 13, 2018 at 21:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .