fix: resolve Spectacle clicks and eliminate startup race condition causing wallpaper reset on reboot
This commit is contained in:
parent
7e2cd72e72
commit
4fac2f05da
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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"])
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,7 +91,10 @@ Item {
|
||||
}
|
||||
|
||||
Quickshell.execDetached(["plasma-apply-wallpaperimage", rawPath])
|
||||
Quickshell.execDetached(["python3", Quickshell.env("HOME") + "/.config/quickshell/services/python/save_wallpaper.py", rawPath, vName])
|
||||
|
||||
if (!skipSave) {
|
||||
Quickshell.execDetached(["python3", Quickshell.env("HOME") + "/.config/quickshell/services/python/save_wallpaper.py", rawPath, vName])
|
||||
}
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
|
||||
@ -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,16 +164,18 @@ Item {
|
||||
|
||||
AppLauncherService.reload()
|
||||
|
||||
let imgPath = getVariantWallpaper(v.name)
|
||||
if (WallpaperService) {
|
||||
WallpaperService.applyWallpaper(imgPath, v.name)
|
||||
} else {
|
||||
wallpaperPath = imgPath.startsWith("file://") ? imgPath : "file://" + imgPath
|
||||
if (!isStartupRestoration) {
|
||||
let imgPath = getVariantWallpaper(v.name)
|
||||
if (WallpaperService) {
|
||||
WallpaperService.applyWallpaper(imgPath, v.name)
|
||||
} else {
|
||||
wallpaperPath = imgPath.startsWith("file://") ? imgPath : "file://" + imgPath
|
||||
let rawPath = imgPath.replace("file://", "")
|
||||
Quickshell.execDetached(["plasma-apply-wallpaperimage", rawPath])
|
||||
}
|
||||
let rawPath = imgPath.replace("file://", "")
|
||||
Quickshell.execDetached(["plasma-apply-wallpaperimage", rawPath])
|
||||
Quickshell.execDetached(["sh", "-c", "wallust run '" + rawPath + "' || ~/.cargo/bin/wallust run '" + rawPath + "' 2>/dev/null || true"])
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user