diff --git a/gTile@shuairan/files/gTile@shuairan/5.4/gTile.js b/gTile@shuairan/files/gTile@shuairan/5.4/gTile.js index 747a5b29..4cd4544b 100644 --- a/gTile@shuairan/files/gTile@shuairan/5.4/gTile.js +++ b/gTile@shuairan/files/gTile@shuairan/5.4/gTile.js @@ -86,9 +86,11 @@ class Config { this.EnableHotkey = () => { this.DisableHotkey(); Main.keybindingManager.addHotKey('gTile', this.hotkey, this.app.ToggleUI); + Main.keybindingManager.addHotKey('gTile2', 't', this.AutoTileMainAndList); }; this.DisableHotkey = () => { Main.keybindingManager.removeHotKey('gTile'); + Main.keybindingManager.removeHotKey('gTile2'); }; this.updateSettings = () => { for (const grid of this.app.Grids) { @@ -126,6 +128,24 @@ class Config { this.DisableHotkey(); }; this.app = app; + this.AutoTileMainAndList = () => { + this.app.platform.reset_window(this.app.FocusMetaWindow); + let monitor = this.app.CurrentMonitor; + let [screenX, screenY, screenWidth, screenHeight] = getUsableScreenArea(monitor); + let windows = this.app.GetNotFocusedWindowsOfMonitor(monitor); + this.app.platform.move_resize_window(this.app.FocusMetaWindow, screenX, screenY, screenWidth / 2, screenHeight); + let winHeight = screenHeight / windows.length; + let countWin = 0; + for (let windowIdx in windows) { + let metaWindow = windows[windowIdx]; + let newOffset = countWin * winHeight; + this.app.platform.reset_window(metaWindow); + this.app.platform.move_resize_window(metaWindow, screenX + screenWidth / 2, screenY + newOffset, screenWidth / 2, winHeight); + countWin++; + } + }; + + this.settings = new Settings.ExtensionSettings(this, 'gTile@shuairan'); this.settings.bindProperty(Settings.BindingDirection.IN, 'hotkey', 'hotkey', this.EnableHotkey, null); this.settings.bindProperty(Settings.BindingDirection.OUT, 'lastGridRows', 'nbCols'); @@ -380,8 +400,8 @@ let AutoTileMainAndList = class AutoTileMainAndList extends ActionButton { constructor(app) { super('action-main-list', "auto_tile_0-symbolic"); this._onButtonPress = () => { - if (!this.app.FocusMetaWindow) - return false; + // if (!this.app.FocusMetaWindow) + // return false; this.app.platform.reset_window(this.app.FocusMetaWindow); let monitor = this.app.CurrentMonitor; let [screenX, screenY, screenWidth, screenHeight] = getUsableScreenArea(monitor);