kde clock format: how to include the day in a non-tiny font?
Solution 1
QML
The KDE plasmoids are using qml scripts, http://en.wikipedia.org/wiki/QML .
The plasmoid scripts are at: /usr/share/plasma/plasmoids/... ie the digital clock scripts are at: /usr/share/plasma/plasmoids/org.kde.plasma.digitalclock/... You could edit those but any update will overwrite your changes.
The KDE TechBase has tutorial - Plasma5 QML2 GettingStarted: https://techbase.kde.org/Development/Tutorials/Plasma5/QML2/GettingStarted .
The Date QML Type: http://doc.qt.io/qt-5/qml-qtqml-date.html
-> Date:
-> Time:
My panel clock
Writing a quick and dirty clock.
Making:
- /tmp/mypanelclock/metadata.desktop: http://pastebin.com/PZe812VR
- /tmp/mypanelclock/contents/ui/main.qml: http://pastebin.com/WqwD49N5
- /tmp/mypanelclock/contents/ui/CompactRepresentation.qml: http://pastebin.com/9Ky7Fgj2
Opening a terminal window to the tmp directory and running command:
plasmapkg2 -i mypanelclock
The command:
:~$ plasmapkg2 --help
Usage: plasmapkg2 [options]
Plasma Package Manager
Options:
-v, --version Displays version information.
-h, --help Displays this help.
--hash <path> Generate a SHA1 hash for the package at <path>
-g, --global For install or remove, operates on packages
installed for all users.
-t, --type <type> The type of package, e.g. theme, wallpaper,
plasmoid, dataengine, runner, layout-template, etc.
-i, --install <path> Install the package at <path>
-s, --show <name> Show information of package <name>
-u, --upgrade <path> Upgrade the package at <path>
-l, --list List installed packages
--list-types List all known package types that can be installed
-r, --remove <name> Remove the package named <name>
-p, --packageroot <path> Absolute path to the package root. If not supplied,
then the standard data directories for this KDE
session will be searched instead.
Now there are available:
Adding the clock to the panel:
More of the KDE clocks: https://www.kubuntuforums.net/showthread.php?61798-Clocks
More of the qml & plasma 5: https://www.kubuntuforums.net/showthread.php?67726-Quick-KDE-plasma-qml-widgets
Solution 2
Plasma 5.4.0 has changed the plasmoid to a horizontal format. This prevents the day from being tiny. However, it still doesn't allow full customisation of the format, so if you want the day displayed, it is extremely wide.
If you want to hack the plasmoid, you can patch /usr/share/plasma/plasmoids/org.kde.plasma.digitalclock/contents/ui/DigitalClock.qml
as follows.
--- DigitalClock.qml.orig 2015-08-22 20:45:40.000000000 +1000
+++ DigitalClock.qml 2015-09-01 09:32:35.417197582 +1000
@@ -515,7 +515,7 @@
if (main.showDate) {
if (main.tooSmall) {
- dateLabelLeft.text = Qt.formatDate(main.currentTime, main.dateFormat);
+ dateLabelLeft.text = Qt.formatDate(main.currentTime, "ddd d");
} else {
dateLabel.text = Qt.formatDate(main.currentTime, main.dateFormat);
}
Related videos on Youtube
Peter Cordes
GNU/Linux hacker and command line junkie. Primary maintainer of the Stackoverflow x86 tag wiki. I like efficient code, and knowing how things really work. I mostly use C/C++ (and perl/bash) on Linux, but I mostly look at assembly-language stuff on SO because it's more interesting to me, and there are fewer people posting good asm answers. (profile pic is from https://xkcd.com/386/, and describes me perfectly. Incomplete answers/explanations make me crazy.)
Updated on September 18, 2022Comments
-
Peter Cordes almost 2 years
I'm using KDE on Kubuntu 15.04.
I want my taskbar clock to look like this:
Sun 19 15:11
(or AM/PM would be ok, main thing is Day / Date in the same font size as the time. I don't need my computer to tell me the month and year, but I do want the day and date-of-month.)
The config options for KDE's default Digital Clock applet include a "Show Date" option, but that puts the day/month/year in a TINY font under the time, instead of making the applet wider. Besides that, you can only choose short or long date format, not custom. Right click on the clock -> "Set Time Format" is the KDE-wide formatting of numbers, times, etc for your locale. I just want to change the clock, not have my file timestamps show up in a custom format.
So is there a way to customize this outside the GUI? (Other than modifying the code and building my own version of the package, I mean.) Or if not, how would I go about using a different clock applet with KDE, one that has a clock format customizable with a %letter format-string?
-
Peter Cordes about 9 yearsThanks, I'll have a look at this soon, and post when I get a customized copy working from my home directory.