diff --git a/PKGBUILD b/PKGBUILD index 94d1533..fabd5f1 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -7,7 +7,7 @@ arch=('any') url="https://github.com/goatcorp/XIVLauncher.Core" license=('MIT') depends=('python') -optdepends=() +optdepends=('xivlauncher') makedepends=('git') source=("xivlauncher-wrapper.desktop" "xivlauncher-wrapper.png" diff --git a/wrapper.py b/wrapper.py index 8cdf31a..1a26537 100755 --- a/wrapper.py +++ b/wrapper.py @@ -28,30 +28,36 @@ def prompt_gui_secret(): """Prompts for the OTP secret using a DE-appropriate GUI dialog (kdialog or zenity).""" desktop = os.environ.get('XDG_CURRENT_DESKTOP', '').lower() - # Check for KDE + dialogs = [] if 'kde' in desktop and shutil.which('kdialog'): - try: - result = subprocess.run( - ['kdialog', '--password', 'Please enter your XIVLauncher TOTP Secret (base32) or otpauth:// URL:'], - capture_output=True, text=True - ) - if result.returncode == 0: - return result.stdout.strip() - except Exception as e: - print(f"Warning: kdialog failed: {e}") - - # Fallback to Zenity for GNOME/others - elif shutil.which('zenity'): - try: - result = subprocess.run( - ['zenity', '--password', '--title=XIVLauncher Wrapper', '--text=Please enter your TOTP Secret (base32) or otpauth:// URL:'], - capture_output=True, text=True - ) - if result.returncode == 0: - return result.stdout.strip() - except Exception as e: - print(f"Warning: zenity failed: {e}") - + dialogs.append('kdialog') + if shutil.which('zenity'): dialogs.append('zenity') + else: + if shutil.which('zenity'): dialogs.append('zenity') + if shutil.which('kdialog'): dialogs.append('kdialog') + + for dialog in dialogs: + if dialog == 'kdialog': + try: + result = subprocess.run( + ['kdialog', '--password', 'Please enter your XIVLauncher TOTP Secret (base32) or otpauth:// URL:'], + capture_output=True, text=True + ) + if result.returncode == 0: + return result.stdout.strip() + except Exception as e: + print(f"Warning: kdialog failed: {e}") + elif dialog == 'zenity': + try: + result = subprocess.run( + ['zenity', '--password', '--title=XIVLauncher Wrapper', '--text=Please enter your TOTP Secret (base32) or otpauth:// URL:'], + capture_output=True, text=True + ) + if result.returncode == 0: + return result.stdout.strip() + except Exception as e: + print(f"Warning: zenity failed: {e}") + return None def parse_secret(secret_input):