KDE 6.0.5 No matter what settings I change (this has been a while now, but I’ve just been living with this First World Problem), I haven’t been able to get my Login and Lock Screens to display a 24 hour clock by default. After a bit of digging, I believe I’ll have to edit a ‘Clock.qml’ file, as referenced here but, after looking, I realize that there’s no ‘Clock.qml’ file located anywhere within either the breath or breeze theme directories I use, nor are there clock settings within any of the other *.qml files.
Should I be able to create the file with the setting(s) for displaying a 24 hour clock? Where exactly should it be located? Thank you.
Locale settings are correct, login screen time always displays 12 hour clock no matter what settings I change. I presume because it’s default and not reading any settings dictating otherwise. I’m thinking it’s because there’s no Clock.qml file present.
Can you confirm you have or don’t have this file anywhere within /usr/share/sddm/themes/..
Enable a locale with 24-hour support in /etc/locale.gen, rebuild your locales with locale-gen, and set LC_TIME to said locale. I recommend en_GB.UTF-8 — it’s what I use too.
How do I set LC_TIME? I tried en_US.UTF-8 (which showed 24 hour display in the preview) in System Settings > Region & Language, rebooted to no avail. I initially ran sudo locale-gen and rebooted to no avail, then tried the aforementioned with the System Settings.
cat /usr/share/sddm/themes/Infinity-SDDM/components/Clock.qml
/*
* Copyright 2016 David Edmundson <davidedmundson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.8
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.5
import org.kde.plasma.core 2.0
ColumnLayout {
readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software
Label {
text: Qt.formatTime(timeSource.data["Local"]["DateTime"])
color: ColorScope.textColor
style: softwareRendering ? Text.Outline : Text.Normal
styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" //no outline, doesn't matter
font.pointSize: 28
Layout.alignment: Qt.AlignHCenter
}
Label {
text: Qt.formatDate(timeSource.data["Local"]["DateTime"], Qt.DefaultLocaleLongDate)
color: ColorScope.textColor
style: softwareRendering ? Text.Outline : Text.Normal
styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" //no outline, doesn't matter
font.pointSize: 24
Layout.alignment: Qt.AlignHCenter
}
DataSource {
id: timeSource
engine: "time"
connectedSources: ["Local"]
interval: 1000
}
}
Component.onCompleted: {
function updateClockString() {
// there are two childitems you can play with here
clock.children[0].text = Qt.formatTime(clock.data[0].data["Local"]["DateTime"], 'hh:mm:ss');
clock.children[1].text = Qt.formatDate(clock.data[0].data["Local"]["DateTime"], 'ddd. MMM. dd, yyyy');
//clock.children[1].text = "LOL HI GITHUB";
}
updateClockString();
clock.data[0].onDataChanged.connect(updateClockString);
}
Only today did I figure out how to accomplish setting the clock and time formats for sddm (/usr/share/sddm/themes/) and Lock Screen (/usr/share/plasma/look-and-feel/org.kde.breeze.desktop/contents/lockscreen/LockScreenUi.qml, since I’m using Breeze), applying the new lines to the respective files, editing the time/date format to your preferences. Changes were immediate.
I’m very sorry for the “necro-bump.” Absolutely nothing I ever tried, before this, worked—nothing. Thank you for understanding.