From 35ff9bae5e9db27a3b3e939fe58644f8e2e8f9f5 Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Wed, 12 Aug 2026 17:01:24 +0200 Subject: [PATCH] fix autostart setting --- gui.py | 12 +++++++++--- install.sh | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/gui.py b/gui.py index 1befc52..1d53be5 100644 --- a/gui.py +++ b/gui.py @@ -278,22 +278,25 @@ Type=Application Name=f0ckm Uploader GUI Comment=System tray GUI and settings for f0ckm Uploader Exec={exec_path} -Icon=cloud-upload-symbolic +Icon=f0ckm-uploader Terminal=false Categories=Utility;Network; +StartupNotify=false X-GNOME-Autostart-enabled=true """ with open(autostart_path, "w") as f: f.write(content) os.chmod(autostart_path, 0o755) + print(f"[f0ckm-gui] Autostart desktop file written to {autostart_path}", flush=True) except Exception as e: - print(f"Failed to create autostart entry: {e}") + print(f"Failed to create autostart entry: {e}", flush=True) else: if os.path.exists(autostart_path): try: os.remove(autostart_path) + print(f"[f0ckm-gui] Autostart desktop file removed from {autostart_path}", flush=True) except Exception as e: - print(f"Failed to remove autostart entry: {e}") + print(f"Failed to remove autostart entry: {e}", flush=True) # ========================================== # Connection Tester Worker @@ -1975,6 +1978,9 @@ def main(): if not os.path.exists(CONFIG_PATH): save_config(DEFAULT_CONFIG) + cfg = get_env_config() + set_autostart(cfg.get("autostart", False)) + tray_app = SystemTrayApp() local_http_bridge.request_upload.connect(tray_app.upload_target_direct) tray_app.show() diff --git a/install.sh b/install.sh index 9652b77..fe006b9 100755 --- a/install.sh +++ b/install.sh @@ -117,6 +117,43 @@ EOF echo "Initial configuration created at $CONFIG_FILE" fi +# 6. Ensure autostart state matches config.json +python3 -c ' +import json, os +try: + cfg_path = os.path.expanduser("~/.config/f0ckm-uploader/config.json") + if os.path.exists(cfg_path): + with open(cfg_path, "r", encoding="utf-8") as f: + cfg = json.load(f) + autostart = cfg.get("autostart", False) + autostart_dir = os.path.expanduser("~/.config/autostart") + autostart_path = os.path.join(autostart_dir, "f0ckm-uploader-gui.desktop") + if autostart: + os.makedirs(autostart_dir, exist_ok=True) + exec_path = os.path.expanduser("~/.local/bin/f0ckm-uploader-gui") + content = f"""[Desktop Entry] +Type=Application +Name=f0ckm Uploader GUI +Comment=System tray GUI and settings for f0ckm Uploader +Exec={exec_path} +Icon=f0ckm-uploader +Terminal=false +Categories=Utility;Network; +StartupNotify=false +X-GNOME-Autostart-enabled=true +""" + with open(autostart_path, "w", encoding="utf-8") as f: + f.write(content) + os.chmod(autostart_path, 0o755) + print(f"Synced autostart desktop entry: {autostart_path}") + else: + if os.path.exists(autostart_path): + os.remove(autostart_path) + print(f"Removed autostart desktop entry: {autostart_path}") +except Exception as e: + print(f"Warning: could not sync autostart entry: {e}") +' + echo "Installation complete!" echo "The script has been installed to $INSTALL_DIR/f0ckm-uploader" echo "The GUI has been installed to $INSTALL_DIR/f0ckm-uploader-gui"