1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-26 22:42:50 -05:00

lockscreen/greetd: add 0 in front of single digit hours for 12 hour format. greetd: add option to hide profile image (#1247)

* greetd: add lockScreenShowProfileImage option

* lockscreen/greetd: for non 24 hour formats, add 0 in front of single digit hours to ensure that everything is always centered properly - previously, it would only appear centered if on a double digit hour. also add getEffectiveTimeFormat function to GreetdSettings.

* clock: made pad 12 hour formats optional

---------

Co-authored-by: bbedward <bbedward@gmail.com>
This commit is contained in:
Ethan Todd
2026-01-23 14:47:59 -05:00
committed by GitHub
parent b4ba2dac37
commit 11e23feb0e
6 changed files with 43 additions and 17 deletions

View File

@@ -30,13 +30,13 @@ BasePill {
StyledText {
text: {
if (SettingsData.use24HourClock) {
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(0);
} else {
const hours = systemClock?.date?.getHours();
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
const hours = systemClock?.date?.getHours();
if (SettingsData.use24HourClock)
return String(hours).padStart(2, '0').charAt(0);
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
if (SettingsData.padHours12Hour)
return String(display).padStart(2, '0').charAt(0);
}
return display >= 10 ? String(display).charAt(0) : "";
}
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
color: Theme.widgetTextColor
@@ -47,13 +47,13 @@ BasePill {
StyledText {
text: {
if (SettingsData.use24HourClock) {
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(1);
} else {
const hours = systemClock?.date?.getHours();
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
const hours = systemClock?.date?.getHours();
if (SettingsData.use24HourClock)
return String(hours).padStart(2, '0').charAt(1);
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
if (SettingsData.padHours12Hour)
return String(display).padStart(2, '0').charAt(1);
}
return display >= 10 ? String(display).charAt(1) : String(display);
}
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
color: Theme.widgetTextColor