Mate-panel (?) Feature Request: 'Sticky-Center' property for panel items

Hey everybody (who still cares about this). I've got good news and some bad news.

The good news is that I managed to implement this feature in the MATE Panel (finally!). The bad news is that I can't be sure the MATE Team will take the patch, since I had to largely redo the panel's applet positioning framework, and there's a lot of stuff that I did that certain members of the team may not agree with.

As such, before I start a pull request to merge the patch, I'd like somebody to please try out my patch and make sure it works and does what you want it to do (I'm especially talking to the person who started this feature request, @ouroumov):

https://raw.githubusercontent.com/thesquash/patches/master/mate-panel_Center_stick_applets.patch

The patch has been tested on MATE Panel 1.26.0, 1.26.1, and 1.26.2. It probably also works on 1.24.0 and later, though I have not yet tried that.

For those who need guidance on how to patch applications, please see my related topic: How to modify and rebuild a package for Ubuntu MATE (or Ubuntu, or Debian).

Once the patch is applied, you can center an applet in one of three ways:

You can move the applet to the center of a panel; the applet should "stick" to the very center of the panel, if you're careful enough with the positioning. Applets moved to touch the edge of an already-centered applet should also be marked as center-justified, as should applets which cross the very center of the panel. (Note that you must move an applet to the center in order for it to be centered; if the applet is already at or near the center of the panel when this patch is applied, and you do not right-click the applet and select Move, then the applet will remain left-justified.)

If you want a gap between centered applets, you can instead create a custom panel layout file (or modify an existing one) in /usr/share/mate-panel/layouts. Here's a snippet to add a System Monitor applet to 150 pixels left of the center of the top panel:

[Object multiload]
object-type=applet
applet-iid=MultiLoadAppletFactory::MultiLoadApplet
toplevel-id=top
position=-150
relative-to-edge=center
locked=true

Finally, using the dconf Editor, you can modify the parameters of your existing applets; I'm not sure why you'd want to go about it this way, but if you do, then the keys you need are under /org/mate/panel/objects/. The exact keys are position and relative-to-edge.

To top it all off, here's just two screenshots I took of the feature in action. Notice that the System Monitor on the top panel stays in the center of the screen, even after I switch from 800x600 resolution to 1366x768.



I hope that my patch will be useful -- even if it first requires a little bit of tweaking -- and I welcome anybody's feedback regarding this. Have a great weekend, everybody.