Show date and time in Xubuntu (as well as other Linux distros)

Microsoft Windows 8.1 has a very neat little feature I use a lot: you can hit “win+c” to bring up the “charm” which shows the clock along with a few other things. For me that ability to see the current date and time makes this “charm” useful. On a side note, I really do not know what that word “charm” means in the Microsoft world but let’s not digress

The fact is that I use my Xubuntu machines more often than my Windows machine. So, I wanted that “show the clock” ability on my Xubuntu 13.10. I basically wanted to hit “win+c”, like in Windows 8.1, and have the current date and time shown in a pop-up-window on my desktop.

I figured I could easily do this with a shell script. Ages ago, I had very briefly played with a command called Zenity. Zenity is a command line program from the GNOME world that lets you show various graphical dialogs. Basically, Zenity lets you add GUI to your shell script.

Knowing all that, I fired up a terminal and read through the man page for Zenity. After a few minutes of playing around with Zenity, I managed to put together a simple script that does what I want: to show the current date and time in a pop-up window on my desktop.

The second part was to associate this script with “win+c” keyboard shortcut. But, before setting up the keyboard shortcut, I put the script into /usr/local/bin on my system and made the script executable. Then, using the “application shortcuts” tab in “keyboard” settings of the Xubuntu “settings manager” I created the “win+c” keyboard shortcut to launch the script.

The end result of all that activity is that now when i hit “windows+c” i get a quick, big date and time window on my desktop. As currently implemented this date and time window disappears after 10 seconds, but, you could hit escape anytime before that to close the window.

NOTE: This is the output from version 1 of the script. Check the update below for newer version.

This is how my script pops up a window showing current date and time

My (first version) script pops up a window showing current date and time

UPDATE Feb 14, 2014: I updated the script to improve the pop-up window display. Specifically, I changed from Zenity’s “info” to “progress bar” dialog option. I changed a few colors and added text that indicates the window can be closed by hitting Escape key. Here is how the new pop-up window looks:

This is how my script pops up a window showing current date and time

My (second version) script pops up a window showing current date and time along with helpful text hinting how to close the window and a progress bar at the bottom indicating when the window will close by itself.

This script is especially useful to me because:

  • I hate multiple panels on my desktop
  • I “auto-hide” the top panel on my Xubuntu desktop
  • I love keyboard shortcuts!

Even if you do show the top panel on your desktop, this script may be useful because of its big date and time display. Try it to see if it is useful to you. And if you find it useful please leave a good/encouraging comment below … as that would be much appreciated. Please note that all comments are moderated, so some comments may not appear on this blog.

You can download the script from my GitHub Gists. The script carries a GPL license.

Note that the script uses Zenity supported Pango Markup to get the display to look “beautiful” with colors and bold formatting … although, as some Chinese or Western philosopher had said “beauty lies in the eyes of the beholder,” so you may want to change the formatting to suit your needs.

References:

Some useful utilities from Microsoft

Microsoft has a whole bunch of tiny little useful programs that are hiding all over their site. E.g. back in the days of Windows XP, they had all these little add-ons that were probably called “power toys” or something like that. There were a whole bunch of useful utilities like (my favorites):

  • Tweak UI
  • Sync Toy
  • ClearType Tuner
  • Open Command Window Here
  • Image Resizer
  • Alt-Tab replacement

But, you wouldn’t know about them till you went out hunting for them … with Google as your guide in the wild of the Web.

Then, Vista happened and I broke my ties with Microsoft after wasting a bunch of money on Windows Vista Ultimate and Office 2007 Ultimate licenses.

After the long lull and having almost forgotten Microsoft, I recently got myself a new laptop that came with Windows 8 installed on it. Now I have been wondering what to do with it – the laptop and Windows 8. So, I started looking around and figured I would download some free and open source software for Windows. But, then most of the open source software downloads provide their MD5 checksums to help ensure that you got the whole package. Back in the days of Windows XP Pro, I had used WinMD5Sum or some such program, but I can’t find it anymore. I did find these few, but they don’t seem to be the program I had used back in the days:

I am sure there are others, but, who cares. Because today, I found out that Microsoft has its own file checksum integrity verifier program called FCIV. And guess what! That FCIV program supports both MD5 and SHA-1 checksums. Cool, eh? So go on, try it out already.