forked from Shinonome/dots-hyprland
background: add option to only show clock when locked (#2387)
This commit is contained in:
@@ -148,6 +148,7 @@ Singleton {
|
|||||||
property JsonObject widgets: JsonObject {
|
property JsonObject widgets: JsonObject {
|
||||||
property JsonObject clock: JsonObject {
|
property JsonObject clock: JsonObject {
|
||||||
property bool enable: true
|
property bool enable: true
|
||||||
|
property bool showOnlyWhenLocked: false
|
||||||
property string placementStrategy: "leastBusy" // "free", "leastBusy", "mostBusy"
|
property string placementStrategy: "leastBusy" // "free", "leastBusy", "mostBusy"
|
||||||
property real x: 100
|
property real x: 100
|
||||||
property real y: 100
|
property real y: 100
|
||||||
|
|||||||
@@ -16,8 +16,9 @@ AbstractBackgroundWidget {
|
|||||||
implicitHeight: contentColumn.implicitHeight
|
implicitHeight: contentColumn.implicitHeight
|
||||||
implicitWidth: contentColumn.implicitWidth
|
implicitWidth: contentColumn.implicitWidth
|
||||||
|
|
||||||
property string clockStyle: Config.options.background.widgets.clock.style
|
readonly property string clockStyle: Config.options.background.widgets.clock.style
|
||||||
property bool forceCenter: (GlobalStates.screenLocked && Config.options.lock.centerClock)
|
readonly property bool forceCenter: (GlobalStates.screenLocked && Config.options.lock.centerClock)
|
||||||
|
readonly property bool shouldShow: (!Config.options.background.widgets.clock.showOnlyWhenLocked || GlobalStates.screenLocked)
|
||||||
property bool wallpaperSafetyTriggered: false
|
property bool wallpaperSafetyTriggered: false
|
||||||
needsColText: clockStyle === "digital"
|
needsColText: clockStyle === "digital"
|
||||||
x: forceCenter ? ((root.screenWidth - root.width) / 2) : targetX
|
x: forceCenter ? ((root.screenWidth - root.width) / 2) : targetX
|
||||||
@@ -42,7 +43,7 @@ AbstractBackgroundWidget {
|
|||||||
FadeLoader {
|
FadeLoader {
|
||||||
id: cookieClockLoader
|
id: cookieClockLoader
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
shown: root.clockStyle === "cookie"
|
shown: root.clockStyle === "cookie" && (root.shouldShow)
|
||||||
sourceComponent: Column {
|
sourceComponent: Column {
|
||||||
CookieClock {
|
CookieClock {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
@@ -58,7 +59,7 @@ AbstractBackgroundWidget {
|
|||||||
FadeLoader {
|
FadeLoader {
|
||||||
id: digitalClockLoader
|
id: digitalClockLoader
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
shown: root.clockStyle === "digital"
|
shown: root.clockStyle === "digital" && (root.shouldShow)
|
||||||
sourceComponent: ColumnLayout {
|
sourceComponent: ColumnLayout {
|
||||||
id: clockColumn
|
id: clockColumn
|
||||||
spacing: 6
|
spacing: 6
|
||||||
|
|||||||
@@ -97,6 +97,15 @@ ContentPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfigSwitch {
|
||||||
|
buttonIcon: "lock_clock"
|
||||||
|
text: Translation.tr("Show only when locked")
|
||||||
|
checked: Config.options.background.widgets.clock.showOnlyWhenLocked
|
||||||
|
onCheckedChanged: {
|
||||||
|
Config.options.background.widgets.clock.showOnlyWhenLocked = checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ContentSubsection {
|
ContentSubsection {
|
||||||
title: Translation.tr("Clock style")
|
title: Translation.tr("Clock style")
|
||||||
ConfigSelectionArray {
|
ConfigSelectionArray {
|
||||||
|
|||||||
Reference in New Issue
Block a user