People become accustomed to seeing certain information displayed in their panels, and one of those is always a clock of some kind.
I like to configure that to my preference in whichever GUI I’m using in Linux, be it Fluxbox, Cinnamon, Xfce, or whatever.
A lot of times the default options available don’t have what I prefer, but nearly all Linux-friendly window managers and desktop environments offer the opportunity to enter a “custom” string for how time and date are displayed, and that’s the subject of this little writeup.
It’s all about the date command
The great thing about most of these graphical environments is the fact that they aren’t trying to reinvent the wheel when it comes to things like this.
The custom strings they allow you to input all use the same underlying command to do things.
Do this. Open up a terminal window and type
What you get as an output is likely something like this:
Sun Jul 17 10:14:12 CDT 2016
Most of these tray clock applets simply get their displayed output from this command. When you’re entering a custom string for such a thing, you’re really just passing it variables to tell it what to display and how to display it.
Let’s try something else. In that same terminal, type
date +"%m". That should return the current month in numeric format, so you should get a
07 if it’s currently July, a
08 if it’s August, et cetera.
So how do you know what variables you need to pass in a custom string?
Help is your friend
It’s hard to remember what variable stands for what, even if you do this regularly. That’s why most command line utilities have the help output.
Still in your terminal, type
You’ll get a really big output which I’m not going to reproduce here. Suffice to say, if you scroll through it, you’ll find pretty much everything you need to come up with a custom date mask for your clock applet.
This is what my usual setup looks like:
%k:%M %A, %B %d
That outputs something like this:
13:26 Sunday, July 17
I like 24-hour time, and a friendly date display, so that’s what I always paste in there. It’s also not something I have to remember, because I’ve got that string of variables recorded for posterity in my notes, so I don’t have to re-engineer it every time I set up a clock applet.
Experiment with this a bit! You’ll find that it can do just about anything you want with regard to a custom time/date display for your clock. It’s a little thing, and most people won’t care, but this kind of customizability is one of the things that attracts a lot of us to Linux on the desktop to begin with, so I felt it was worth a brief writeup. Have fun!