fix: resolve Spectacle clicks and eliminate startup race condition causing wallpaper reset on reboot

This commit is contained in:
Sho 2026-08-02 02:08:11 +09:00
parent 7e2cd72e72
commit 4fac2f05da
4 changed files with 30 additions and 33 deletions

View File

@ -473,7 +473,7 @@ GlassPanel {
hoverEnabled: true
onClicked: {
PopupService.closeAll()
ScreenshotService.captureRegion()
CaptureService.captureRegion()
}
}
}
@ -504,7 +504,7 @@ GlassPanel {
hoverEnabled: true
onClicked: {
PopupService.closeAll()
ScreenshotService.captureFullscreen()
CaptureService.captureFullscreen()
}
}
}
@ -535,7 +535,7 @@ GlassPanel {
hoverEnabled: true
onClicked: {
PopupService.closeAll()
ScreenshotService.captureWindow()
CaptureService.captureWindow()
}
}
}
@ -586,7 +586,7 @@ GlassPanel {
hoverEnabled: true
onClicked: {
PopupService.closeAll()
ScreenshotService.recordRegion()
CaptureService.recordRegion()
}
}
}
@ -617,7 +617,7 @@ GlassPanel {
hoverEnabled: true
onClicked: {
PopupService.closeAll()
ScreenshotService.recordScreen()
CaptureService.recordScreen()
}
}
}

View File

@ -7,43 +7,33 @@ pragma Singleton
Item {
id: root
Process {
id: execProc
}
function captureRegion() {
PopupService.closeAll()
execProc.command = ["spectacle", "-r"]
execProc.running = true
Quickshell.execDetached(["spectacle", "-r"])
}
function captureFullscreen() {
PopupService.closeAll()
execProc.command = ["spectacle", "-f", "-b", "-c"]
execProc.running = true
Quickshell.execDetached(["spectacle", "-f", "-b", "-c"])
}
function captureWindow() {
PopupService.closeAll()
execProc.command = ["spectacle", "-a", "-b", "-c"]
execProc.running = true
Quickshell.execDetached(["spectacle", "-a", "-b", "-c"])
}
function recordRegion() {
PopupService.closeAll()
execProc.command = ["spectacle", "-R", "r"]
execProc.running = true
Quickshell.execDetached(["spectacle", "-R", "r"])
}
function recordScreen() {
PopupService.closeAll()
execProc.command = ["spectacle", "-R", "s"]
execProc.running = true
Quickshell.execDetached(["spectacle", "-R", "s"])
}
function openGui() {
PopupService.closeAll()
execProc.command = ["spectacle", "-g"]
execProc.running = true
Quickshell.execDetached(["spectacle", "-g"])
}
}

View File

@ -10,6 +10,7 @@ Item {
property var wallpapers: []
property string activeCustomWallpaper: ""
property var cachedThemeWallpapers: ({})
property bool isLoaded: false
// Automatic recolor watcher background daemon
Process {
@ -40,6 +41,7 @@ Item {
}
}
} catch (e) {}
root.isLoaded = true
}
}
}
@ -74,7 +76,7 @@ Item {
scanProc.running = true
}
function applyWallpaper(filePath, variantName) {
function applyWallpaper(filePath, variantName, skipSave) {
if (!filePath) return;
let vName = variantName || (Theme ? Theme.currentVariant : "")
activeCustomWallpaper = filePath
@ -89,8 +91,11 @@ Item {
}
Quickshell.execDetached(["plasma-apply-wallpaperimage", rawPath])
if (!skipSave) {
Quickshell.execDetached(["python3", Quickshell.env("HOME") + "/.config/quickshell/services/python/save_wallpaper.py", rawPath, vName])
}
}
function refresh() {
if (!scanProc.running) scanProc.running = true

View File

@ -103,7 +103,7 @@ Item {
property int blurRadius: 0
property int cornerRadius: 10
function setVariant(name) {
function setVariant(name, isStartupRestoration) {
for (let i = 0; i < variants.length; i++) {
let v = variants[i]
if (v.name === name) {
@ -164,6 +164,7 @@ Item {
AppLauncherService.reload()
if (!isStartupRestoration) {
let imgPath = getVariantWallpaper(v.name)
if (WallpaperService) {
WallpaperService.applyWallpaper(imgPath, v.name)
@ -174,6 +175,7 @@ Item {
}
let rawPath = imgPath.replace("file://", "")
Quickshell.execDetached(["sh", "-c", "wallust run '" + rawPath + "' || ~/.cargo/bin/wallust run '" + rawPath + "' 2>/dev/null || true"])
}
// Persist selected theme variant to disk
Quickshell.execDetached(["sh", "-c", "echo '" + v.name + "' > ~/.config/quickshell_current_theme.txt"])
@ -191,7 +193,7 @@ Item {
onRead: data => {
let saved = data.trim()
if (saved && saved !== "" && saved !== root.currentVariant) {
root.setVariant(saved)
root.setVariant(saved, true)
}
}
}