mate-desktop / mate-panel

MATE panel
https://mate-desktop.org
GNU General Public License v2.0
184 stars 115 forks source link

Clock applet changes width as the time changes. #1338

Open j3pic opened 1 year ago

j3pic commented 1 year ago

Expected behaviour

The clock applet should be exactly the same width all the time.

Actual behaviour

The clock's width is affected by the width of the time in the font used to render the time. As a result, the clock's width changes.

This image shows the clock at two different times. The second time is wider, so the volume control, network dropdown, and weather applets all get pushed to the left.

image

Steps to reproduce the behaviour

Turn on the clock's second hand. Now watch as the entire upper-right panel jumps around every second.

MATE general version

Package version

mate-desktop "1.20.5-1"

Linux Distribution

Debian

Link to bugreport of your Distribution (requirement)

I didn't make a Debian bug report because the "report-bug" tool doesn't work.

lukefromdc commented 1 year ago

This can only be stopped by setting a minimum width for the applet in css. This could be edited into your GTK theme or added to ~/.config/gtk-3.0/gtk.css, the latter is preferred as it will not be overwritten on updates and will be applied to all themes.

I just tested with this code in ~/.config/gtk-3.0/gtk.css and it worked.

 #clock-applet-button>box>label {
min-width: 190px;
}

Adjust the width as necessary to fit your font and the options you are using in the clock

To do this by default in the panel as distributed would require setting the css in the applet itself not the themes. This is because it requires modifying the css used to adjust for the presence or absence of weather, temperature, seconds and day of week would be difficult due to the use by users of fonts of varying width If all clock options are turned on, there is a GtkImage and two GtkLabels packed into the button. The widget chain #clock-applet-button>box>label should select only the label containing the time and date, but code would have to be included in the applet source code to set it there-and set it to different values depending on font, presence or absence of day of week, presence or absence of date, 12 or 24 hour format, and date format if used at the very least.

I don't know if you (or someone else) are up for coding this or not, but I will be happy to test a PR applying this

raveit65 commented 1 year ago

I do not see that with mate-panel-1.26.3 from actual master, Blue-Menta theme and fedora 38.

Package version mate-desktop "1.20.5-1"

You're using a very old and EOL since years version. Please update to Mate 1.26. I think that is already fixed in actual stable panel version.

Tho144 commented 8 months ago

I wanted to report this a long while ago. I am using Mate 1.26.0 Mate Panel version is 1.27.0 , clock applet version is also 1.27.0

I wanted to try suggested css edit, but I couldn't find the ~/.config/gtk-3.0/gtk.css file. In "gtk-3.0" folder I only have "settings.ini" and "bookmarks" (a text file). Also no gtk.css file under "gtk-2.0" or "gtk-4.0" folders in ~/.config , if relevant. Search for this file gave no results.

My solution for now is to turn off seconds display for the clock.

lukefromdc commented 8 months ago

~/.config/gtk-3.0/gtk.css does not exist by default, create it if it is not present. Also note that nothing under gtk-2.0 or gtk-4.0 will affect current versions of MATE

Tho144 commented 8 months ago

Thank you @lukefromdc , I created the file as you pointed, with

clock-applet-button>box>label {

min-width: 190px; } After log-off and on again, the clock now acts better with seconds display. While I can still see the clock text "pulsating", the clock is indeed limited to a fixed-size area.