@@ -141,10 +141,10 @@ SmartPanel {
141141 property var currentScreen: Quickshell .screens [currentScreenIndex]
142142 property string filterText: " "
143143 property int appearanceTabIndex: 0
144+ property int wallpaperTargetTabIndex: 0 // 0 = desktop, 1 = lock screen
144145 readonly property bool headerScreensStripAvailable: ! Settings .data .wallpaper .setWallpaperOnAllMonitors || Settings .data .wallpaper .enableMultiMonitorDirectories
145146 readonly property bool headerDevicesButtonVisible: Quickshell .screens .length > 1 || Settings .data .wallpaper .enableMultiMonitorDirectories
146147 property alias screenRepeater: screenRepeater
147-
148148 Component .onCompleted : {
149149 root .contentItem = panelContent;
150150 }
@@ -182,6 +182,13 @@ SmartPanel {
182182 }
183183 }
184184
185+ function getSelectedTargetWallpaper (screenName ) {
186+ if (wallpaperTargetTabIndex === 1 ) {
187+ return WallpaperService .getLockScreenWallpaper (screenName);
188+ }
189+ return WallpaperService .getWallpaperPathForSlot (screenName, WallpaperService .wallpaperSelectionAppearance );
190+ }
191+
185192 color: " transparent"
186193
187194 // Wallhaven settings popup
@@ -222,6 +229,7 @@ SmartPanel {
222229 wallhavenView .gridView .currentIndex = - 1 ;
223230 }
224231 panelContent .appearanceTabIndex = Settings .data .colorSchemes .darkMode ? 1 : 0 ;
232+ panelContent .wallpaperTargetTabIndex = (! Settings .data .wallpaper .enabled && Settings .data .wallpaper .enableLockScreenWallpaper ) ? 1 : 0 ;
225233 WallpaperService .wallpaperSelectionAppearance = panelContent .appearanceTabIndex === 1 ? " dark" : " light" ;
226234 // Give initial focus to search input
227235 Qt .callLater (() => {
@@ -297,7 +305,7 @@ SmartPanel {
297305 }
298306
299307 NIconButton {
300- visible: Settings .data .wallpaper .enabled
308+ visible: Settings .data .wallpaper .enabled || Settings . data . wallpaper . enableLockScreenWallpaper
301309 icon: " dark-mode"
302310 tooltipText: Settings .data .wallpaper .linkLightAndDarkWallpapers ? I18n .tr (" wallpaper.panel.header-separate-light-dark-tooltip" ) : I18n .tr (" wallpaper.panel.header-link-light-dark-tooltip" )
303311 baseSize: Style .baseWidgetSize * 0.8
@@ -350,7 +358,7 @@ SmartPanel {
350358
351359 NTabBar {
352360 id: appearanceTabBar
353- visible: Settings .data .wallpaper .enabled && ! Settings .data .wallpaper .linkLightAndDarkWallpapers
361+ visible: ( Settings .data .wallpaper .enabled || Settings . data . wallpaper . enableLockScreenWallpaper ) && ! Settings .data .wallpaper .linkLightAndDarkWallpapers
354362 Layout .fillWidth : true
355363 currentIndex: panelContent .appearanceTabIndex
356364 spacing: Style .marginM
@@ -377,6 +385,39 @@ SmartPanel {
377385 }
378386 }
379387
388+ NTabBar {
389+ id: wallpaperTargetTabBar
390+ visible: Settings .data .wallpaper .enabled || Settings .data .wallpaper .enableLockScreenWallpaper
391+ Layout .fillWidth : true
392+ currentIndex: panelContent .wallpaperTargetTabIndex
393+ spacing: Style .marginM
394+ distributeEvenly: true
395+
396+ onCurrentIndexChanged: {
397+ if (currentIndex < 0 ) {
398+ return ;
399+ }
400+ panelContent .wallpaperTargetTabIndex = currentIndex;
401+ for (var i = 0 ; i < screenRepeater .count ; i++ ) {
402+ let item = screenRepeater .itemAt (i);
403+ if (item && item .refreshWallpaperScreenData ) {
404+ item .refreshWallpaperScreenData ();
405+ }
406+ }
407+ }
408+
409+ NTabButton {
410+ text: I18n .tr (" wallpaper.panel.target-desktop-tab" )
411+ tabIndex: 0
412+ checked: wallpaperTargetTabBar .currentIndex === 0
413+ }
414+ NTabButton {
415+ text: I18n .tr (" wallpaper.panel.target-lock-screen-tab" )
416+ tabIndex: 1
417+ checked: wallpaperTargetTabBar .currentIndex === 1
418+ }
419+ }
420+
380421 NTabBar {
381422 id: screenTabBar
382423 visible: panelContent .headerScreensStripAvailable
@@ -829,12 +870,17 @@ SmartPanel {
829870 target: WallpaperService
830871 function onWallpaperChanged (screenName , path ) {
831872 if (targetScreen !== null && screenName === targetScreen .name ) {
832- currentWallpaper = WallpaperService .getWallpaperPathForSlot (targetScreen .name , WallpaperService .wallpaperSelectionAppearance );
873+ currentWallpaper = panelContent .getSelectedTargetWallpaper (targetScreen .name );
874+ }
875+ }
876+ function onLockScreenWallpaperChanged (path ) {
877+ if (targetScreen !== null ) {
878+ currentWallpaper = panelContent .getSelectedTargetWallpaper (targetScreen .name );
833879 }
834880 }
835881 function onWallpaperSelectionAppearanceChanged () {
836882 if (targetScreen !== null ) {
837- currentWallpaper = WallpaperService . getWallpaperPathForSlot (targetScreen .name , WallpaperService . wallpaperSelectionAppearance );
883+ currentWallpaper = panelContent . getSelectedTargetWallpaper (targetScreen .name );
838884 updateFiltered (false );
839885 }
840886 }
@@ -869,7 +915,7 @@ SmartPanel {
869915 return ;
870916 }
871917
872- currentWallpaper = WallpaperService . getWallpaperPathForSlot (targetScreen .name , WallpaperService . wallpaperSelectionAppearance );
918+ currentWallpaper = panelContent . getSelectedTargetWallpaper (targetScreen .name );
873919
874920 if (isBrowseMode) {
875921 // In browse mode, scan current directory for both files and directories
@@ -899,12 +945,15 @@ SmartPanel {
899945 if (isDirectory) {
900946 WallpaperService .setBrowsePath (targetScreen .name , path);
901947 } else {
902- var screen = Settings .data .wallpaper .setWallpaperOnAllMonitors ? undefined : targetScreen .name ;
903- WallpaperService .changeWallpaper (path, screen , WallpaperService .wallpaperSelectionAppearance );
904- WallpaperService .applyFavoriteTheme (path, screen , WallpaperService .wallpaperSelectionAppearance );
948+ if (panelContent .wallpaperTargetTabIndex === 1 ) {
949+ WallpaperService .changeLockScreenWallpaper (path, WallpaperService .wallpaperSelectionAppearance );
950+ } else {
951+ var screen = Settings .data .wallpaper .setWallpaperOnAllMonitors ? undefined : targetScreen .name ;
952+ WallpaperService .changeWallpaper (path, screen , WallpaperService .wallpaperSelectionAppearance );
953+ WallpaperService .applyFavoriteTheme (path, screen , WallpaperService .wallpaperSelectionAppearance );
954+ }
905955 }
906956 }
907-
908957 // Helper function to cycle view modes
909958 function cycleViewMode () {
910959 var mode = Settings .data .wallpaper .viewMode ;
@@ -1922,13 +1971,17 @@ SmartPanel {
19221971 if (typeof WallhavenService !== " undefined" ) {
19231972 WallhavenService .downloadWallpaper (wallpaper, function (success , localPath ) {
19241973 if (success) {
1925- var whScreen = Settings .data .wallpaper .setWallpaperOnAllMonitors ? undefined : Quickshell .screens [currentScreenIndex].name ;
1926- if (! Settings .data .wallpaper .setWallpaperOnAllMonitors && currentScreenIndex < Quickshell .screens .length ) {
1927- WallpaperService .changeWallpaper (localPath, Quickshell .screens [currentScreenIndex].name , WallpaperService .wallpaperSelectionAppearance );
1974+ if (panelContent .wallpaperTargetTabIndex === 1 ) {
1975+ WallpaperService .changeLockScreenWallpaper (localPath, WallpaperService .wallpaperSelectionAppearance );
19281976 } else {
1929- WallpaperService .changeWallpaper (localPath, undefined , WallpaperService .wallpaperSelectionAppearance );
1977+ var whScreen = Settings .data .wallpaper .setWallpaperOnAllMonitors ? undefined : Quickshell .screens [currentScreenIndex].name ;
1978+ if (! Settings .data .wallpaper .setWallpaperOnAllMonitors && currentScreenIndex < Quickshell .screens .length ) {
1979+ WallpaperService .changeWallpaper (localPath, Quickshell .screens [currentScreenIndex].name , WallpaperService .wallpaperSelectionAppearance );
1980+ } else {
1981+ WallpaperService .changeWallpaper (localPath, undefined , WallpaperService .wallpaperSelectionAppearance );
1982+ }
1983+ WallpaperService .applyFavoriteTheme (localPath, whScreen, WallpaperService .wallpaperSelectionAppearance );
19301984 }
1931- WallpaperService .applyFavoriteTheme (localPath, whScreen, WallpaperService .wallpaperSelectionAppearance );
19321985 }
19331986 });
19341987 }
0 commit comments