MarianArlt / kde-plasmoid-betterinlineclock

Your usual clock widget, just way better and on a single line!
https://www.opendesktop.org/p/1245902
GNU General Public License v3.0
20 stars 14 forks source link

Fix clock width when not in 24-hours #9

Closed adelq closed 4 years ago

adelq commented 4 years ago

In many configurations, the clock width is not sufficient with the current method of calculating out the appropriate widget width, so the right side of the plasmoid is clipped as in issue #8. I have tried the suggestion in the reply by @qiaojunfeng and it works perfectly as far as I can tell with less complexity in the size calculations. I am also not experienced in plasmoid development, so would like to hear why this code was there initially and if this is the appropriate fix for the bug without introducing new bugs.

Fixes #8

dofrancis commented 4 years ago

Screenshot_20200407_134147 When I tried the fix from @qiaojunfeng , times with two digits for the hour looked fine, but times with one digit for the hour had too much space on the right.

adelq commented 4 years ago

Yes, I've noticed that there is more padding on the right with 1 digit for the hour as well, but without the fix, the text PM/AM is clipped on the right with 2 digits for the hour.

MITHX commented 4 years ago

This has been bugging me as well. I don't know anything about qml or plasmoids either, but I tried a little tinkering. I changed the "new" line 164 from

width: sizehelper.contentWidth

to

width: timeLabel.paintedWidth

This seems to push the widgets to the left of the clock "away" while maintaining the margin on the right and left. I checked both gnome and xfce and the behavior of widgets to the left of the clock being pushed away seems to be the expected behavior. Here is a visual of my "fix" on my desktop.

clock

adelq commented 4 years ago

@MITHX I tested your change and it works perfectly. I've updated the pull request with your suggestion. Thanks!

MarianArlt commented 4 years ago

Thank you very much for looking into this. I didn't have the time yet to do so, although being a small thing. Sorry everyone for taking so long. Merged now and soon to be published.