Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions gTile@shuairan/files/gTile@shuairan/5.4/gTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ class Config {
this.EnableHotkey = () => {
this.DisableHotkey();
Main.keybindingManager.addHotKey('gTile', this.hotkey, this.app.ToggleUI);
Main.keybindingManager.addHotKey('gTile2', '<Super>t', this.AutoTileMainAndList);
};
this.DisableHotkey = () => {
Main.keybindingManager.removeHotKey('gTile');
Main.keybindingManager.removeHotKey('gTile2');
};
this.updateSettings = () => {
for (const grid of this.app.Grids) {
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down