22.04 How to set layout panel with Terminal?

Hello,
I'm looking for the commands, or script, to change the panel layout (Redmond/Cupertino...). Thanks in advance. Second question: what is the command to add the applet system monitor to the panel? I will update my script post-install.

The following commands almost works:

dconf write /org/mate/panel/general/default-layout "'redmond'" # To set Redmond for example
killall mate-panel # To refresh

The panel doesn't appears with the layout set in the above command, why?

Once you've modified your panel layout even slightly from defaults (in fact, I think even if you simply load the panel with a particular layout), the "default layout" setting is ignored. Only when your current local panel configuration is purged, will changing the default panel layout change anything. Until now I've never figured out how to do so from the command line myself, but I think the MATE Tweak code would give us a hint:

# Set the new layout
subprocess.call(['mate-panel', '--reset', '--layout', new_layout], stdout=DEVNULL, stderr=DEVNULL)

I just tested the following command:

mate-panel --reset --layout fedora

...and it set my panel layout to the Fedora layout. On top of that, it even set org.mate.panel.default-layout for me!

Obviously replace fedora with whatever layout you want, such as redmond (as in your example). Also there's a reason there's so much code in the MATE Tweak tool -- it's because some panel layouts (especially the ones with dock programs) are very fiddly to get right. As long as you're not going to switch to eleven, cupertino or similar though, you should be fine.

3 Likes

Good job! With your post, the full command which works on my system is:

mate-panel --reset --layout fedora && killall mate-panel
2 Likes

You shouldn't have to use the killall command after setting the panel layout; the mate-panel --reset should cause the panels to reset without killing the panel. In fact, on some Linux systems I've used that are equipped with MATE, killing the panel will not automatically restart it.

But if you need it, and it works for you, then I suppose you should keep the killall command. This post is mostly for those who are reading this months or years after the fact, so that they won't scratch their heads if their panel disappears and doesn't come back.

1 Like