Place time above date in Panel

Ubuntu 20.04.2 LTS

I want the Time and Date to display in the bottom right panel like in Windows 10 where the Time is centred on a row above the date. I would also like to adjust its font size.

Like this but I don't know how to format the time to be centred above the date in this editor Window!

13:06
20/04/2021

I tried putting

<span size="small">%H:%M %n %m/%d/%Y</span>

... into dconf editor:
/com/canonical/indicator/datetime/custom-time-format

And also setting...

time-format = custom

But I get that exact text in the panel and not the formatting I would like.

I think this worked in earlier versions of Ubuntu mate but now the location of datetime in dconf seems to be different and that time-format = custom maybe doesn't recognise anymore.

Is this possible in Ubuntu 20.04.2 LTS?

Flex

Hi @flexmcmurphy,

to my knowledge, indicator-datetime does not support HTML tags. However, it supports newline literal %n. You may want trying %H:%M %n %m/%d/%Y as your custom format string with extra spaces for centering.
Earlier UMATE used standalone clock applet by default. You are able to add it to your panel and test. That one supports format string you are trying to apply.

Regards

2 Likes

Thanks for that. I put a few spaces before the %H:%M and it looks pretty well centered.

How do I change the font size?

I think I need to create a .css file in/home/myubuntu/.config/gtk-3.0

With content like this?

style "clock-applet"
{
  fg[NORMAL] = "#444AA9"
  font_name = "Arial 9"
}
widget "*.clock-applet-button.*" style "clock-applet"

Is that the correct css stuff? Oh maybe that would work for the Mate clock Applet you mentioned? What css would I use for the current Ubuntu 20.04.2 clock?

I installed the gtk inspector to find the names of the attributes/elements of the clock but I don't know how to use it or what I'm doing!

Flex

OK I see, the clock indicator has replaced the traditional Clock applet and only the applet supports html tags. Well that's a pity because the clock indicator is better since it integrates with events from my Evolution Calendar and looks fancier all around.

I followed these instructions to remove clock indicator and add back the clock applet. I didn't need to put anything in ~/.config/gtk...

Using dconf editor...

For this...
/org/mate/panel/objects/object-3/prefs/custom-format
I typed in <span size="small"> %H:%M %n %m/%d/%Y</span>

And for this...
/org/mate/panel/objects/object-3/prefs/format
I typed in custom

Earlier I somehow deleted the "custom-format" key. You can add it back from Terminal like this:
# dconf write /org/mate/panel/objects/object-3/prefs/custom-format "''"

Flex

1 Like