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 {
|
||||
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"]
|
||||
onExited: running = false
|
||||
}
|
||||
|
||||
Process {
|
||||
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"]
|
||||
onExited: running = false
|
||||
}
|
||||
|
||||
function appendChar(ch) {
|
||||
|
||||
@ -39,7 +39,7 @@ def save_wallpaper():
|
||||
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)
|
||||
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:
|
||||
pass
|
||||
|
||||
|
||||
@ -2161,12 +2161,15 @@ def sync_papirus_folders(variant_name, accent="#ff79c6", sub_accent="#bd93f9"):
|
||||
else:
|
||||
chosen_color = "blue"
|
||||
|
||||
# Execute papirus-folders for all installed Papirus theme variants
|
||||
for theme_name in ["Papirus", "Papirus-Dark", "Papirus-Light"]:
|
||||
try:
|
||||
subprocess.run(["papirus-folders", "-C", chosen_color, "-t", theme_name, "-u"], capture_output=True)
|
||||
except Exception:
|
||||
pass
|
||||
# Execute papirus-folders asynchronously in background thread to prevent blocking theme engine
|
||||
def run_papirus():
|
||||
for theme_name in ["Papirus", "Papirus-Dark", "Papirus-Light"]:
|
||||
try:
|
||||
subprocess.run(["papirus-folders", "-C", chosen_color, "-t", theme_name, "-u"], capture_output=True, timeout=5)
|
||||
except Exception:
|
||||
pass
|
||||
import threading
|
||||
threading.Thread(target=run_papirus, daemon=True).start()
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user