User Tools

Site Tools


mate:custom-clock

MATE Clock Applet Customization

Sometimes, you just don't like the standard clock MATE provides. I feel you… GNOME 2 were always a bit bland, so to speak, customization-wise. A blandness which seems to be shared with it's GTK3-compatible sucessor, MATE. As much as I like MATE, I'd like to be able to customize it a bit more. But, hey, GTK3 CSS and dconf-editor is here to help you.

Custom clock format

Seems to be a somewhat recurring question, as I gathered when searching for it. It's really, really quite simple to do. There's a dconf key (which seems to echo me back the regedit-sh way of doing obscure things on Windows) which holds the custom format. You can browse it using dconf CLI utilitliy, but if you are incapable of using Terminals, fear not, just use dconf editor.

tl;dr: navigate to: org.mate.panel.objects.clock.prefs, where you can find two relevant keys: format and custom-format. The former should be set to custom and, then, custom-format takes whatever you want to use. It uses the same standard substitutions of Unix date command.

Mine, for e.g., is this: %a %b %e %Y,%_I:%M:%S %P, which gives me Fri May 15 2020, 4:29:42 pm. My system uses en-GB locale, so the %P comes in lower case, for whatever reason.

Possible gotchas

On my ThinkPad, for some reason (perhaps oddities when carrying over an old Ubuntu MATE home to a Debian Buster installation) changing the clock folder (under objects) did nothing, instead the actual clock had another name, like org.mate.panel.objects.objectXX. You'll have to dig it up.

Also, sometimes, custom-format is a non-existant key. dconf write makes short work of this, but if you're using dconf-editor, you should obiously create it (but check where you are creating it, if the clock isn't in the correct folder).

Quick and Dirty™ Script

#!/bin/bash
# Double check whate you are doing... I'm not responsible for 
# your cat going into hyperspace when you can't just do simple
# checks before running copypasta scripts from arround the web... 

OBJECT="clock"
FORMAT="%a %b %e %Y,%_I:%M:%S %P"

dconf write org.mate.panel.objects.${OBJECT}.prefs.format custom
dconf write org.mate.panel.objects.${OBJECT}.prefs.custom-format ${FORMAT}

I didn't test this. But should you mess up, it's just a matter of going to the applet preferences and setting it to 12 or 24 hours.

CoLoRS and fonts

SUPERSONIC! 
--- Sonic, The Hedgehog, prolly

Sometimes you want your clock to be a little more colorful or, simply, to use a different font other than your system's default one. I do not use this hack anymore, so I don't guarantee it still works, but, hey, why not documenting it here?

GTK3 has a neat feature: you can edit some UI elements by using CSS, which is rather useful. It's possible to use GTK+ Inspector, so you won't suffer trying to grasp which thing is which. It's still a bit painful, tho, because the GTK internals are very poorly documented, to say the least.

As for the clock, I had the following lines on my ~/.config/gtk-3.0/gtk.css:

#clock-applet-button
{
	background-color: black; 
	color: lime; 
	font-size: 9pt; 
	font-family: "OCR A Std"; 
	font-weight: bolder; 
}

(please don't fight me over the bracket thing)

Which gives you a rather ugly looking clock (given you have OCR A Std installed):

But, obviously, you can tweak it up. It was working here until some weaks ago when I, after installing Debian Bullseye (Testing), switched back to MATE and found this old ugly piece of config. I carried over some installations.

mate/custom-clock.txt · Last modified: 2020/05/15 19:58 by prppedro