From 36646977fcb53fe510aad102589d90d56dcbb8e5 Mon Sep 17 00:00:00 2001 From: wheaney <42350981+wheaney@users.noreply.github.com> Date: Wed, 19 Mar 2025 12:22:15 -0700 Subject: [PATCH] Optimize monitor focus checking, fix toggle XR effect not working when disabled, v2.0.16 --- VERSION | 2 +- gnome/src/extension.js | 5 +++-- gnome/src/virtualdisplayeffect.js | 3 ++- gnome/src/virtualdisplaysactor.js | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index b8061b5..a14da29 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.15 +2.0.16 diff --git a/gnome/src/extension.js b/gnome/src/extension.js index 558a7e8..e6434b5 100644 --- a/gnome/src/extension.js +++ b/gnome/src/extension.js @@ -94,6 +94,8 @@ export default class BreezyDesktopExtension extends Extension { } } + this._add_settings_keybinding('toggle-xr-effect-shortcut', this._toggle_xr_effect.bind(this)); + this._setup(); } catch (e) { Globals.logger.log(`[ERROR] BreezyDesktopExtension enable ${e.message}\n${e.stack}`); @@ -304,7 +306,6 @@ export default class BreezyDesktopExtension extends Extension { Meta.disable_unredirect_for_display(global.display); } - this._add_settings_keybinding('toggle-xr-effect-shortcut', this._toggle_xr_effect.bind(this)); this._add_settings_keybinding('recenter-display-shortcut', this._recenter_display.bind(this)); this._add_settings_keybinding('toggle-display-distance-shortcut', this._virtual_displays_actor._change_distance.bind(this._virtual_displays_actor)); this._add_settings_keybinding('toggle-follow-shortcut', this._toggle_follow_mode.bind(this)); @@ -556,7 +557,6 @@ export default class BreezyDesktopExtension extends Extension { if (Globals.data_stream.smooth_follow_enabled) this._toggle_follow_mode(); - Main.wm.removeKeybinding('toggle-xr-effect-shortcut'); Main.wm.removeKeybinding('recenter-display-shortcut'); Main.wm.removeKeybinding('toggle-display-distance-shortcut'); Main.wm.removeKeybinding('toggle-follow-shortcut'); @@ -642,6 +642,7 @@ export default class BreezyDesktopExtension extends Extension { Globals.data_stream.disconnect(this._breezy_desktop_running_connection); this._breezy_desktop_running_connection = null; } + Main.wm.removeKeybinding('toggle-xr-effect-shortcut'); Gio.Settings.unbind(this.settings, 'debug'); Gio.Settings.unbind(this.settings, 'use-optimal-monitor-config'); Gio.Settings.unbind(this.settings, 'headset-as-primary'); diff --git a/gnome/src/virtualdisplayeffect.js b/gnome/src/virtualdisplayeffect.js index 26be71e..5fc6cdd 100644 --- a/gnome/src/virtualdisplayeffect.js +++ b/gnome/src/virtualdisplayeffect.js @@ -247,8 +247,9 @@ export const VirtualDisplayEffect = GObject.registerClass({ if (this._follow_ease_timeline?.is_playing()) this._follow_ease_timeline.stop(); + const ease_to_focus = this.smooth_follow_enabled && this._is_focused(); const from = this._current_follow_ease_progress; - const to = this.smooth_follow_enabled && this._is_focused() ? 1.0 : 0.0; + const to = ease_to_focus ? 1.0 : 0.0; const toggleTime = this.smooth_follow_toggle_epoch_ms === 0 ? Date.now() : this.smooth_follow_toggle_epoch_ms; // would have been a slight delay between request and slerp actually starting diff --git a/gnome/src/virtualdisplaysactor.js b/gnome/src/virtualdisplaysactor.js index bfb7acb..c93ffff 100644 --- a/gnome/src/virtualdisplaysactor.js +++ b/gnome/src/virtualdisplaysactor.js @@ -3,7 +3,6 @@ import Cogl from 'gi://Cogl'; import GdkPixbuf from 'gi://GdkPixbuf'; import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; -import Mtk from 'gi://Mtk'; import Shell from 'gi://Shell'; import St from 'gi://St'; @@ -776,7 +775,9 @@ export const VirtualDisplaysActor = GObject.registerClass({ if (this.show_banner) { this.focused_monitor_index = -1; this.focused_monitor_details = null; - } else if (this.imu_snapshots && (!this._smooth_follow_slerping || this.focused_monitor_index === -1)) { + } else if (this.imu_snapshots && + (!this.smooth_follow_enabled || this.focused_monitor_index === -1) && + (!this._smooth_follow_slerping || this.focused_monitor_index === -1)) { // if smooth follow is enabled, use the origin IMU data to inform the initial focused monitor // since it reflects where the user is looking in relation to the original monitor positions const currentPoseQuat = this.smooth_follow_enabled ?