Option to remove AM/PM from clock in vertical panel (solution found)

Only if you want to brainstorm forever without getting things solved :stuck_out_tongue:

Personally I think its fine if this is still unsolved since you probably still want to get this upstreamed.

Otherwise move it to help and then you should be able to mark it as solved (would it still be solved it you move it back to brainstorm then :question:

1 Like

It would be a nice addition to the clock if they could make it add the \n only in a vertical panel. You sure wouldnā€™t want it on a horizontal panel.

1 Like

Yes this workaround looks broken on a horizontal panel:
Screenshot_20231016_223604

On a Vertical Panel this looks correct.
Screenshot_20231016_223815

Although the font looks really small. Is this supposed to look like this?

My vertical panel is 66 pixels, but I have an Ultra-Wide monitor. The font gets larger with a wider panel. On mine, I also switched to long date and it split it to multiple lines and made it larger.

When changing to Edit Mode on the panel, you can see that the section has more padding than the rest of the panel. I would try to remove some of that padding if I knew where to look for it. I donā€™t even know what that section is named. I understand why they did it. If the section had the same padding, the icons would be as large as the other icon and would fill the panel too much.

Screenshot_20231016_160912

For me, right now, with a 66 pixel panel it is wide enough to be easy for my old eyes to read. I think I will stick with what I have at the moment.

the padding on the default panel eats into the display area forcing the text to shrink, which is why i recommended moving to an empty panel which doesnā€™t have the padding.

even still, the date format will scrunch down unless you take steps to make a custom date format

thatā€™s much easier to do that editing the .qml since you can just type in the codes and see the results in real time

this is my code string for the pics posted

ddd M/d yyyy

and the clock will break the line automatically for the date so each element displays on a separate lineā€¦ if not you can force it by putting spaces in between the elements.

1 Like

a new empty panel will not have that padding, but the padding does help keep the icons only task manager icon size under control since there is no slider for that.

for a while ran with hybrid mix of the two panel types on the edge of my screen with the empty panel type for the clock and minimize widgets, and the default panel type for everything else.

but lining up the ends is a bit tedious and the kubuntu theme has a gradient effect that was noticeable if you looked closely where they met.

now they all live in the empty type panel and the task manager icons are squeezed down to size by the width of the panelā€¦ the tray icons can be set to small icons and their spacing set to small to keep them under control.

1 Like

I wonder if we could support a custom time format, as we do for the date currently.

image

I think itā€™s reasonable that users might want to customise the time format as they do the date, rather than falling back on region defaults.

For example, Iā€™d prefer the leading 0 to be dropped in 12 hour time.

We could include presets for the code formats for 12 and 24 hour time to preserve the ease of this existing functionality, as we have long, short and ISO dates currently.

3 Likes

Instead of two separate custom format fields for date and time, probably we can have one custom field that overrides everything - date, time, and timezone. The user can insert \n for line break if he likes. You can have time above date, or vice versa, or you can have them in one line.

If the user is doing custom format, then probably he is pretty advanced anyway, so I imagine this is not too difficult for him.

You can do
kpackagetool5 --install /usr/share/plasma/plasmoids/org.kde.plasma.digitalclock/
It will copy the files into ~/.local/share/plasma/plasmoids so you can make your change there. It will override any future versions of the digital clock widget.

2 Likes

We already have this - changing the applet to support an arbitrary number of lines rather than 1, 2, or 2 (other way), is going to make sizing and fitting a little more complex and ultimately someone should only need those options.

If I remember right there may have been an issue with custom time formats other than the options provided, Iā€™m not sure what though.

I might look into this one myself! Looking at the documentation we clearly have h, hh, m, mm, s, ss, etc. Plasma 6 also needs to be updated to point at the Qt 6 documentationā€¦

In horizontal layout, probably yes. But you can see a 5-line vertical layout in one of screenshots above. Sizing wonā€™t be hard at all if you replace all textboxes and paddings in the current code with a single multi-line textbox, when custom format is on.

But that would force time and date to be in the same font size, where currently they are individually fitted. Unless, of course, we enable the rich text mode and let the user specify precisely whatever font they want for each part. Instead of endlessly adding to the config dialog, probably we can keep only the most frequent options, and solve all customization needs once and for all with a single rich-text custom format textbox. And then users can select from predefined formats from store.kde.org, or make their own.

The majority of users probably wonā€™t use custom format. And those who do probably want precise control. So letā€™s give them that, and donā€™t do any automatic fitting/padding/aligning at all with a custom format.

(Oh thereā€™s already one in the store:

Perhaps Plasma 6 could use it as the default.)

Excellent. I knew there had to be a way to do this. Thank you.

if iā€™m understanding this right, this command essentially makes a local copy of your plasmoid settings for you to customize, just as there are several plasmoids in there already that iā€™ve touched or modified thru the GUI at some point.

so the .local copy overrides the defaults with your own preferences.

but does this set up a conflict with with future versions if later those features change or if the code for that plasmoid no longer uses these .qml files

would i then be missing out on feature improvements or would it fail and cause me to have to troubleshoot?

as it stands, changing the actual .gml in the /usr folder means that updates will overwirte that folder and my edits would be wiped out causing the clock to revert back to itā€™s old behavior.

at this point i would know exactly what to do from my notes, but if my .local settings take prescience, then i might not be aware the update has changed the code (potentially incorporating a feature that i want).

from a maintenance perspective, which path is better?

1 Like

6 of one and a half dozen of the other.

1 Like

The update yesterday replaced the file /usr/share/plasma/plasmoids/org.kde.plasma.digitalclock/contents/ui/DigitalClock.qml and I had to go and edit it again because whatever it fixed, it did not fix this. I would not have known about it if I had installed it into my /home

I wish I were a coder. I would happily fix this.

GAH, I spent SO long trying to solve this. Itā€™s so stupid that this isnā€™t working!! I donā€™t want an extra line with the AM/PM, I just donā€™t want it! Any attempt to make it disappear switches things to 24-hour. Ugh

I finally found this topic where others are discussing this.

I opened a bug for this back in 2018! 393956 ā€“ Digital Clock widget add custom time format

Why is this so hard??

I donā€™t even actually care about customizing the field, I want a usable clock with a vertical panel where the time is larger and no space is give for the AM/PM stuff that I donā€™t ever need to see

I do NOT accept that wasting space with a line that still shows the AM/PM text is a solution, itā€™s a very-lousy workaround that gets the time larger but at a cost of taking up more vertical panel space

Where does this line go?

And is there some possible way to not just make it lower case but also invisible (while still existing in the area where needed to trigger the 12-hour numbers)?

i think after typing that i tried and the text on the screen didnā€™t changeā€¦ so i donā€™t really lay any claim to knowing what that variable does.

the changes are made to the .qml file for the digital clock and then logout

what i did was simply put the ā€œAMā€ on a new line so the time string is not too wide to fit the width of the panel, which forces it to shrink the text to unreadable levels.

line 619 if you are plasma 5 and now line 651 if you are on plasma 6 ā€¦ from my notes

#to move the AM/PM of the 12hr digital clock to a new line, edit this .qml
#~/.local/share/plasma/plasmoids/org.kde.plasma.digitalclock/contents/ui/DigitalClock.qml
/usr/share/plasma/plasmoids/org.kde.plasma.digitalclock/contents/ui/DigitalClock.qml
#find the function timeFormatCorrection (at line ~651) and for the *if* statement change
    result += " " + amPm;
to
    result += "\n" + amPm;  // puts amPm on new line for larger font in vertical panels


Yes, I understand the two-line workaround, but I have a lot in my panel and I donā€™t want to fill extra space with a useless AM or PM indication.

I imagine I could somehow turn off the auto-sizing and force a font-size some other way such that it pushes the PM or AM off the panel to the right and disappears instead of wrapping to a new line.

I imagine thereā€™s some other way of taking the output of the time processing and just removing the final 3 characters (space and AM/PM) from the output that gets displayed.

Really, there should just be a default of not showing AM/PM for vertical panels even with 12-hour format.

FWIW, you can instead do kquitapp6 plasmashell ; kstart plasmashell
that makes it easier to play around and try to hack a solution, but I tried and failed. Itā€™s not as simple as removing something, any loss of the AM/PM in the file as is always results in 24-hour time.

i agree there should be a toggle for am/pm on the 12hr clock setting (after all who doesnā€™t know if itā€™s day or night?)

but i could not find a way so surpress the text without it reverting to the 24 hr mode (it seems to check for the presence of the text and then decide which formatā€¦ sort of a chicken&egg problem).

if you find a way to not have the text but keep the 12hr format, please share.