How to show the current timezone near time and date in the menu bar in Ubuntu 16.10? This should be relevant for the other versions also.
It is a very missing feature, you can easily be confused without it.
I would like to get something like "Fri Dec 23 20:35:05 (Europe/Kiev)".
Also it would be nice to be able to customize that string arbitrarily, say "Friday, 23.12.2016 – 20:35:05 (Europe/Kiev)". Thank you!
Update
Referring to How to change the date format?
one can do
gsettings set com.canonical.indicator.datetime time-format "'custom'"
gsettings set com.canonical.indicator.datetime custom-time-format "'%a, %d.%m.%y - %H:%M:%S (%Z)'"
which changes the system time and date indicator to
Friday, 23.12.2016 – 20:35:05 (EET)
As you can see, everything is fine now, besides the timezone name. I set my timezones at Time & Date settings > Clock > Choose Locations. Then, if I write
timedatectl
in terminal I get
Time zone: Europe/Kiev (EET, +0200)
So, there are several options for a timezone name and it seems that it is strftime function that decides which one to use and also that just by feeding it with a format string there is no way to get a timezone name "Europe/Kiev" (only "EET" or "+0200").
So are there any ways to choose a timezone's name format?
Maybe using Serg's script I could place the preferred name next to the system indicator?
Thanks!
Best Answer
Introduction
The indicator presented below displays current timezone in the top panel. The way it works is fairly simple. Timezone settings are set in
/etc/timezone
file. All the indicator does, is read that file, and update the information displayed if necessary.Save the source code below as
~/bin/timezone_indicator
, runchmod +x ~/bin/timezone_indicator
to make it executable, and run as~/bin/timezone_indicator
. If you wish for it to start each time you log in automatically, open Startup Applications menu, and add the full path to the indicator as one of the commands there.Feel free to test changing the timezone as show in https://askubuntu.com/a/524362/295286
Script Source
Also available on GitHub: