Skip to content

Commit fcc44c0

Browse files
committed
feat: lock screen copy and transitions
- additionally add python3 and lefthook install shellHook in shell.nix
1 parent 7b29c11 commit fcc44c0

8 files changed

Lines changed: 115 additions & 23 deletions

File tree

Assets/Translations/en-GB.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,8 +1424,10 @@
14241424
"enable-lockscreen-media-controls-label": "Lock screen media controls",
14251425
"lock-on-suspend-description": "Automatically lock the screen when suspending the system.",
14261426
"lock-on-suspend-label": "Lock on suspend",
1427-
"lock-screen-animations-description": "Enable or disable lockscreen animations.",
1428-
"lock-screen-animations-label": "Lockscreen animations",
1427+
"lock-screen-animations-description": "Enable or disable lock screen animations and transitions.",
1428+
"lock-screen-animations-label": "Lock screen animations",
1429+
"lock-screen-copy-bg-description": "Instead of the wallpaper, use a screenshot of the desktop as the background of the lockscreen.",
1430+
"lock-screen-copy-bg-label": "Use screenshot as background",
14291431
"lock-screen-blur-strength-description": "Applies a blur effect to the lock screen wallpaper.",
14301432
"lock-screen-blur-strength-label": "Lock screen blur strength",
14311433
"lock-screen-tint-strength-description": "Applies a tint overlay to the lock screen wallpaper.",
@@ -2246,4 +2248,4 @@
22462248
"weak": "Weak"
22472249
}
22482250
}
2249-
}
2251+
}

Assets/Translations/en.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,8 +1424,10 @@
14241424
"enable-lockscreen-media-controls-label": "Lock screen media controls",
14251425
"lock-on-suspend-description": "Automatically lock the screen when suspending the system.",
14261426
"lock-on-suspend-label": "Lock on suspend",
1427-
"lock-screen-animations-description": "Enable or disable lockscreen animations.",
1428-
"lock-screen-animations-label": "Lockscreen animations",
1427+
"lock-screen-animations-description": "Enable or disable lock screen animations and transitions.",
1428+
"lock-screen-animations-label": "Lock screen animations",
1429+
"lock-screen-copy-bg-description": "Instead of the wallpaper, use a screenshot of the desktop as the background of the lockscreen.",
1430+
"lock-screen-copy-bg-label": "Use screenshot as background",
14291431
"lock-screen-blur-strength-description": "Applies a blur effect to the lock screen wallpaper.",
14301432
"lock-screen-blur-strength-label": "Lock screen blur strength",
14311433
"lock-screen-tint-strength-description": "Applies a tint overlay to the lock screen wallpaper.",
@@ -2246,4 +2248,4 @@
22462248
"weak": "Weak"
22472249
}
22482250
}
2249-
}
2251+
}

Assets/settings-search-index.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,6 +1718,15 @@
17181718
"subTab": 0,
17191719
"subTabLabel": "common.appearance"
17201720
},
1721+
{
1722+
"labelKey": "panels.lock-screen.lock-screen-copy-bg-label",
1723+
"descriptionKey": "panels.lock-screen.lock-screen-copy-bg-description",
1724+
"widget": "NToggle",
1725+
"tab": 11,
1726+
"tabLabel": "panels.lock-screen.title",
1727+
"subTab": 0,
1728+
"subTabLabel": "common.appearance"
1729+
},
17211730
{
17221731
"labelKey": "panels.lock-screen.lock-screen-blur-strength-label",
17231732
"descriptionKey": "panels.lock-screen.lock-screen-blur-strength-description",

Commons/Settings.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ Singleton {
286286
property bool animationDisabled: false
287287
property bool compactLockScreen: false
288288
property bool lockScreenAnimations: false
289+
property bool lockScreenCopyBg: false
289290
property bool lockOnSuspend: true
290291
property bool showSessionButtonsOnLockScreen: true
291292
property bool showHibernateOnLockScreen: false

Modules/LockScreen/LockScreen.qml

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,45 @@ Loader {
6666
Item {
6767
id: lockContainer
6868

69+
readonly property bool transitionsEnabled: Settings.data.general.lockScreenAnimations
70+
71+
property real transitionProgress: transitionsEnabled ? 0.0 : 1.0
72+
73+
NumberAnimation {
74+
id: lockEnter
75+
target: lockContainer
76+
property: "transitionProgress"
77+
to: 1.0
78+
duration: Style.animationNormal
79+
easing.type: Easing.OutCubic
80+
running: transitionsEnabled
81+
}
82+
83+
function unlockScreen() {
84+
lockSession.locked = false;
85+
root.scheduleUnloadAfterUnlock();
86+
lockContext.currentText = "";
87+
}
88+
89+
NumberAnimation {
90+
id: lockExit
91+
target: lockContainer
92+
property: "transitionProgress"
93+
to: 0.0
94+
duration: Style.animationNormal
95+
easing.type: Easing.InCubic
96+
onFinished: unlockScreen()
97+
}
98+
6999
LockContext {
70100
id: lockContext
71101
onUnlocked: {
72-
lockSession.locked = false;
73-
root.scheduleUnloadAfterUnlock();
74-
lockContext.currentText = "";
102+
if (transitionsEnabled) {
103+
lockEnter.stop();
104+
lockExit.start();
105+
return;
106+
}
107+
unlockScreen();
75108
}
76109
onFailed: {
77110
lockContext.currentText = "";
@@ -123,10 +156,12 @@ Loader {
123156
LockScreenBackground {
124157
id: backgroundComponent
125158
screen: lockSurface.screen
159+
transitionProgress: lockContainer.transitionProgress
126160
}
127161

128162
Item {
129163
anchors.fill: parent
164+
opacity: lockContainer.transitionProgress
130165

131166
// Mouse area to trigger focus on cursor movement (workaround for Hyprland focus issues)
132167
MouseArea {

Modules/LockScreen/LockScreenBackground.qml

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import QtQuick
22
import QtQuick.Effects
33
import Quickshell
4+
import Quickshell.Wayland
45
import qs.Commons
56
import qs.Services.Compositor
67
import qs.Services.Power
@@ -10,11 +11,18 @@ Item {
1011
id: root
1112
anchors.fill: parent
1213

14+
required property ShellScreen screen
15+
1316
// Cached wallpaper path - exposed for parent components
1417
property string resolvedWallpaperPath: ""
15-
property color tintColor: Settings.data.colorSchemes.darkMode ? Color.mSurface : Color.mOnSurface
1618

17-
required property var screen
19+
// Enter / exit transtion value
20+
property real transitionProgress: 1.0
21+
22+
readonly property color tintColor: Settings.data.colorSchemes.darkMode ? Color.mSurface : Color.mOnSurface
23+
readonly property bool useEffects: !PowerProfileService.noctaliaPerformanceMode || !Settings.data.noctaliaPerformance.disableWallpaper
24+
readonly property bool useScreencopy: Settings.data.general.lockScreenCopyBg
25+
readonly property bool useWallpaper: Settings.data.wallpaper.enabled && resolvedWallpaperPath !== ""
1826

1927
// Request preprocessed wallpaper when lock screen becomes active or dimensions change
2028
Component.onCompleted: {
@@ -103,35 +111,56 @@ Item {
103111
});
104112
}
105113

106-
// Background - solid color or black fallback
114+
// Opaque black at the very bottom to prevent white flash
107115
Rectangle {
108116
anchors.fill: parent
109-
color: Settings.data.wallpaper.useSolidColor ? Settings.data.wallpaper.solidColor : "#000000"
117+
color: "black"
110118
}
111119

120+
// A copy of the screen to use as background
121+
// Also used as fade in / fade out backdrop
122+
ScreencopyView {
123+
id: lockBgScreencopy
124+
visible: useEffects && (useScreencopy || useWallpaper)
125+
anchors.fill: parent
126+
captureSource: screen
127+
}
128+
129+
// If using a solid color wallpaper
130+
Rectangle {
131+
anchors.fill: parent
132+
opacity: (Settings.data.wallpaper.useSolidColor && useEffects) ? transitionProgress : 0.0
133+
color: Settings.data.wallpaper.solidColor
134+
}
135+
136+
// If using an image wallpaper
112137
Image {
113138
id: lockBgImage
114-
visible: source !== "" && Settings.data.wallpaper.enabled && !Settings.data.wallpaper.useSolidColor && (!PowerProfileService.noctaliaPerformanceMode || !Settings.data.noctaliaPerformance.disableWallpaper)
139+
visible: false // rendered with effects below
115140
anchors.fill: parent
116141
fillMode: Image.PreserveAspectCrop
117142
source: resolvedWallpaperPath
118143
cache: false
119144
smooth: true
120145
mipmap: false
121146
antialiasing: true
147+
}
122148

123-
layer.enabled: Settings.data.general.lockScreenBlur > 0 && !PowerProfileService.noctaliaPerformanceMode
124-
layer.smooth: false
125-
layer.effect: MultiEffect {
126-
blurEnabled: true
127-
blur: Settings.data.general.lockScreenBlur
128-
blurMax: 48
129-
}
149+
// Applies the image wallpaper or screen copy with effects
150+
MultiEffect {
151+
id: lockBgRender
152+
anchors.fill: parent
153+
opacity: transitionProgress
154+
visible: useEffects && (useScreencopy || useWallpaper)
155+
source: useScreencopy ? lockBgScreencopy : lockBgImage
156+
157+
blurEnabled: Settings.data.general.lockScreenBlur > 0
158+
blur: Settings.data.general.lockScreenBlur
159+
blurMax: 128
130160

131-
// Tint overlay
132161
Rectangle {
133162
anchors.fill: parent
134-
color: root.tintColor
163+
color: tintColor
135164
opacity: Settings.data.general.lockScreenTint
136165
}
137166
}

Modules/Panels/Settings/Tabs/LockScreen/AppearanceSubTab.qml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ ColumnLayout {
9393
defaultValue: Settings.getDefaultValue("general.lockScreenAnimations")
9494
}
9595

96+
NToggle {
97+
label: I18n.tr("panels.lock-screen.lock-screen-copy-bg-label")
98+
description: I18n.tr("panels.lock-screen.lock-screen-copy-bg-description")
99+
checked: Settings.data.general.lockScreenCopyBg
100+
onToggled: checked => Settings.data.general.lockScreenCopyBg = checked
101+
defaultValue: Settings.getDefaultValue("general.lockScreenCopyBg")
102+
}
103+
96104
NValueSlider {
97105
Layout.fillWidth: true
98106
label: I18n.tr("panels.lock-screen.lock-screen-blur-strength-label")

nix/shell.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
shellcheck,
88
jsonfmt,
99
lefthook,
10+
python3,
1011
kdePackages,
1112
mkShellNoCC,
1213
}:
@@ -29,6 +30,11 @@ mkShellNoCC {
2930

3031
# CoC
3132
lefthook # githooks
33+
python3 # dev scripts
3234
kdePackages.qtdeclarative # qmlfmt, qmllint, qmlls and etc; Qt6
3335
];
36+
37+
shellHook = ''
38+
lefthook install
39+
'';
3440
}

0 commit comments

Comments
 (0)