From bb6baa5f5e0461ccf6f52b9ba73186fb23815669 Mon Sep 17 00:00:00 2001 From: Sho Date: Sun, 2 Aug 2026 14:09:48 +0900 Subject: [PATCH] feat: automatically sync KDE KScreenLocker lockscreen wallpaper with current desktop wallpaper --- quickshell/services/WallpaperService.qml | 2 ++ quickshell/services/python/save_wallpaper.py | 7 +++++++ quickshell/theme/Theme.qml | 1 + 3 files changed, 10 insertions(+) diff --git a/quickshell/services/WallpaperService.qml b/quickshell/services/WallpaperService.qml index 348057f..88bbfd5 100644 --- a/quickshell/services/WallpaperService.qml +++ b/quickshell/services/WallpaperService.qml @@ -38,6 +38,7 @@ Item { Theme.wallpaperPath = fileUrl let rawPath = parsed.wallpaper.replace("file://", "") Quickshell.execDetached(["plasma-apply-wallpaperimage", rawPath]) + Quickshell.execDetached(["kwriteconfig6", "--file", "kscreenlockerrc", "--group", "Greeter", "--group", "Wallpaper", "--group", "org.kde.image", "--group", "General", "--key", "Image", "file://" + rawPath]) } } } catch (e) {} @@ -91,6 +92,7 @@ Item { } Quickshell.execDetached(["plasma-apply-wallpaperimage", rawPath]) + Quickshell.execDetached(["kwriteconfig6", "--file", "kscreenlockerrc", "--group", "Greeter", "--group", "Wallpaper", "--group", "org.kde.image", "--group", "General", "--key", "Image", "file://" + rawPath]) if (!skipSave) { Quickshell.execDetached(["python3", Quickshell.env("HOME") + "/.config/quickshell/services/python/save_wallpaper.py", rawPath, vName]) diff --git a/quickshell/services/python/save_wallpaper.py b/quickshell/services/python/save_wallpaper.py index f5e7874..9a562c7 100755 --- a/quickshell/services/python/save_wallpaper.py +++ b/quickshell/services/python/save_wallpaper.py @@ -36,5 +36,12 @@ def save_wallpaper(): except Exception: pass + try: + import subprocess + file_url = wp_path if wp_path.startswith("file://") else f"file://{wp_path}" + subprocess.run(["kwriteconfig6", "--file", "kscreenlockerrc", "--group", "Greeter", "--group", "Wallpaper", "--group", "org.kde.image", "--group", "General", "--key", "Image", file_url], capture_output=True) + except Exception: + pass + if __name__ == '__main__': save_wallpaper() diff --git a/quickshell/theme/Theme.qml b/quickshell/theme/Theme.qml index e1921a4..ba17469 100644 --- a/quickshell/theme/Theme.qml +++ b/quickshell/theme/Theme.qml @@ -182,6 +182,7 @@ Item { wallpaperPath = imgPath.startsWith("file://") ? imgPath : "file://" + imgPath let rawPath = imgPath.replace("file://", "") Quickshell.execDetached(["plasma-apply-wallpaperimage", rawPath]) + Quickshell.execDetached(["kwriteconfig6", "--file", "kscreenlockerrc", "--group", "Greeter", "--group", "Wallpaper", "--group", "org.kde.image", "--group", "General", "--key", "Image", "file://" + rawPath]) } let rawPath = imgPath.replace("file://", "") Quickshell.execDetached(["sh", "-c", "wallust run '" + rawPath + "' || ~/.cargo/bin/wallust run '" + rawPath + "' 2>/dev/null || true"])