lid behavior watcher to lock session #115
+1
-2
@@ -1,11 +1,10 @@
|
|||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import Quickshell.Services.UPower
|
|
||||||
|
|
||||||
JsonObject {
|
JsonObject {
|
||||||
property int blurAmount: 40
|
property int blurAmount: 40
|
||||||
property bool enableFprint: true
|
property bool enableFprint: true
|
||||||
property int maxFprintTries: 3
|
property int maxFprintTries: 3
|
||||||
property bool lidWatch: UPower.displayDevice.isLaptopBattery
|
property bool lidWatch: false
|
||||||
property bool recolorLogo: false
|
property bool recolorLogo: false
|
||||||
property bool showNotifContent: false
|
property bool showNotifContent: false
|
||||||
property bool showNotifIcon: true
|
property bool showNotifIcon: true
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import Quickshell
|
||||||
|
import ZShell
|
||||||
|
|
||||||
|
Scope {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property var lock
|
||||||
|
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onLidClosing(): void {
|
||||||
|
root.lock.lock.locked = true;
|
||||||
|
AramJonghu marked this conversation as resolved
Outdated
|
|||||||
|
}
|
||||||
|
|
||||||
|
target: LidWatcher
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import qs.Modules.Settings.Categories.Lockscreen
|
import qs.Modules.Settings.Categories.Lockscreen
|
||||||
import qs.Modules.Settings.Controls
|
import qs.Modules.Settings.Controls
|
||||||
|
import qs.Helpers
|
||||||
import qs.Config
|
import qs.Config
|
||||||
|
|
||||||
SettingsPage {
|
SettingsPage {
|
||||||
@@ -63,9 +64,11 @@ SettingsPage {
|
|||||||
name: "Laptop lid watch to lock session"
|
name: "Laptop lid watch to lock session"
|
||||||
object: Config.lock
|
object: Config.lock
|
||||||
setting: "lidWatch"
|
setting: "lidWatch"
|
||||||
|
shouldBeActive: Battery.isLaptop
|
||||||
}
|
}
|
||||||
|
|
||||||
Separator {
|
Separator {
|
||||||
|
shouldBeActive: Battery.isLaptop
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingSpinBox {
|
SettingSpinBox {
|
||||||
|
|||||||
@@ -326,6 +326,13 @@ export const settingsIndex = [
|
|||||||
section: "Lockscreen",
|
section: "Lockscreen",
|
||||||
keywords: ["notification", "hide", "icon"],
|
keywords: ["notification", "hide", "icon"],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Laptop lid watch to lock session",
|
||||||
|
category: "lockscreen",
|
||||||
|
categoryName: "Lockscreen",
|
||||||
|
section: "Lockscreen",
|
||||||
|
keywords: ["lid", "lcck", "watch", "session", "laptop"],
|
||||||
|
AramJonghu marked this conversation as resolved
Outdated
zach
commented
Typo probably. Typo probably. `"lcck"` should be `"lock"`
|
|||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Blur amount",
|
name: "Blur amount",
|
||||||
category: "lockscreen",
|
category: "lockscreen",
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Services.UPower
|
import Quickshell.Services.UPower
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import ZShell
|
|
||||||
import qs.Modules
|
import qs.Modules
|
||||||
import qs.Modules.Wallpaper
|
import qs.Modules.Wallpaper
|
||||||
import qs.Modules.Lock
|
import qs.Modules.Lock
|
||||||
@@ -38,15 +37,6 @@ ShellRoot {
|
|||||||
id: lock
|
id: lock
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
|
||||||
enabled: Config.lock.lidWatch
|
|
||||||
function onLidClosing(): void {
|
|
||||||
lock.lock.locked = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
target: LidWatcher
|
|
||||||
}
|
|
||||||
|
|
||||||
Shortcuts {
|
Shortcuts {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +47,13 @@ ShellRoot {
|
|||||||
Polkit {
|
Polkit {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LazyLoader {
|
||||||
|
activeAsync: Config.lock.lidWatch && Battery.isLaptop
|
||||||
|
component: LidService {
|
||||||
|
lock: lock
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LazyLoader {
|
LazyLoader {
|
||||||
activeAsync: root.laptop
|
activeAsync: root.laptop
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user
You need to create a signal in the root
Scopeand call it here rather than setting the locked value directly.Is what I suggest, ties in nicely with a similar signal related to locking.