Update extension.js

This commit is contained in:
2025-07-23 21:39:16 +02:00
committed by GitHub
parent b8dcc27bf8
commit 7ed0b64ffb
+34 -20
View File
@@ -1,9 +1,11 @@
// Simple-Tiling GNOME Shell 3.38 (X11) - Version 1.0 // ---------------------------------------------------- //
// Features: Fibonacci-Stack-Layout (50/50) · Tiling-Lock · Drag- & Keyboard-Swap // Simple-Tiling GNOME Shell 3.38 (X11) - Version 2 //
// Pop-ups: zentriert + Always-on-Top + Exception-List // © 2025 domoel MIT //
// © 2025 domoel MIT // ---------------------------------------------------- //
// Global Imports // ---------------------------------------------------- //
// Global Imports //
// ---------------------------------------------------- //
const Main = imports.ui.main; const Main = imports.ui.main;
const Meta = imports.gi.Meta; const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell; const Shell = imports.gi.Shell;
@@ -17,8 +19,9 @@ const Me = ExtensionUtils.getCurrentExtension();
const SCHEMA_NAME = 'org.gnome.shell.extensions.simple-tiling.domoel'; const SCHEMA_NAME = 'org.gnome.shell.extensions.simple-tiling.domoel';
const WM_SCHEMA = 'org.gnome.desktop.wm.keybindings'; const WM_SCHEMA = 'org.gnome.desktop.wm.keybindings';
// InteractionHandler // ---------------------------------------------------- //
// Verwaltung aller Nutzerinteraktionen (Maus & Tastatur) // InteractionHandler //
// ---------------------------------------------------- //
class InteractionHandler { class InteractionHandler {
constructor(tiler) { constructor(tiler) {
this.tiler = tiler; this.tiler = tiler;
@@ -28,7 +31,6 @@ class InteractionHandler {
this._savedWmShortcuts = {}; this._savedWmShortcuts = {};
this._grabOpIds = []; this._grabOpIds = [];
this._settingsChangedId = null; this._settingsChangedId = null;
this._onSettingsChanged = this._onSettingsChanged.bind(this); this._onSettingsChanged = this._onSettingsChanged.bind(this);
this._prepareWmShortcuts(); this._prepareWmShortcuts();
} }
@@ -200,25 +202,26 @@ class InteractionHandler {
} }
} }
// ---------------------------------------------------- //
// Tiler // Tiler //
// Die Hauptklasse für die Tiling-Logik. // Main Classes for Tiling Logic //
// ---------------------------------------------------- //
class Tiler { class Tiler {
constructor() { constructor() {
this.windows = []; this.windows = [];
this.grabbedWindow = null; this.grabbedWindow = null;
this._settings = ExtensionUtils.getSettings(SCHEMA_NAME);
this.wmSettings = new Gio.Settings({ schema: WM_SCHEMA }); this.wmSettings = new Gio.Settings({ schema: WM_SCHEMA });
this._signalIds = new Map(); this._signalIds = new Map();
this._tileInProgress = false; this._tileInProgress = false;
// Layout-Konfiguration this._innerGap = this._settings.get_int('inner-gap');
this._innerGap = 10; this._outerGapVertical = this._settings.get_int('outer-gap-vertical');
this._outerGapVertical = 5; this._outerGapHorizontal = this._settings.get_int('outer-gap-horizontal');
this._outerGapHorizontal = 10;
// Delay-Zeiten für das Tiling und Exception Windows // Window Delay Settings
this._tilingDelay = 20; this._tilingDelay = 20; // General Tiling Window Delay
this._centeringDelay = 5; this._centeringDelay = 5; //Delay for centered Apps on the Exception List
this._exceptions = []; this._exceptions = [];
this._interactionHandler = new InteractionHandler(this); this._interactionHandler = new InteractionHandler(this);
@@ -227,6 +230,7 @@ class Tiler {
this._onWindowRemoved = this._onWindowRemoved.bind(this); this._onWindowRemoved = this._onWindowRemoved.bind(this);
this._onActiveWorkspaceChanged = this._onActiveWorkspaceChanged.bind(this); this._onActiveWorkspaceChanged = this._onActiveWorkspaceChanged.bind(this);
this._onWindowMinimizedStateChanged = this._onWindowMinimizedStateChanged.bind(this); this._onWindowMinimizedStateChanged = this._onWindowMinimizedStateChanged.bind(this);
this._onSettingsChanged = this._onSettingsChanged.bind(this);
} }
enable() { enable() {
@@ -235,6 +239,7 @@ class Tiler {
this._signalIds.set('workspace-changed', { object: workspaceManager, id: workspaceManager.connect('active-workspace-changed', this._onActiveWorkspaceChanged) }); this._signalIds.set('workspace-changed', { object: workspaceManager, id: workspaceManager.connect('active-workspace-changed', this._onActiveWorkspaceChanged) });
this._connectToWorkspace(); this._connectToWorkspace();
this._interactionHandler.enable(); this._interactionHandler.enable();
this._signalIds.set('settings-changed', { object: this._settings, id: this._settings.connect('changed', this._onSettingsChanged) });
} }
disable() { disable() {
@@ -247,6 +252,13 @@ class Tiler {
this.windows = []; this.windows = [];
} }
_onSettingsChanged() {
this._innerGap = this._settings.get_int('inner-gap');
this._outerGapVertical = this._settings.get_int('outer-gap-vertical');
this._outerGapHorizontal = this._settings.get_int('outer-gap-horizontal');
this.queueTile();
}
_loadExceptions() { _loadExceptions() {
const file = Gio.file_new_for_path(Me.path + '/exceptions.txt'); const file = Gio.file_new_for_path(Me.path + '/exceptions.txt');
if (!file.query_exists(null)) { this._exceptions = []; return; } if (!file.query_exists(null)) { this._exceptions = []; return; }
@@ -424,7 +436,9 @@ class Tiler {
} }
} }
// Extension Wrapper // ---------------------------------------------------- //
// Extension Wrapper //
// ---------------------------------------------------- //
class SimpleTilingExtension { class SimpleTilingExtension {
constructor() { constructor() {
this.tiler = null; this.tiler = null;