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

The question mark is there because I'm not sure exactly what program would be responsible for the feature.
I've been using gnome-session-fallback on top of vanilla Ubuntu since Unity happened but I've already moved 3 of 4 machines I operate over to Ubuntu MATE and it's great.

There's a feature missing though regarding the placement of launchers / indicators in the panel: the "sticky-center" property. When positioning an item around the center there's a kind of "snap" to the exact center of the screen. This can be used for multiple items for instance monitor + clock + monitor that all have sticky-center behavior.
Missing that feature one has to manually position the panel items on the approximate center of the screen, but then the position is registered as an absolute value and that is a problem in the following scenarios:

  1. One of the items to be centered has variable width (Simplest example is a clock in French locale: the number of characters used to represent the month or day can vary)
  2. When plugging an extra screen and switching the "main display" to the new screen, this kind of things happen:

(The indicators "mate-monitor" are centered on the small display, but not after the main display switch)

This also happens when the resolution of a display changes (following a mirror displays action for instance)

So here we are: I think the "sticky-center" property would add to the quality of the interface and I would be glad to see this added to Ubuntu MATE.

Cheers

2 Likes

I took the same path till I discovered Mate :slight_smile: One of the dev's will have to answer you on the sticky panel request.

To have apps open in the center, you can use 'Window Preferences'.

This would be a new feature, please raise a feature request here: https://github.com/mate-desktop/mate-panel :slight_smile:

1 Like

Yes Sir!
It is done: https://github.com/mate-desktop/mate-panel/issues/426

3 Likes

A notice to all: I know it's been a long time since anybody talked about this. But at my own discretion, I have decided to take up this challenge. I have scanned pretty deeply in the MATE Panel source code as of late and believe this is very doable. I'm assuming this feature is still desired by someone; if nothing else, I sure want it: I put a System Monitor on my top panel near the center, and always want it at dead center, among other things:

Furthermore, some of you have seen me contribute code to MATE in the past, and I have a fairly high success rate -- I just started a pull request yesterday for another miscellaneous bugfix which got merged today: https://github.com/mate-desktop/mate-desktop/pull/470. Not a big endorsement, since it's literally a two character change, but I am 99% sure I can implement this for once. Please allow me a chance.

3 Likes

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.

It's official: After putting a considerable amount of work into this feature, the center sticking feature is now an official part of the latest MATE Panel code. Once the next major release of the MATE Panel come out (and are included in distributions), the feature will become available to anyone (the typo in the below name is an unfortunate one):

As it is, those who are willing to "live dangerously" can compile the very latest code from the "master branch" themselves and get this feature immediately.

I have also created some patches that you can apply to older or current stable versions of the MATE Panel so that you can gain this capability without waiting for version 1.28. You can apply them using the instructions found at How to modify and rebuild a package for Ubuntu MATE (or Ubuntu, or Debian). There are two versions of the patch; if you have version 1.26 of MATE, use this patch:

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

If you are still running MATE 1.24, use this patch:

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

Please let me know if the patches do not work as expected. Thanks in advance.

3 Likes

Great Work Gordon!

Recently install mate desktop on my debian and looking for this feature

Working fine on static applet like clock,window switcher and system monitor

but for dock applet it looks like this

even though it stayed in the same position after changing resolution

is there any workaround for this?

I can't tell -- is the dock applet even off-center anyway? Never mind -- the Debian logo is at the center of the screen, and the dock applet is clearly not centered on the Debian logo, so I guess it's not centered.

I'm going to have to check into that -- I noticed that the Window List applet (the one with the window buttons, not the pop-up menu) didn't always like to center on the panel, but I never replicated the behavior with anything but the Window List. Maybe the dock and the Window List have something in common -- like the dock is dynamically sized, where it accepts as much space as it can get but will also work with less than its "natural" / full size. I'm now working on it.

BTW, nice Manjaro-esque theme, if that's what you were aiming for.

EDIT: Here are the new patches complete with the capability to center dynamically-sized applets:

Here it is in action on my setup. Notice the centered Window List at the bottom of the screen, and the centered applets on the top panel (though only the window list, below, is dynamically-sized). I tried to take a snapshot with the mouse pointer at the center of the screen, as a benchmark of where dead center is, but unfortunately my screenshooter wouldn't cooperate. :man_shrugging:


The following is what I wrote earlier, before I uploaded my new patches:

I didn't test my original code with expanding / dynamically-sized applets enough, clearly. I greatly apologize for the oversight.

However I stayed up most of last night getting centering of dynamically-sized applets to work, and tested it pretty thoroughly this morning. I got it to work. I'll upload the new and improved center-stick patch very soon, and plan on contributing this code to the MATE Panel repository (if nobody complains that this patch is also broken).