fix(performance): make papirus-folders and kwriteconfig6 non-blocking with strict timeouts to prevent process hangs
This commit is contained in:
parent
5050e40629
commit
8bc059af5f
@ -100,11 +100,13 @@ Item {
|
|||||||
Process {
|
Process {
|
||||||
id: disableEffectsProc
|
id: disableEffectsProc
|
||||||
command: ["bash", "-c", "qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.unloadEffect overview 2>/dev/null; qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.unloadEffect grid 2>/dev/null; qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.unloadEffect presentwindows 2>/dev/null"]
|
command: ["bash", "-c", "qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.unloadEffect overview 2>/dev/null; qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.unloadEffect grid 2>/dev/null; qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.unloadEffect presentwindows 2>/dev/null"]
|
||||||
|
onExited: running = false
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: enableEffectsProc
|
id: enableEffectsProc
|
||||||
command: ["bash", "-c", "qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.loadEffect overview 2>/dev/null; qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.loadEffect grid 2>/dev/null; qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.loadEffect presentwindows 2>/dev/null"]
|
command: ["bash", "-c", "qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.loadEffect overview 2>/dev/null; qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.loadEffect grid 2>/dev/null; qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.loadEffect presentwindows 2>/dev/null"]
|
||||||
|
onExited: running = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendChar(ch) {
|
function appendChar(ch) {
|
||||||
|
|||||||
@ -39,7 +39,7 @@ def save_wallpaper():
|
|||||||
try:
|
try:
|
||||||
import subprocess
|
import subprocess
|
||||||
file_url = wp_path if wp_path.startswith("file://") else f"file://{wp_path}"
|
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)
|
subprocess.run(["kwriteconfig6", "--file", "kscreenlockerrc", "--group", "Greeter", "--group", "Wallpaper", "--group", "org.kde.image", "--group", "General", "--key", "Image", file_url], capture_output=True, timeout=2)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@ -2161,12 +2161,15 @@ def sync_papirus_folders(variant_name, accent="#ff79c6", sub_accent="#bd93f9"):
|
|||||||
else:
|
else:
|
||||||
chosen_color = "blue"
|
chosen_color = "blue"
|
||||||
|
|
||||||
# Execute papirus-folders for all installed Papirus theme variants
|
# Execute papirus-folders asynchronously in background thread to prevent blocking theme engine
|
||||||
for theme_name in ["Papirus", "Papirus-Dark", "Papirus-Light"]:
|
def run_papirus():
|
||||||
try:
|
for theme_name in ["Papirus", "Papirus-Dark", "Papirus-Light"]:
|
||||||
subprocess.run(["papirus-folders", "-C", chosen_color, "-t", theme_name, "-u"], capture_output=True)
|
try:
|
||||||
except Exception:
|
subprocess.run(["papirus-folders", "-C", chosen_color, "-t", theme_name, "-u"], capture_output=True, timeout=5)
|
||||||
pass
|
except Exception:
|
||||||
|
pass
|
||||||
|
import threading
|
||||||
|
threading.Thread(target=run_papirus, daemon=True).start()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user