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
This commit is contained in:
wheaney 2024-10-24 09:26:49 -07:00
parent 1a2dc23573
commit 183ace1db8
4 changed files with 20 additions and 5 deletions

View File

@ -1 +1 @@
1.1.5
1.1.6

View File

@ -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

View File

@ -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);

@ -1 +1 @@
Subproject commit 4ab77f09b1ac574e9dfa7f9bf29c9ba478b721d9
Subproject commit 53002afde8406eef7fe309206268ad6dc39e2da6