Bash Creation of Mate Panel icon

WarwickW

New Member
Joined
Aug 21, 2020
Messages
3
Reaction score
1
Credits
30
I have gone a long way towards generating a Centos/Mate workstation with all of the files, users and programs we need in our development environment. However, I have not been able to find how to generate an icon in the Mate Panel from my bash script. I know it is easy to create an icon in the Mate panel from the gui but I want it all done from the bash script so that I can just distribute a single bootable usb stick to each of our developers in various States and they can just enter a few parameters such as workstation name, user account passwords and some local stuff at the beginning and about 40 minutes later they have a fully configured workstation, either updated from their existing one or a fresh workstation, without further intervention, including creating or preserving all ssh links. I have found out how to create an icon on the desktop by creating/modifying files in the right place but is there a similar method that enables me to generate the panel icons?
 


As one of the resident bash ninjas, I would normally offer to help. But I’m not familiar with Mate.

If nobody answers in the next day or so, I’ll try installing Mate and will take a look for you.

I would imagine that it should just involve copying your .desktop file somewhere, or editing a config to add the path to your .desktop to allow it to be added to the panel.
 
Thanks, I look forward to the result.
As far as I can make out, Mate is an alternative extension to Gnome 2 for those who were not satisfied with Gnome 3.
 
Last edited:
Likely, you'll need to edit the Mate config files. I don't have a Mate system available ATM, so I can't get very specific on the details, but you can probably dig around in ~/.local and ~/.config and find something.
 
I've just tried installing mate and taken a look at how it's configured.
It seems that all configuration for mate is stored in a binary database that is managed via a program called dconf.
dconf is basically Gnomes equivalent to the Windows registry.

Trying to programmatically add an icon to the mate panel will almost certainly be possible, but it will not be pretty!

I have found out some things that might lead you towards working out which keys to add.
But I haven't worked out the commands in order to successfully add a .desktop launcher to the panel yet.
And unfortunately - I don't have time to look into this any further.

But to get you started - when logged into a mate session you could try the following:
1. Open a terminal and Run the command:
dconf watch /org/mate/panel/ > ~/mate-panel-key-changes
That will start watching the keys in /org/mate/panel and will log any changes in a file in your home directory called mate-panel-key-changes - but feel free to call it something else!

2. Leaving the above command running, switch to the desktop and try adding an icon to the panel via the gui method.

3. Switch back to the terminal and kill the dconf watch process by pressing the ctrl+c keybind.

Now you should have a file in your home directory called mate-panel-key-changes (or whatever you decided to call it in step 1) that lists the keys that were added/changed when you added your new icon.

Additionally:
- You can dump your current settings for mate-panel using the command:
dconf dump /org/mate/panel/ ~/mate-panel-settings
That will dump all of dconf's 'registry' settings for mate-panel into a file in your home directory called mate-panel-settings. Again - feel free to change the name of the output file!

- There is a gui-based viewer/editor for dconf. Aptly called dconf-editor. Which is a bit like Windows registry editor.

Again - when it comes to setting the keys - I'm not sure exactly what dconf commands you will need to issue, or the order in which to issue them. Hopefully the above commands will help you to work that out. I wish I had more time to look into this. This is the kind of problem I like to solve.

If I get some more free-time, I might revisit this again and have a go at working out the final steps.
But if you do manage solve this before then, please post a reply here stating how you did it, because I'm sure it will be of great use to somebody else in the future!

Failing that - you might have to make do with putting the icon somewhere in the systems main menu.
You can achieve this by creating/adding a .desktop launcher file in the /usr/share/applications/ directory, or in each users ~/.local/share/applications/ directory.
 
Last edited:
Thanks, JasKinasis, you have given me a lot more to work on than I had before. I will let you know if I come up with anything useful.
 

Members online


Latest posts

Top