I have a bash script that locks the screen after a set amount of time (Application that will lock screen after a set amount of time for Ubuntu). I would like to display the time remaining in Ubuntu's System Tray / Application Indicator bar.
Ubuntu Unity Tips – Display Bash Script Output in Systray Area
bashscriptssystem-trayunity
Best Answer
The best method I've found is System Monitor Indicator from this article: webupd8.org - Ubuntu application indicator that displays bash. It displays text on the Unity system tray / application indicator bar that your bash script "echos".
The above article is targeted to Ubuntu 16.04 with Unity. For more information on Xubuntu, Gnome-Shell + app-indicator extension, and Budgie, go to the Developers website: fossfreedom / indicator-sysmonitor. Also visit the site for more detailed installation and configuration instructions.
Install and Configure
indicator-sysmonitor
To install System Monitor Indicator you need to first specify the PPA where
indicator-sysmonitor
can be found:Now run the "indicator-sysmonitor" GUI from Dash (Alt+F2).
custom
Bash Indicator
_ In Command field type name of your bash script, ie/mnt/e/bin/indicator-sysmonitor-display
custom
line and click the Add button to activate it.2
seconds to.3
second. To support "spinning pizza" explained below.Sysmonitor Indicator in action
This
.gif
shows how it looks when Ubuntu’s Unity System Tray is updated.multi-timer
(link below) is started and steps through multiple timers.NOTE: System Monitor Indicator also displays "Brightness: 3000". This is the daytime setting for my Intel Backlight hardware brightness level (link below).
Sysmonitor Indicator BASH script
Create a script similar to the following and assign it to the variable
{Custom}
in Sysmonitor Indicator:After telling Sysmonitor Indicator the name of your bash script by setting the
{Custom}
variable it runs every refresh interval. Whatever your bash script outputs viaecho
command appears in Ubuntu's System Tray.NOTE: The script displays Time Remaining and Display Brightness Level values. These value are set by scripts documented in Ask Ubuntu: Application that will lock screen after a set amount of time for Ubuntu, A timer to set up different alarms simultaneosly and Automatically adjust display brightness based on sunrise and sunset respectively.
Spinning pizza--
text-spinner
BASH scriptThe
text-spinner
bash script creates a spinning pizza effect by cycling through the characters|
,/
,─
and\
. This effect highlights the fact something is "working" or "thinking". To get the "spinning effect" you want to change the Sysmonitor Indicator refresh interval from the default2
seconds to be about0.30
seconds.Here is the
text-spinner
bash script: