mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
lock: allow centering clock when not blurred
This commit is contained in:
@@ -54,7 +54,7 @@ Variants {
|
||||
property real clockX: (modelData.width / 2)
|
||||
property real clockY: (modelData.height / 2)
|
||||
property var textHorizontalAlignment: {
|
||||
if ((Config.options.background.lockBlur.enable && Config.options.background.lockBlur.centerClock && GlobalStates.screenLocked) || wallpaperSafetyTriggered)
|
||||
if ((Config.options.lock.centerClock && GlobalStates.screenLocked) || wallpaperSafetyTriggered)
|
||||
return Text.AlignHCenter;
|
||||
if (clockX < screen.width / 3)
|
||||
return Text.AlignLeft;
|
||||
@@ -63,7 +63,7 @@ Variants {
|
||||
return Text.AlignHCenter;
|
||||
}
|
||||
// Colors
|
||||
property bool shouldBlur: (GlobalStates.screenLocked && Config.options.background.lockBlur.enable)
|
||||
property bool shouldBlur: (GlobalStates.screenLocked && Config.options.lock.blur.enable)
|
||||
property color dominantColor: Appearance.colors.colPrimary
|
||||
property bool dominantColorIsDark: dominantColor.hslLightness < 0.5
|
||||
property color colText: {
|
||||
@@ -230,9 +230,9 @@ Variants {
|
||||
|
||||
Loader {
|
||||
id: blurLoader
|
||||
active: Config.options.background.lockBlur.enable && (GlobalStates.screenLocked || scaleAnim.running)
|
||||
active: Config.options.lock.blur.enable && (GlobalStates.screenLocked || scaleAnim.running)
|
||||
anchors.fill: wallpaper
|
||||
scale: GlobalStates.screenLocked ? Config.options.background.lockBlur.extraZoom : 1
|
||||
scale: GlobalStates.screenLocked ? Config.options.lock.blur.extraZoom : 1
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
id: scaleAnim
|
||||
@@ -243,7 +243,7 @@ Variants {
|
||||
}
|
||||
sourceComponent: GaussianBlur {
|
||||
source: wallpaper
|
||||
radius: GlobalStates.screenLocked ? Config.options.background.lockBlur.radius : 0
|
||||
radius: GlobalStates.screenLocked ? Config.options.lock.blur.radius : 0
|
||||
samples: radius * 2 + 1
|
||||
|
||||
Rectangle {
|
||||
@@ -279,7 +279,7 @@ Variants {
|
||||
}
|
||||
states: State {
|
||||
name: "centered"
|
||||
when: (bgRoot.shouldBlur && Config.options.background.lockBlur.centerClock) || bgRoot.wallpaperSafetyTriggered
|
||||
when: (GlobalStates.screenLocked && Config.options.lock.centerClock) || bgRoot.wallpaperSafetyTriggered
|
||||
AnchorChanges {
|
||||
target: clockLoader
|
||||
anchors {
|
||||
@@ -345,13 +345,19 @@ Variants {
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.alignment: {
|
||||
if (bgRoot.textHorizontalAlignment === Text.AlignHCenter || root.clockStyle === "cookie")
|
||||
return Qt.AlignHCenter;
|
||||
return (bgRoot.textHorizontalAlignment === Text.AlignLeft ? Qt.AlignLeft : Qt.AlignRight)
|
||||
}
|
||||
Layout.leftMargin: -26
|
||||
Layout.rightMargin: -26
|
||||
implicitWidth: statusTextBg.implicitWidth
|
||||
implicitHeight: statusTextBg.implicitHeight
|
||||
|
||||
StyledRectangularShadow {
|
||||
target: statusTextBg
|
||||
visible: statusTextBg.visible
|
||||
visible: statusTextBg.visible && cookieClockLoader.active
|
||||
opacity: statusTextBg.opacity
|
||||
}
|
||||
|
||||
@@ -390,7 +396,7 @@ Variants {
|
||||
}
|
||||
ClockStatusText {
|
||||
id: lockStatusText
|
||||
shown: GlobalStates.screenLocked && (!Config.options.background.lockBlur.enable || Config.options.background.lockBlur.showLockedText)
|
||||
shown: GlobalStates.screenLocked && Config.options.lock.showLockedText
|
||||
statusIcon: "lock"
|
||||
statusText: qsTr("Locked")
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ Item {
|
||||
anchors.fill: source
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 2
|
||||
radius: 8
|
||||
radius: 12
|
||||
samples: radius * 2 + 1
|
||||
color: Appearance.colors.colShadow
|
||||
transparentBorder: true
|
||||
|
||||
@@ -141,13 +141,6 @@ Singleton {
|
||||
property real workspaceZoom: 1.07 // Relative to your screen, not wallpaper size
|
||||
property bool enableSidebar: true
|
||||
}
|
||||
property JsonObject lockBlur: JsonObject {
|
||||
property bool enable: false
|
||||
property int radius: 100
|
||||
property bool centerClock: true
|
||||
property bool showLockedText: true
|
||||
property real extraZoom: 1.1
|
||||
}
|
||||
property JsonObject wallpaperSafety: JsonObject {
|
||||
property bool enable: true
|
||||
property JsonObject triggerCondition: JsonObject {
|
||||
@@ -273,6 +266,16 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
property JsonObject lock: JsonObject {
|
||||
property JsonObject blur: JsonObject {
|
||||
property bool enable: false
|
||||
property real radius: 100
|
||||
property real extraZoom: 1.1
|
||||
}
|
||||
property bool centerClock: true
|
||||
property bool showLockedText: true
|
||||
}
|
||||
|
||||
property JsonObject media: JsonObject {
|
||||
// Attempt to remove dupes (the aggregator playerctl one and browsers' native ones when there's plasma browser integration)
|
||||
property bool filterDuplicatePlayers: true
|
||||
|
||||
@@ -24,7 +24,6 @@ RowLayout {
|
||||
id: labelWidget
|
||||
Layout.fillWidth: true
|
||||
text: root.text
|
||||
font.pixelSize: Appearance.font.pixelSize.small
|
||||
color: Appearance.colors.colOnSecondaryContainer
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,37 +171,41 @@ ContentPage {
|
||||
title: Translation.tr("Blurred style")
|
||||
|
||||
ConfigSwitch {
|
||||
font.pixelSize: Appearance.font.pixelSize.large
|
||||
text: Translation.tr('Enable blur')
|
||||
checked: Config.options.background.lockBlur.enable
|
||||
checked: Config.options.lock.blur.enable
|
||||
onCheckedChanged: {
|
||||
Config.options.background.lockBlur.enable = checked;
|
||||
Config.options.lock.blur.enable = checked;
|
||||
}
|
||||
}
|
||||
|
||||
ConfigRow {
|
||||
uniform: true
|
||||
|
||||
ConfigSwitch {
|
||||
enabled: Config.options.background.lockBlur.enable
|
||||
font.pixelSize: Appearance.font.pixelSize.large
|
||||
text: Translation.tr('Center clock')
|
||||
checked: Config.options.background.lockBlur.centerClock
|
||||
onCheckedChanged: {
|
||||
Config.options.background.lockBlur.centerClock = checked;
|
||||
}
|
||||
}
|
||||
ConfigSwitch {
|
||||
enabled: Config.options.background.lockBlur.enable
|
||||
font.pixelSize: Appearance.font.pixelSize.large
|
||||
text: Translation.tr('Show "Locked" text')
|
||||
checked: Config.options.background.lockBlur.showLockedText
|
||||
onCheckedChanged: {
|
||||
Config.options.background.lockBlur.showLockedText = checked;
|
||||
}
|
||||
ConfigSpinBox {
|
||||
text: Translation.tr("Blur: Extra zoom (%)")
|
||||
value: Config.options.lock.blur.extraZoom * 100
|
||||
from: 1
|
||||
to: 150
|
||||
stepSize: 2
|
||||
onValueChanged: {
|
||||
Config.options.lock.blur.extraZoom = value / 100;
|
||||
}
|
||||
}
|
||||
|
||||
ConfigSwitch {
|
||||
text: Translation.tr('Center clock')
|
||||
checked: Config.options.lock.centerClock
|
||||
onCheckedChanged: {
|
||||
Config.options.lock.centerClock = checked;
|
||||
}
|
||||
}
|
||||
|
||||
ConfigSwitch {
|
||||
text: Translation.tr('Show "Locked" text')
|
||||
checked: Config.options.lock.showLockedText
|
||||
onCheckedChanged: {
|
||||
Config.options.lock.showLockedText = checked;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user