MATE panel scripted

Hello,
I would like to create a script that adds panel applets and launchers.

I see when doing it the usual way, a launcher is created under ~/.config/mate/panel2.d/default/launchers/ and an object entry is added to org.mate.panel under dconf-editor.

I'm not able to piece it all together though and I am wondering if there is a reliable way of scripting this?

Hi dibblego, welcome to the community :slight_smile:

In MATE-desktop 1.24 ~/.config/mate/panel2.d/default/launchers/ is indeed generated when you add a launcher.

In MATE-desktop 1.26 this is no longer the case, everything is done in dconf
I guess the panel2.d directory is deprecated.

If you want to make a script to add panel-applets and launchers there are two commands you can use to get or set variables
dconf and gsettings

dconf examples:

dconf read /org/mate/panel/objects/workspace-switcher/locked
dconf write /org/mate/panel/objects/workspace-switcher/locked true

gsettings examples:

gsettings get org.mate.panel locked-down
gsettings set org.mate.panel locked-down false

gsettings is to edit keyvalues by following schemas
dconf is to edit keyvalues by following paths
(see the respective man pages)

To get into the mindset of gsettings try:

gsettings list-schemas

or:

gsettings list-recursively org.mate.panel

To get an idea what dconf can do:

dconf dump /org/mate/panel/

Actually, gsettings and dconf are the only commands you can use to do what you want. Luckily these are also the only ones you need :slight_smile:

As a last example -> I added dconf-editor to the panel:
To list the visible items:

dconf read /org/mate/panel/general/object-id-list

which gives something like:

[ 'object-0' , 'object-1' , 'object-2' , 'object-3' ]

to add a launcher description:

cat<<LAUNCHER | dconf load /org/mate/panel/objects/
[object-4]
launcher-location='/usr/share/applications/ca.desrt.dconf-editor.desktop'
object-type='launcher'
panel-right-stick=false
position=116
toplevel-id='top'
LAUNCHER

To make your own item visible:

dconf write /org/mate/panel/general/object-id-list "[ 'object-0' , 'object-1' , 'object-2' , 'object-3' , 'object-4' ]"

Now you have added your launcher, it should be visible on the panel :slight_smile:

P.S. I named the launcher 'object-4' but actually it can be any name as long as it's unique

3 Likes

Cool, thanks for that. Yeah I seem to have it working.

Although, I want to append to the existing list, rather than overwrite the existing one there. I'll figure that out, cheers.