Can't set Login or Lock screen time to default to displaying 24 hour clock

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.

What is the actual “problem” or issue that you struggle with?

Time format when time is displayed … where?
lock screen?
login screen?

Is it different from what you set it to in your normal graphical environment?

It could be a matter of the systems locale settings - these are used when your personalized ones are not used … when you are not yet logged in …

I’m pretty sure / confident
that no *.qml files need to be edited

I just checked mine and it’s in 24-hour format (wouldn’t want anything else). I guess it follows the panel clock settings? Is that in 24-hour mode?

Maybe try different themes for the lock/login screen, but I’m sure mine is one of the two you mentioned.

Oops @Nachlese already mentioned the normal GUI. Didn’t see that. :man_facepalming:

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/..

Maybe you can get some ideas from this similar thread on the EndeavourOS forum.

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.

You’ll need to reboot after making the changes.

1 Like

I do:

ls -R /usr/share/sddm/themes/ | grep -i clock.qml
Clock.qml
SpClock.qml

In my case: /usr/share/sddm/themes/Infinity-SDDM/components/

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.

Ran it, no Clock.qml file

Contents of mine for reference:

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
    }
}

Read this tutorial below… :point_down:

            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.

FWIW I’m also currently on KDE 6.3.6

And will all be undone again at the next Plasma update. /usr is not the place for editing anything.

The correct way to do it would be to enable the locale for en_GB.UTF-8 and set LC_TIME=en_GB.UTF-8.

I wish that had worked for me. Thank you.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.