Make your Linux desktop send alerts that you can't miss

Marco Fioretti shows his favored methods of setting up desktop alerts that are distribution-independent and sure to get his immediate attention.

A good operating system should help you to be as productive as possible. For me, this means several things. One is that my desktop should help me to completely focus on my most important and urgent tasks without any distraction. However, I also want the peace of mind that comes with knowing that my system will immediately alert me when something is due or problems occur.

And, I want all of this to be as independent as possible from any given distribution or environment, so that it will still work when I decide I want to remodel my desktop.

These are the reasons why I prefer not to rely on panel-based widgets. They're great for clocks, network status icons, and other stuff of that kind, but not real, impossible to miss, "alarms."

Whenever I want something like that, I run every few minutes as a cron job some simple shell script that has this basic structure:

  if (some_event happened)
    print notification to the desktop

In these scripts, some_event could be anything from checking to see if my website or mail server is down to whether my external backup drive is getting full, to telling me if it's less than one week to my wedding anniversary. The second part — that is, "printing" a notification on the desktop — is the topic of this post.

There are a few ways to show a message all over a Gnu/Linux desktop, but they all fall in two categories: you either put what you need to see over everything else or it goes in the background (root) window. The first approach is the best, if not the only solution, for people who normally have their desktop background completely covered by several windows (that's very often my case). The other is sufficient, and possibly less rude, if you tend to always leave at least part of your desktop wallpaper in plain sight. Here are two methods for each category. Personally, I prefer the first one, but it's a matter of taste.


Zenity is a Gtk graphic tool, available as binary package for all major distributions. Zenity provides interactive text boxes and other widgets that can be launched from, and interact with, shell scripts. Put in the "print notification" section of your scripts a command like this:

  zenity —warning —width=2000 —height=1000 —text 'Time to do the laundry!'

and it will cover all or most of your screen with a grey box, carrying that message in the top left corner and an OK button to close it on the opposite side. It can't be simpler than that.

Screen lockers

Covering the whole screen with a Zenity warning box is the simpler way to put some message in front of your eyes. An even more radical action, one that really forces you to think about what the computer told you and how to deal with it, is to just lock the whole screen. Installing the venerable xlock package is the simplest (desktop-independent!) way I know of to lock the screen on all Linux desktops and leave a customizable reminder right below the password prompt. You just launch it with the -info option:

  xlock -info 'Time to do the laundry!'

For the record, both Gnome and KDE have screen lock commands that can be used in a shell script, but they don't seem to have an option like -info. They are, respectively, gnome-screensaver-command —lock and kdesktop_lock. Extra details (which I didn't test) about locking KDE from the command line are here.


root-tail is a program that "prints text directly to X11 root window." It is normally used by system administrators who want to see some log file continuously scrolling over the desktop background, Matrix style. More modestly, you can launch it to print some warning in this way:

  echo 'Watch out, your hard drive is 95% full' > /tmp/root-tail_message.txt
  root-tail -g 100x250+200+200 /tmp/root-tail_message.txt,red

As you can see (cfr the root-tail man page for details), you can specify exactly in which part of the screen the message will appear. The two main advantages of root-tail are that it will (like xlock) work even on the leanest Gnu/Linux distributions, and that it can show much more text than Zenity while still keeping it readable. Its main disadvantage is that you need to kill it from the command line to clean up your wallpaper.


The Conky system monitor that I discussed in my previous post can also be used to display, in the root window, text warnings from a script or dynamically generated text file. For example, you may launch an extra copy of Conky with a configuration file that has this code in its TEXT section (see here for details):

  ${color cyan}Attention please:
  ${color yellow}${exec cat 30 warning.txt}

This will display the contents of "warning.txt". A more sophisticated way to do the same thing is at BigOhSoftware. Conky is much better than root-tail if you want to add some eye candy to your notification. There are, for example, folks that use Conky to print text with gradients and reflections.

Final notes

The attentive reader will have noticed that all these notification tricks will be perfectly useless if you're away from your desktop: remember to add to your scripts commands that also send you an SMS or an email if you really can't risk to miss their output! Finally, in case you were wondering: yes, of course I could use audio notifications with scripts that play a sound. However, I usually avoid that, simply because I don't want to wake up, or disturb in any way whoever may be sleeping, talking, or listening to a conference around me.


Marco Fioretti is a freelance writer and teacher whose work focuses on the impact of open digital technologies on education, ethics, civil rights, and environmental issues.

Editor's Picks