From 183ace1db8ed77093cc99bf86890ffc382ea56b3 Mon Sep 17 00:00:00 2001 From: wheaney <42350981+wheaney@users.noreply.github.com> Date: Thu, 24 Oct 2024 09:26:49 -0700 Subject: [PATCH] Fix CLI path detection so it works for both AUR and setup script installs Update driver, fix possible uninstall failure due to gnomem-extensions command --- VERSION | 2 +- gnome/bin/breezy_gnome_uninstall | 2 +- gnome/src/extension.js | 19 +++++++++++++++++-- modules/XRLinuxDriver | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 314c3d7..ab67981 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.5 \ No newline at end of file +1.1.6 \ No newline at end of file diff --git a/gnome/bin/breezy_gnome_uninstall b/gnome/bin/breezy_gnome_uninstall index 4545d2d..004458c 100755 --- a/gnome/bin/breezy_gnome_uninstall +++ b/gnome/bin/breezy_gnome_uninstall @@ -34,7 +34,7 @@ DATA_DIR="$XDG_DATA_HOME/breezy_gnome" rm -rf $DATA_DIR [ "$for_install" -eq 0 ] && echo "Uninstalling the breezydesktop@xronlinux.com GNOME extension" -gnome-extensions uninstall breezydesktop@xronlinux.com +gnome-extensions uninstall breezydesktop@xronlinux.com || true [ "$for_install" -eq 0 ] && echo "Uninstalling the Breezy Desktop UI application" rm -rf $XDG_DATA_HOME/breezydesktop diff --git a/gnome/src/extension.js b/gnome/src/extension.js index b7f5220..d8adda3 100644 --- a/gnome/src/extension.js +++ b/gnome/src/extension.js @@ -29,6 +29,10 @@ const SUPPORTED_MONITOR_PRODUCTS = [ NESTED_MONITOR_PRODUCT ]; +const BIN_HOME = GLib.getenv('XDG_BIN_HOME') || GLib.build_filenamev([GLib.get_home_dir(), '.local', 'bin']); +const XDG_CLI_PATH = GLib.build_filenamev([BIN_HOME, 'xr_driver_cli']); +const ALT_CLI_PATH = '/usr/bin/xr_driver_cli'; + export default class BreezyDesktopExtension extends Extension { constructor(metadata, uuid) { super(metadata, uuid); @@ -89,6 +93,15 @@ export default class BreezyDesktopExtension extends Extension { this._headset_as_primary_binding = this.settings.bind('headset-as-primary', this._monitor_manager, 'headset-as-primary', Gio.SettingsBindFlags.DEFAULT); + this._cli_file = Gio.file_new_for_path(XDG_CLI_PATH); + if (!this._cli_file.query_exists(null)) { + this._cli_file = Gio.file_new_for_path(ALT_CLI_PATH); + if (!this._cli_file.query_exists(null)) { + this._cli_file = null; + Globals.logger.log('ERROR: BreezyDesktopExtension enable - xr_driver_cli not found'); + } + } + this._setup(); } catch (e) { Globals.logger.log(`ERROR: BreezyDesktopExtension enable ${e.message}\n${e.stack}`); @@ -471,10 +484,12 @@ export default class BreezyDesktopExtension extends Extension { } _toggle_xr_effect() { + if (!this._cli_file) return; + Globals.logger.log_debug('BreezyDesktopExtension _toggle_xr_effect'); let proc = Gio.Subprocess.new( - ['bash', '-c', 'xr_driver_cli --external-mode'], + ['bash', '-c', `${this._cli_file.get_path()} --external-mode`], Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE ); @@ -490,7 +505,7 @@ export default class BreezyDesktopExtension extends Extension { // use the CLI to change the external mode, avoid using disable/enable, otherwise the driver will // shut down and recalibrate each time proc = Gio.Subprocess.new( - ['bash', '-c', `xr_driver_cli --${enabled ? 'disable-external' : 'breezy-desktop'}`], + ['bash', '-c', `${this._cli_file.get_path()} --${enabled ? 'disable-external' : 'breezy-desktop'}`], Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE ); [success, stdout, stderr] = proc.communicate_utf8(null, null); diff --git a/modules/XRLinuxDriver b/modules/XRLinuxDriver index 4ab77f0..53002af 160000 --- a/modules/XRLinuxDriver +++ b/modules/XRLinuxDriver @@ -1 +1 @@ -Subproject commit 4ab77f09b1ac574e9dfa7f9bf29c9ba478b721d9 +Subproject commit 53002afde8406eef7fe309206268ad6dc39e2da6