Files
btd700linux/install.py
T
Justin dd0809e877
Tests / unit (de, 3.10) (push) Has been cancelled
Tests / unit (de, 3.14) (push) Has been cancelled
Tests / unit (en, 3.14) (push) Has been cancelled
Tests / unit (en, 3.10) (push) Has been cancelled
Add English localization and MIT-licensed public release documentation
2026-09-05 21:02:14 +02:00

29 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""Install/remove a launcher for this checkout, without root or system packages."""
import argparse
import os
from pathlib import Path
from btd700.i18n import tr
from btd700.integration import APP_ID, autostart_path, desktop_entry
def main():
parser = argparse.ArgumentParser(description='Add or remove the BTD 700 Control application-menu entry.')
parser.add_argument('--uninstall', action='store_true', help='Remove the launcher and start-at-login entry')
args = parser.parse_args()
base = Path(os.environ.get('XDG_DATA_HOME', Path.home() / '.local/share'))
destination = base / 'applications' / f'{APP_ID}.desktop'
if args.uninstall:
destination.unlink(missing_ok=True)
autostart_path().unlink(missing_ok=True)
print(tr('Menüeintrag und Autostart entfernt. Der Projektordner bleibt erhalten.'))
return
destination.parent.mkdir(parents=True, exist_ok=True)
destination.write_text(desktop_entry())
print(tr('Installiert: {path}').format(path=destination))
print(tr('Im Anwendungsmenü „BTD 700 Control“ öffnen. Der Projektordner muss erhalten bleiben.'))
if __name__ == '__main__':
main()