From 143c9d9b30dd73941cdeb230bc616933f0b60934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deniz=20=C5=9Eafak?= Date: Sat, 10 May 2025 00:21:57 +0300 Subject: [PATCH] Offer installation for linux --- abogen/gui.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/abogen/gui.py b/abogen/gui.py index e09635b..f1b40f1 100644 --- a/abogen/gui.py +++ b/abogen/gui.py @@ -1975,6 +1975,33 @@ Categories=AudioVideo;Audio;Utility; "Shortcut Created", f"Shortcut created on desktop:\n{shortcut_path}", ) + + # Offer installation for current user under ~/.local/share/applications + reply = QMessageBox.question( + self, + "Install Application Entry", + "Install application entry for current user?", + QMessageBox.Yes | QMessageBox.No, + ) + if reply == QMessageBox.Yes: + import shutil + user_app_dir = os.path.expanduser("~/.local/share/applications") + os.makedirs(user_app_dir, exist_ok=True) + user_entry = os.path.join(user_app_dir, "abogen.desktop") + try: + shutil.copyfile(shortcut_path, user_entry) + os.chmod(user_entry, 0o644) + QMessageBox.information( + self, + "Installation Complete", + f"Desktop entry installed to {user_entry}", + ) + except Exception as e: + QMessageBox.warning( + self, + "Install Error", + f"Could not install entry:\n{e}", + ) else: QMessageBox.information( self, "Unsupported OS", "Desktop shortcut creation is not supported on this operating system."