fix: add lock config scope

Also global lock settings
And fix some accesses
This commit is contained in:
2 * r + 2 * t 2026-04-13 00:25:16 +10:00
parent bbba6e162d
commit 8883156dd9
5 changed files with 67 additions and 60 deletions

View file

@ -11,7 +11,7 @@ Scope {
id: root
required property Lock lock
readonly property bool enabled: !Config.general.idle.inhibitWhenAudio || !Players.list.some(p => p.isPlaying)
readonly property bool enabled: !GlobalConfig.general.idle.inhibitWhenAudio || !Players.list.some(p => p.isPlaying)
function handleIdleAction(action: var): void {
if (!action)
@ -29,7 +29,7 @@ Scope {
LogindManager {
onAboutToSleep: {
if (Config.general.idle.lockBeforeSleep)
if (GlobalConfig.general.idle.lockBeforeSleep)
root.lock.lock.locked = true;
}
onLockRequested: root.lock.lock.locked = true
@ -37,7 +37,7 @@ Scope {
}
Variants {
model: Config.general.idle.timeouts
model: GlobalConfig.general.idle.timeouts
IdleMonitor {
required property var modelData

View file

@ -159,72 +159,79 @@ WlSessionLockSurface {
}
}
ScreencopyView {
id: background
ConfigScope {
id: configScope
anchors.fill: parent
captureSource: root.screen
opacity: 0
screen: root.screen
layer.enabled: true
layer.effect: MultiEffect {
autoPaddingEnabled: false
blurEnabled: true
blur: 1
blurMax: 64
blurMultiplier: 1
}
}
Item {
id: lockContent
readonly property int size: lockIcon.implicitHeight + Tokens.padding.large * 4
readonly property int radius: size / 4 * Tokens.rounding.scale
anchors.centerIn: parent
implicitWidth: size
implicitHeight: size
rotation: 180
scale: 0
StyledRect {
id: lockBg
ScreencopyView {
id: background
anchors.fill: parent
color: Colours.palette.m3surface
radius: parent.radius
opacity: Colours.transparency.enabled ? Colours.transparency.base : 1
captureSource: root.screen
opacity: 0
layer.enabled: true
layer.effect: MultiEffect {
shadowEnabled: true
blurMax: 15
shadowColor: Qt.alpha(Colours.palette.m3shadow, 0.7)
autoPaddingEnabled: false
blurEnabled: true
blur: 1
blurMax: 64
blurMultiplier: 1
}
}
MaterialIcon {
id: lockIcon
Item {
id: lockContent
readonly property int size: lockIcon.implicitHeight + Tokens.padding.large * 4
readonly property int radius: size / 4 * Tokens.rounding.scale
anchors.centerIn: parent
text: "lock"
font.pointSize: Tokens.font.size.extraLarge * 4
font.bold: true
implicitWidth: size
implicitHeight: size
rotation: 180
}
Content {
id: content
anchors.centerIn: parent
width: (root.screen?.height ?? 0) * Tokens.sizes.lock.heightMult * Tokens.sizes.lock.ratio - Tokens.padding.large * 2
height: (root.screen?.height ?? 0) * Tokens.sizes.lock.heightMult - Tokens.padding.large * 2
lock: root
opacity: 0
scale: 0
StyledRect {
id: lockBg
anchors.fill: parent
color: Colours.palette.m3surface
radius: parent.radius
opacity: Colours.transparency.enabled ? Colours.transparency.base : 1
layer.enabled: true
layer.effect: MultiEffect {
shadowEnabled: true
blurMax: 15
shadowColor: Qt.alpha(Colours.palette.m3shadow, 0.7)
}
}
MaterialIcon {
id: lockIcon
anchors.centerIn: parent
text: "lock"
font.pointSize: Tokens.font.size.extraLarge * 4
font.bold: true
rotation: 180
}
Content {
id: content
anchors.centerIn: parent
width: (root.screen?.height ?? 0) * Tokens.sizes.lock.heightMult * Tokens.sizes.lock.ratio - Tokens.padding.large * 2
height: (root.screen?.height ?? 0) * Tokens.sizes.lock.heightMult - Tokens.padding.large * 2
lock: root
opacity: 0
scale: 0
}
}
}
}

View file

@ -82,7 +82,7 @@ Scope {
property int errorTries
function checkAvail(): void {
if (!available || !Config.lock.enableFprint || !root.lock.secure) {
if (!available || !GlobalConfig.lock.enableFprint || !root.lock.secure) {
abort();
return;
}
@ -113,7 +113,7 @@ Scope {
// Isn't actually the real max tries as pam only reports completed
// when max tries is reached.
tries++;
if (tries < Config.lock.maxFprintTries) {
if (tries < GlobalConfig.lock.maxFprintTries) {
// Restart if not actually real max tries
root.fprintState = "fail";
start();
@ -188,6 +188,6 @@ Scope {
fprint.checkAvail();
}
target: Config.lock
target: GlobalConfig.lock
}
}

View file

@ -9,8 +9,8 @@ class LockConfig : public ConfigObject {
QML_ANONYMOUS
CONFIG_PROPERTY(bool, recolourLogo, false)
CONFIG_PROPERTY(bool, enableFprint, true)
CONFIG_PROPERTY(int, maxFprintTries, 3)
CONFIG_GLOBAL_PROPERTY(bool, enableFprint, true)
CONFIG_GLOBAL_PROPERTY(int, maxFprintTries, 3)
CONFIG_PROPERTY(bool, hideNotifs, false)
public:

View file

@ -19,7 +19,7 @@ Singleton {
readonly property string imagecache: `${cache}/imagecache`
readonly property string notifimagecache: `${imagecache}/notifs`
readonly property string wallsdir: Quickshell.env("CAELESTIA_WALLPAPERS_DIR") || absolutePath(Config.paths.wallpaperDir)
readonly property string wallsdir: Quickshell.env("CAELESTIA_WALLPAPERS_DIR") || absolutePath(GlobalConfig.paths.wallpaperDir)
readonly property string recsdir: Quickshell.env("CAELESTIA_RECORDINGS_DIR") || `${videos}/Recordings`
readonly property string libdir: Quickshell.env("CAELESTIA_LIB_DIR") || "/usr/lib/caelestia"