diff --git a/.gitignore b/.gitignore index 50f97cc..e4e297e 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,11 @@ venv/ ENV/ env.bak/ venv.bak/ -config.json \ No newline at end of file +config.json + +# makepkg artifacts +pkg/ +src/ +*.pkg.tar.zst +*.pkg.tar.xz +*.log \ No newline at end of file diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..03823c7 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,30 @@ +# Maintainer: Cosmo +pkgname=xivlauncher-wrapper +pkgver=0.1.0 +pkgrel=1 +pkgdesc="Wrapper for XIVLauncher with OTP injection" +arch=('any') +url="https://github.com/goatcorp/XIVLauncher.Core" +license=('MIT') +depends=('python' 'xivlauncher') +optdepends=() +makedepends=('git') +source=("xivlauncher-wrapper.desktop" + "xivlauncher-wrapper.png" + "wrapper.py" + "config.example.json") +sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP') + +package() { + # Install the wrapper script + install -Dm755 "${srcdir}/wrapper.py" "${pkgdir}/usr/bin/${pkgname}" + + # Install the desktop file + install -Dm644 "${srcdir}/${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop" + + # Install the icon + install -Dm644 "${srcdir}/${pkgname}.png" "${pkgdir}/usr/share/pixmaps/${pkgname}.png" + + # Install example config + install -Dm644 "${srcdir}/config.example.json" "${pkgdir}/usr/share/doc/${pkgname}/config.example.json" +} diff --git a/README.md b/README.md index b09926e..56e63fa 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,11 @@ This is a simple wrapper script for Linux that launches `xivlauncher-core` and a ## Setup 1. **Configure:** - Copy the example config and edit it with your details. + Create the configuration directory and copy the example config. ```bash - cp config.example.json config.json - nano config.json + mkdir -p ~/.config/xivlauncher-wrapper + cp config.example.json ~/.config/xivlauncher-wrapper/config.json + nano ~/.config/xivlauncher-wrapper/config.json ``` * `secret`: Enter your TOTP secret key (in Base32 format, usually provided when you set up your authenticator app). * `launcher_cmd`: The command to launch XIVLauncher (default: `xivlauncher-core`). diff --git a/wrapper.py b/wrapper.py index 4087f20..0b8b68e 100755 --- a/wrapper.py +++ b/wrapper.py @@ -62,13 +62,22 @@ def send_otp(secret): print("Timed out waiting for XIVLauncher OTP prompt.") def main(): - # Determine config path (look in script directory) - script_dir = os.path.dirname(os.path.realpath(__file__)) - config_path = os.path.join(script_dir, "config.json") + # Determine config path (XDG standard) + xdg_config_home = os.environ.get('XDG_CONFIG_HOME', os.path.join(os.path.expanduser('~'), '.config')) + config_dir = os.path.join(xdg_config_home, 'xivlauncher-wrapper') + config_path = os.path.join(config_dir, 'config.json') + # Fallback to script directory (legacy/development) if not os.path.exists(config_path): - print(f"Config file not found at: {config_path}") - print("Please copy config.example.json to config.json and fill in your secret.") + script_dir = os.path.dirname(os.path.realpath(__file__)) + local_config = os.path.join(script_dir, "config.json") + if os.path.exists(local_config): + config_path = local_config + + if not os.path.exists(config_path): + print(f"Config file not found.") + print(f"Expected at: {config_path}") + print(f"Please copy config.example.json to {config_path} and fill in your secret.") sys.exit(1) try: diff --git a/xivlauncher-wrapper.desktop b/xivlauncher-wrapper.desktop new file mode 100644 index 0000000..6815280 --- /dev/null +++ b/xivlauncher-wrapper.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=XIVLauncher Wrapper +Comment=FFXIV Launcher with OTP Injection +Exec=xivlauncher-wrapper +Icon=xivlauncher-wrapper +Terminal=false +Type=Application +Categories=Game; +Keywords=ffxiv;launcher;mmo; diff --git a/xivlauncher-wrapper.png b/xivlauncher-wrapper.png new file mode 100644 index 0000000..c796d09 Binary files /dev/null and b/xivlauncher-wrapper.png differ