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
|
hoverEnabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
PopupService.closeAll()
|
PopupService.closeAll()
|
||||||
ScreenshotService.captureRegion()
|
CaptureService.captureRegion()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -504,7 +504,7 @@ GlassPanel {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
PopupService.closeAll()
|
PopupService.closeAll()
|
||||||
ScreenshotService.captureFullscreen()
|
CaptureService.captureFullscreen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -535,7 +535,7 @@ GlassPanel {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
PopupService.closeAll()
|
PopupService.closeAll()
|
||||||
ScreenshotService.captureWindow()
|
CaptureService.captureWindow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -586,7 +586,7 @@ GlassPanel {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
PopupService.closeAll()
|
PopupService.closeAll()
|
||||||
ScreenshotService.recordRegion()
|
CaptureService.recordRegion()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -617,7 +617,7 @@ GlassPanel {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
PopupService.closeAll()
|
PopupService.closeAll()
|
||||||
ScreenshotService.recordScreen()
|
CaptureService.recordScreen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,43 +7,33 @@ pragma Singleton
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
Process {
|
|
||||||
id: execProc
|
|
||||||
}
|
|
||||||
|
|
||||||
function captureRegion() {
|
function captureRegion() {
|
||||||
PopupService.closeAll()
|
PopupService.closeAll()
|
||||||
execProc.command = ["spectacle", "-r"]
|
Quickshell.execDetached(["spectacle", "-r"])
|
||||||
execProc.running = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function captureFullscreen() {
|
function captureFullscreen() {
|
||||||
PopupService.closeAll()
|
PopupService.closeAll()
|
||||||
execProc.command = ["spectacle", "-f", "-b", "-c"]
|
Quickshell.execDetached(["spectacle", "-f", "-b", "-c"])
|
||||||
execProc.running = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function captureWindow() {
|
function captureWindow() {
|
||||||
PopupService.closeAll()
|
PopupService.closeAll()
|
||||||
execProc.command = ["spectacle", "-a", "-b", "-c"]
|
Quickshell.execDetached(["spectacle", "-a", "-b", "-c"])
|
||||||
execProc.running = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function recordRegion() {
|
function recordRegion() {
|
||||||
PopupService.closeAll()
|
PopupService.closeAll()
|
||||||
execProc.command = ["spectacle", "-R", "r"]
|
Quickshell.execDetached(["spectacle", "-R", "r"])
|
||||||
execProc.running = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function recordScreen() {
|
function recordScreen() {
|
||||||
PopupService.closeAll()
|
PopupService.closeAll()
|
||||||
execProc.command = ["spectacle", "-R", "s"]
|
Quickshell.execDetached(["spectacle", "-R", "s"])
|
||||||
execProc.running = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function openGui() {
|
function openGui() {
|
||||||
PopupService.closeAll()
|
PopupService.closeAll()
|
||||||
execProc.command = ["spectacle", "-g"]
|
Quickshell.execDetached(["spectacle", "-g"])
|
||||||
execProc.running = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ Item {
|
|||||||
property var wallpapers: []
|
property var wallpapers: []
|
||||||
property string activeCustomWallpaper: ""
|
property string activeCustomWallpaper: ""
|
||||||
property var cachedThemeWallpapers: ({})
|
property var cachedThemeWallpapers: ({})
|
||||||
|
property bool isLoaded: false
|
||||||
|
|
||||||
// Automatic recolor watcher background daemon
|
// Automatic recolor watcher background daemon
|
||||||
Process {
|
Process {
|
||||||
@ -40,6 +41,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
root.isLoaded = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,7 +76,7 @@ Item {
|
|||||||
scanProc.running = true
|
scanProc.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyWallpaper(filePath, variantName) {
|
function applyWallpaper(filePath, variantName, skipSave) {
|
||||||
if (!filePath) return;
|
if (!filePath) return;
|
||||||
let vName = variantName || (Theme ? Theme.currentVariant : "")
|
let vName = variantName || (Theme ? Theme.currentVariant : "")
|
||||||
activeCustomWallpaper = filePath
|
activeCustomWallpaper = filePath
|
||||||
@ -89,8 +91,11 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Quickshell.execDetached(["plasma-apply-wallpaperimage", rawPath])
|
Quickshell.execDetached(["plasma-apply-wallpaperimage", rawPath])
|
||||||
|
|
||||||
|
if (!skipSave) {
|
||||||
Quickshell.execDetached(["python3", Quickshell.env("HOME") + "/.config/quickshell/services/python/save_wallpaper.py", rawPath, vName])
|
Quickshell.execDetached(["python3", Quickshell.env("HOME") + "/.config/quickshell/services/python/save_wallpaper.py", rawPath, vName])
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
if (!scanProc.running) scanProc.running = true
|
if (!scanProc.running) scanProc.running = true
|
||||||
|
|||||||
@ -103,7 +103,7 @@ Item {
|
|||||||
property int blurRadius: 0
|
property int blurRadius: 0
|
||||||
property int cornerRadius: 10
|
property int cornerRadius: 10
|
||||||
|
|
||||||
function setVariant(name) {
|
function setVariant(name, isStartupRestoration) {
|
||||||
for (let i = 0; i < variants.length; i++) {
|
for (let i = 0; i < variants.length; i++) {
|
||||||
let v = variants[i]
|
let v = variants[i]
|
||||||
if (v.name === name) {
|
if (v.name === name) {
|
||||||
@ -164,6 +164,7 @@ Item {
|
|||||||
|
|
||||||
AppLauncherService.reload()
|
AppLauncherService.reload()
|
||||||
|
|
||||||
|
if (!isStartupRestoration) {
|
||||||
let imgPath = getVariantWallpaper(v.name)
|
let imgPath = getVariantWallpaper(v.name)
|
||||||
if (WallpaperService) {
|
if (WallpaperService) {
|
||||||
WallpaperService.applyWallpaper(imgPath, v.name)
|
WallpaperService.applyWallpaper(imgPath, v.name)
|
||||||
@ -174,6 +175,7 @@ Item {
|
|||||||
}
|
}
|
||||||
let rawPath = imgPath.replace("file://", "")
|
let rawPath = imgPath.replace("file://", "")
|
||||||
Quickshell.execDetached(["sh", "-c", "wallust run '" + rawPath + "' || ~/.cargo/bin/wallust run '" + rawPath + "' 2>/dev/null || true"])
|
Quickshell.execDetached(["sh", "-c", "wallust run '" + rawPath + "' || ~/.cargo/bin/wallust run '" + rawPath + "' 2>/dev/null || true"])
|
||||||
|
}
|
||||||
|
|
||||||
// Persist selected theme variant to disk
|
// Persist selected theme variant to disk
|
||||||
Quickshell.execDetached(["sh", "-c", "echo '" + v.name + "' > ~/.config/quickshell_current_theme.txt"])
|
Quickshell.execDetached(["sh", "-c", "echo '" + v.name + "' > ~/.config/quickshell_current_theme.txt"])
|
||||||
@ -191,7 +193,7 @@ Item {
|
|||||||
onRead: data => {
|
onRead: data => {
|
||||||
let saved = data.trim()
|
let saved = data.trim()
|
||||||
if (saved && saved !== "" && saved !== root.currentVariant) {
|
if (saved && saved !== "" && saved !== root.currentVariant) {
|
||||||
root.setVariant(saved)
|
root.setVariant(saved, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user