-
-
Notifications
You must be signed in to change notification settings - Fork 697
Expand file tree
/
Copy pathLock.qml
More file actions
74 lines (59 loc) · 1.56 KB
/
Copy pathLock.qml
File metadata and controls
74 lines (59 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Io
import Quickshell.Wayland
import qs.components.misc
Scope {
property alias lock: lock
WlSessionLock {
id: lock
signal unlock
LockSurface {
lock: lock
pam: pam
}
}
Pam {
id: pam
lock: lock
}
Loader {
asynchronous: true
active: Quickshell.screens.length > 0
onLoaded: active = false
// Force a load of a screencopy so the one in the lock works
// My guess is the ICC backend loads async on first request, which if the lock is
// the first request it fails to capture (because it's async and the compositor
// refuses capture when locked)
sourceComponent: ScreencopyView {
captureSource: Quickshell.screens[0]
}
}
// qmllint disable unresolved-type
CustomShortcut {
// qmllint enable unresolved-type
name: "lock"
description: "Lock the current session"
onPressed: lock.locked = true
}
// qmllint disable unresolved-type
CustomShortcut {
// qmllint enable unresolved-type
name: "unlock"
description: "Unlock the current session"
onPressed: lock.unlock()
}
IpcHandler {
function lock(): void {
lock.locked = true;
}
function unlock(): void {
lock.unlock();
}
function isLocked(): bool {
return lock.locked;
}
target: "lock"
}
}