[gnome] Bump extension versions ... I should probably get these out of here

This commit is contained in:
2025-06-19 09:27:02 -04:00
parent b69326ba18
commit 80d725a18a
26 changed files with 312 additions and 473 deletions

View File

@ -74,7 +74,27 @@ export class WindowManager extends GObject.Object {
this.eventQueue = new Queue();
this.theme = this.ext.theme;
this.lastFocusedWindow = null;
this.shouldFocusOnHover = this.ext.settings.get_boolean("focus-on-hover-enabled");
Logger.info("forge initialized");
if (this.shouldFocusOnHover) {
// Start the pointer loop to observe the pointer position
// and change the focus window accordingly
this.pointerLoopInit();
}
}
pointerLoopInit() {
if (this._pointerFocusTimeoutId) {
GLib.Source.remove(this._pointerFocusTimeoutId);
}
this._pointerFocusTimeoutId = GLib.timeout_add(
GLib.PRIORITY_DEFAULT,
16,
this._focusWindowUnderPointer.bind(this)
);
}
addFloatOverride(metaWindow, withWmId) {
@ -267,6 +287,14 @@ export class WindowManager extends GObject.Object {
switch (settingName) {
case "focus-border-toggle":
this.renderTree(settingName);
break;
case "focus-on-hover-enabled":
this.shouldFocusOnHover = settings.get_boolean(settingName);
if (this.shouldFocusOnHover) {
this.pointerLoopInit();
}
break;
case "tiling-mode-enabled":
this.renderTree(settingName);
@ -891,16 +919,20 @@ export class WindowManager extends GObject.Object {
});
}
hideActorBorder(actor) {
if (actor.border) {
actor.border.hide();
}
if (actor.splitBorder) {
actor.splitBorder.hide();
}
}
hideWindowBorders() {
this.tree.nodeWindows.forEach((nodeWindow) => {
let actor = nodeWindow.windowActor;
if (actor) {
if (actor.border) {
actor.border.hide();
}
if (actor.splitBorder) {
actor.splitBorder.hide();
}
this.hideActorBorder(actor);
}
if (nodeWindow.parentNode.isTabbed()) {
if (nodeWindow.tab) {
@ -1090,6 +1122,11 @@ export class WindowManager extends GObject.Object {
this._queueSourceId = 0;
}
if (this._pointerFocusTimeoutId) {
GLib.Source.remove(this._pointerFocusTimeoutId);
this._pointerFocusTimeoutId = 0;
}
if (this._prefsOpenSrcId) {
GLib.Source.remove(this._prefsOpenSrcId);
this._prefsOpenSrcId = 0;
@ -1410,6 +1447,9 @@ export class WindowManager extends GObject.Object {
let from = "size-changed";
this.updateMetaPositionSize(_metaWindow, from);
}),
metaWindow.connect("unmanaged", (_metaWindow) => {
this.hideActorBorder(windowActor);
}),
metaWindow.connect("focus", (_metaWindowFocus) => {
this.queueEvent({
name: "focus-update",
@ -2243,6 +2283,62 @@ export class WindowManager extends GObject.Object {
return nodeWinAtPointer;
}
/**
* Focus the window under the pointer and raise it.
*
* @returns {boolean} true if we should continue polling, false otherwise
*/
_focusWindowUnderPointer() {
// Break the loop if the user has disabled the feature
// or if the window manager is disabled
if (!this.shouldFocusOnHover || this.disabled) return false;
// We don't want to focus windows when the overview is visible
if (Main.overview.visible) return true;
// Get the global mouse position
let pointer = global.get_pointer();
const metaWindow = this._getMetaWindowAtPointer(pointer);
if (metaWindow) {
// If window is not null, focus it
metaWindow.focus(global.get_current_time());
// Raise it to the top
metaWindow.raise();
}
// Continue polling
return true;
}
/**
* Get the Meta.Window at the pointer coordinates
*
* @param {[number, number]} pointer x and y coordinates
* @returns null if no window is found, otherwise the Meta.Window
*/
_getMetaWindowAtPointer(pointer) {
const windows = global.get_window_actors();
const [x, y] = pointer;
// Iterate through the windows in reverse order to get the top-most window
for (let i = windows.length - 1; i >= 0; i--) {
let window = windows[i];
let metaWindow = window.meta_window;
let { x: wx, y: wy, width, height } = metaWindow.get_frame_rect();
// Check if the position is within the window bounds
if (x >= wx && x <= wx + width && y >= wy && y <= wy + height) {
return metaWindow;
}
}
// No window found at the pointer
return null;
}
/**
* Finds the NodeWindow under the Meta.Window and the
* current pointer coordinates;