Merge branch 'feat/fix-login-issues'
This commit is contained in:
@@ -1,15 +1,20 @@
|
|||||||
import {WindowWrapper} from "./window.js";
|
import {WindowWrapper} from "./window.js";
|
||||||
import {Logger} from "./utils/logger.js";
|
import {Logger} from "./utils/logger.js";
|
||||||
import Mtk from "@girs/mtk-16";
|
import Mtk from "@girs/mtk-16";
|
||||||
|
import Meta from "gi://Meta";
|
||||||
|
|
||||||
|
|
||||||
export default class MonitorManager {
|
export default class MonitorManager {
|
||||||
|
|
||||||
_id: number;
|
_id: number;
|
||||||
_windows: Map<number, WindowWrapper>;
|
_windows: Map<number, WindowWrapper>;
|
||||||
|
_minimized: Map<number, WindowWrapper>;
|
||||||
|
|
||||||
|
|
||||||
constructor(monitorId: number) {
|
constructor(monitorId: number) {
|
||||||
this._windows = new Map<number, WindowWrapper>();
|
this._windows = new Map<number, WindowWrapper>();
|
||||||
|
this._minimized = new Map<number, WindowWrapper>();
|
||||||
|
|
||||||
this._id = monitorId;
|
this._id = monitorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,6 +33,21 @@ export default class MonitorManager {
|
|||||||
this._tileWindows()
|
this._tileWindows()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
minimizeWindow(winWrap: WindowWrapper): void {
|
||||||
|
this._windows.delete(winWrap.getWindowId())
|
||||||
|
this._minimized.set(winWrap.getWindowId(), winWrap)
|
||||||
|
}
|
||||||
|
|
||||||
|
unminimizeWindow(winWrap: WindowWrapper): void {
|
||||||
|
if (this._minimized.has(winWrap.getWindowId())) {
|
||||||
|
this._windows.set(winWrap.getWindowId(), winWrap);
|
||||||
|
this._minimized.delete(winWrap.getWindowId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
removeAllWindows(): void {
|
||||||
|
this._windows.clear()
|
||||||
|
}
|
||||||
|
|
||||||
_tileWindows() {
|
_tileWindows() {
|
||||||
Logger.log("TILING WINDOWS ON MONITOR", this._id)
|
Logger.log("TILING WINDOWS ON MONITOR", this._id)
|
||||||
|
@@ -9,13 +9,17 @@ export type Signal = {
|
|||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type WindowMinimizedHandler = (window: WindowWrapper) => void;
|
||||||
|
|
||||||
export class WindowWrapper {
|
export class WindowWrapper {
|
||||||
readonly _window: Meta.Window;
|
readonly _window: Meta.Window;
|
||||||
|
readonly _windowMinimizedHandler: WindowMinimizedHandler;
|
||||||
readonly _signals: Signal[];
|
readonly _signals: Signal[];
|
||||||
|
|
||||||
constructor(window: Meta.Window) {
|
constructor(window: Meta.Window, winMinimized: WindowMinimizedHandler) {
|
||||||
this._window = window;
|
this._window = window;
|
||||||
this._signals = [];
|
this._signals = [];
|
||||||
|
this._windowMinimizedHandler = winMinimized;
|
||||||
}
|
}
|
||||||
|
|
||||||
getWindow(): Meta.Window {
|
getWindow(): Meta.Window {
|
||||||
@@ -88,13 +92,13 @@ export class WindowWrapper {
|
|||||||
// Remove window from managed windows temporarily
|
// Remove window from managed windows temporarily
|
||||||
// windowManager.removeFromTree(this._window);
|
// windowManager.removeFromTree(this._window);
|
||||||
// If this was the active window, find a new one
|
// If this was the active window, find a new one
|
||||||
windowManager.syncActiveWindow()
|
|
||||||
// Retile remaining windows
|
// Retile remaining windows
|
||||||
windowManager._tileMonitors();
|
windowManager.handleWindowMinimized(this);
|
||||||
|
|
||||||
} else if (!this._window.minimized) {
|
} else if (!this._window.minimized) {
|
||||||
Logger.log(`Window unminimized: ${windowId}`);
|
Logger.log(`Window unminimized: ${windowId}`);
|
||||||
// windowManager.addWindow(this._window);
|
// windowManager.addWindow(this._window);
|
||||||
|
windowManager.handleWindowUnminimized(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -138,12 +142,12 @@ export class WindowWrapper {
|
|||||||
Logger.log("WINDOW IS FULLSCREEN")
|
Logger.log("WINDOW IS FULLSCREEN")
|
||||||
this._window.unmake_fullscreen();
|
this._window.unmake_fullscreen();
|
||||||
}
|
}
|
||||||
Logger.log("WINDOW", this._window.get_window_type(), this._window.allows_move());
|
// Logger.log("WINDOW", this._window.get_window_type(), this._window.allows_move());
|
||||||
Logger.log("MONITOR INFO", getUsableMonitorSpace(this._window));
|
// Logger.log("MONITOR INFO", getUsableMonitorSpace(this._window));
|
||||||
Logger.log("NEW_SIZE", x, y, width, height);
|
// Logger.log("NEW_SIZE", x, y, width, height);
|
||||||
// win.move_resize_frame(false, 50, 50, 300, 300);
|
// win.move_resize_frame(false, 50, 50, 300, 300);
|
||||||
this._window.move_resize_frame(false, x, y, width, height);
|
this._window.move_resize_frame(false, x, y, width, height);
|
||||||
Logger.log("RESIZED WINDOW", this._window.get_frame_rect().height, this._window.get_frame_rect().width, this._window.get_frame_rect().x, this._window.get_frame_rect().y);
|
// Logger.log("RESIZED WINDOW", this._window.get_frame_rect().height, this._window.get_frame_rect().width, this._window.get_frame_rect().x, this._window.get_frame_rect().y);
|
||||||
}
|
}
|
||||||
|
|
||||||
safelyResizeWindow(x: number, y: number, width: number, height: number): void {
|
safelyResizeWindow(x: number, y: number, width: number, height: number): void {
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
import Meta from "gi://Meta";
|
import Meta from "gi://Meta";
|
||||||
|
import Gio from "gi://Gio";
|
||||||
|
import GLib from "gi://GLib";
|
||||||
|
|
||||||
import {WindowWrapper} from './window.js';
|
import {WindowWrapper} from './window.js';
|
||||||
|
import * as Main from "resource:///org/gnome/shell/ui/main.js";
|
||||||
import Mtk from "@girs/mtk-16";
|
import Mtk from "@girs/mtk-16";
|
||||||
import {Logger} from "./utils/logger.js";
|
import {Logger} from "./utils/logger.js";
|
||||||
import MonitorManager from "./monitor.js";
|
import MonitorManager from "./monitor.js";
|
||||||
@@ -11,9 +14,10 @@ export interface IWindowManager {
|
|||||||
|
|
||||||
// addWindow(window: Meta.Window): void;
|
// addWindow(window: Meta.Window): void;
|
||||||
|
|
||||||
handleWindowClosed(windowId: WindowWrapper): void;
|
handleWindowClosed(winWrap: WindowWrapper): void;
|
||||||
|
handleWindowMinimized(winWrap: WindowWrapper): void;
|
||||||
|
handleWindowUnminimized(winWrap: WindowWrapper): void;
|
||||||
|
|
||||||
_tileMonitors(): void;
|
|
||||||
|
|
||||||
// removeFromTree(window: Meta.Window): void;
|
// removeFromTree(window: Meta.Window): void;
|
||||||
syncActiveWindow(): number | null;
|
syncActiveWindow(): number | null;
|
||||||
@@ -22,15 +26,30 @@ export interface IWindowManager {
|
|||||||
const _UNUSED_MONITOR_ID = -1
|
const _UNUSED_MONITOR_ID = -1
|
||||||
export default class WindowManager implements IWindowManager {
|
export default class WindowManager implements IWindowManager {
|
||||||
_displaySignals: number[];
|
_displaySignals: number[];
|
||||||
|
_windowManagerSignals: number[];
|
||||||
|
_workspaceManagerSignals: number[];
|
||||||
|
_shieldScreenSignals: number[];
|
||||||
|
_overviewSignals: number[];
|
||||||
_activeWindowId: number | null;
|
_activeWindowId: number | null;
|
||||||
_grabbedWindowMonitor: number;
|
_grabbedWindowMonitor: number;
|
||||||
_monitors: Map<number, MonitorManager>;
|
_monitors: Map<number, MonitorManager>;
|
||||||
|
_sessionProxy: Gio.DBusProxy | null;
|
||||||
|
_lockedSignalId: number | null;
|
||||||
|
_isScreenLocked: boolean;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this._displaySignals = [];
|
this._displaySignals = [];
|
||||||
|
this._windowManagerSignals = [];
|
||||||
|
this._workspaceManagerSignals = [];
|
||||||
|
this._overviewSignals = [];
|
||||||
|
this._shieldScreenSignals = [];
|
||||||
this._activeWindowId = null;
|
this._activeWindowId = null;
|
||||||
this._grabbedWindowMonitor = _UNUSED_MONITOR_ID;
|
this._grabbedWindowMonitor = _UNUSED_MONITOR_ID;
|
||||||
this._monitors = new Map<number, MonitorManager>();
|
this._monitors = new Map<number, MonitorManager>();
|
||||||
|
this._sessionProxy = null;
|
||||||
|
this._lockedSignalId = null;
|
||||||
|
this._isScreenLocked = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enable(): void {
|
public enable(): void {
|
||||||
@@ -49,6 +68,13 @@ export default class WindowManager implements IWindowManager {
|
|||||||
Logger.log("DISABLED AEROSPIKE WINDOW MANAGER!")
|
Logger.log("DISABLED AEROSPIKE WINDOW MANAGER!")
|
||||||
// Disconnect the focus signal and remove any existing borders
|
// Disconnect the focus signal and remove any existing borders
|
||||||
this.disconnectDisplaySignals();
|
this.disconnectDisplaySignals();
|
||||||
|
this.removeAllWindows();
|
||||||
|
}
|
||||||
|
|
||||||
|
removeAllWindows(): void {
|
||||||
|
this._monitors.forEach((monitor: MonitorManager) => {
|
||||||
|
monitor.removeAllWindows();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -76,12 +102,85 @@ export default class WindowManager implements IWindowManager {
|
|||||||
Logger.log("IN FULL SCREEN CHANGED");
|
Logger.log("IN FULL SCREEN CHANGED");
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
this._windowManagerSignals = [
|
||||||
|
// global.window_manager.connect("minimize", (_source, window) => {
|
||||||
|
// Logger.log("MINIMIZING WINDOW")
|
||||||
|
// }),
|
||||||
|
// global.window_manager.connect("unminimize", (_source, window) => {
|
||||||
|
// Logger.log("WINDOW UNMINIMIZED");
|
||||||
|
// }),
|
||||||
|
global.window_manager.connect("show-tile-preview", (_, _metaWindow, _rect, _num) => {
|
||||||
|
Logger.log("SHOW TITLE PREVIEW!")
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
this._workspaceManagerSignals = [
|
||||||
|
global.workspace_manager.connect("showing-desktop-changed", () => {
|
||||||
|
Logger.log("SHOWING DESKTOP CHANGED AT WORKSPACE LEVEL");
|
||||||
|
}),
|
||||||
|
global.workspace_manager.connect("workspace-added", (_, wsIndex) => {
|
||||||
|
Logger.log("WORKSPACE ADDED");
|
||||||
|
}),
|
||||||
|
global.workspace_manager.connect("workspace-removed", (_, wsIndex) => {
|
||||||
|
Logger.log("WORKSPACE REMOVED");
|
||||||
|
}),
|
||||||
|
global.workspace_manager.connect("active-workspace-changed", () => {
|
||||||
|
Logger.log("Active workspace-changed");
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
this._overviewSignals = [
|
||||||
|
Main.overview.connect("hiding", () => {
|
||||||
|
// this.fromOverview = true;
|
||||||
|
Logger.log("HIDING OVERVIEW")
|
||||||
|
const eventObj = {
|
||||||
|
name: "focus-after-overview",
|
||||||
|
callback: () => {
|
||||||
|
// const focusNodeWindow = this.tree.findNode(this.focusMetaWindow);
|
||||||
|
// this.updateStackedFocus(focusNodeWindow);
|
||||||
|
// this.updateTabbedFocus(focusNodeWindow);
|
||||||
|
// this.movePointerWith(focusNodeWindow);
|
||||||
|
Logger.log("FOCUSING AFTER OVERVIEW");
|
||||||
|
},
|
||||||
|
};
|
||||||
|
// this.queueEvent(eventObj);
|
||||||
|
}),
|
||||||
|
Main.overview.connect("showing", () => {
|
||||||
|
// this.toOverview = true;
|
||||||
|
Logger.log("SHOWING OVERVIEW");
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
|
// Main.screenShield;
|
||||||
|
|
||||||
|
// Handler for lock event
|
||||||
|
this._shieldScreenSignals.push(Main.screenShield.connect('lock-screen', () => {
|
||||||
|
console.log('Session locked at:', new Date().toISOString());
|
||||||
|
}), Main.screenShield.connect('unlock-screen', () => {
|
||||||
|
console.log('Session unlocked at:', new Date().toISOString());
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// Handler for unlock event
|
||||||
|
|
||||||
|
// this._signalsBound = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectDisplaySignals(): void {
|
disconnectDisplaySignals(): void {
|
||||||
this._displaySignals.forEach((signal) => {
|
this._displaySignals.forEach((signal) => {
|
||||||
global.disconnect(signal)
|
global.disconnect(signal)
|
||||||
})
|
})
|
||||||
|
this._windowManagerSignals.forEach((signal) => {
|
||||||
|
global.disconnect(signal)
|
||||||
|
})
|
||||||
|
this._workspaceManagerSignals.forEach((signal) => {
|
||||||
|
global.disconnect(signal)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
handleGrabOpBegin(display: Meta.Display, window: Meta.Window, op: Meta.GrabOp): void {
|
handleGrabOpBegin(display: Meta.Display, window: Meta.Window, op: Meta.GrabOp): void {
|
||||||
@@ -110,7 +209,7 @@ export default class WindowManager implements IWindowManager {
|
|||||||
}
|
}
|
||||||
let wrapped = old_mon.getWindow(window.get_id())
|
let wrapped = old_mon.getWindow(window.get_id())
|
||||||
if (wrapped === undefined) {
|
if (wrapped === undefined) {
|
||||||
wrapped = new WindowWrapper(window)
|
wrapped = new WindowWrapper(window, this.handleWindowMinimized);
|
||||||
} else {
|
} else {
|
||||||
old_mon.removeWindow(window.get_id())
|
old_mon.removeWindow(window.get_id())
|
||||||
}
|
}
|
||||||
@@ -119,6 +218,23 @@ export default class WindowManager implements IWindowManager {
|
|||||||
Logger.info("monitor_start and monitor_end", this._grabbedWindowMonitor, window.get_monitor());
|
Logger.info("monitor_start and monitor_end", this._grabbedWindowMonitor, window.get_monitor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public handleWindowMinimized(winWrap: WindowWrapper): void {
|
||||||
|
Logger.warn("WARNING MINIMIZING WINDOW");
|
||||||
|
Logger.log("WARNING MINIMIZED", winWrap);
|
||||||
|
const monitor_id = winWrap.getWindow().get_monitor()
|
||||||
|
Logger.log("WARNING MINIMIZED", monitor_id);
|
||||||
|
Logger.warn("WARNING MINIMIZED", this._monitors);
|
||||||
|
this._monitors.get(monitor_id)?.minimizeWindow(winWrap);
|
||||||
|
this._tileMonitors()
|
||||||
|
}
|
||||||
|
|
||||||
|
public handleWindowUnminimized(winWrap: WindowWrapper): void {
|
||||||
|
Logger.log("WINDOW UNMINIMIZED");
|
||||||
|
const monitor_id = winWrap.getWindow().get_monitor()
|
||||||
|
this._monitors.get(monitor_id)?.unminimizeWindow(winWrap);
|
||||||
|
this._tileMonitors()
|
||||||
|
}
|
||||||
|
|
||||||
public captureExistingWindows() {
|
public captureExistingWindows() {
|
||||||
Logger.log("CAPTURING WINDOWS")
|
Logger.log("CAPTURING WINDOWS")
|
||||||
const workspace = global.workspace_manager.get_active_workspace();
|
const workspace = global.workspace_manager.get_active_workspace();
|
||||||
@@ -165,8 +281,7 @@ export default class WindowManager implements IWindowManager {
|
|||||||
|
|
||||||
|
|
||||||
public addWindowToMonitor(window: Meta.Window) {
|
public addWindowToMonitor(window: Meta.Window) {
|
||||||
|
var wrapper = new WindowWrapper(window, this.handleWindowMinimized)
|
||||||
var wrapper = new WindowWrapper(window)
|
|
||||||
wrapper.connectWindowSignals(this)
|
wrapper.connectWindowSignals(this)
|
||||||
this._monitors.get(window.get_monitor())?.addWindow(wrapper)
|
this._monitors.get(window.get_monitor())?.addWindow(wrapper)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user