Skip to content

Commit f5c1941

Browse files
committed
version 7: smart resize of adjacent tiled windows
1 parent e1515cd commit f5c1941

18 files changed

+603
-46
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Modern Window Manager #
2-
31
![](https://img.shields.io/github/v/release/domferr/modernwindowmanager)
42
![](https://img.shields.io/badge/GNOME-40--46-e04196)
53
![](https://img.shields.io/github/downloads/domferr/modernwindowmanager/total)
64
![](https://img.shields.io/badge/Built%20with-Typescript-blue)
75
![](https://img.shields.io/github/license/domferr/modernwindowmanager)
86

9-
This is a Gnome Shell extension implementing modern windows tiling system by extending GNOME's default 2 columns to any layout you want! Can be installed on Gnome Shells from **40 to 46** on X11 and Wayland.
7+
# Modern Window Manager #
8+
9+
This is a Gnome Shell extension implementing modern windows tiling system by extending GNOME's default 2 columns to any layout you want! Can be installed on Gnome Shells from **40 to 46** on X11 and Wayland: the most recent GNOME Shell is supported, and older releases will include all the features and bug fixes!
1010
- 🤩 First and only extension that provides Windows 11's **snap assistant**
1111
- 🖥️🖥️ **multiple monitors support**, even with different scaling factors!
1212
- ⚙️ Manage, edit, create and delete layouts with a **built-in editor**

resources/icons/add-symbolic.svg

Lines changed: 4 additions & 0 deletions
Loading

resources/icons/cancel-symbolic.svg

Lines changed: 4 additions & 0 deletions
Loading

resources/icons/done-symbolic.svg

Lines changed: 3 additions & 0 deletions
Loading

resources/icons/info-symbolic.svg

Lines changed: 3 additions & 0 deletions
Loading

resources/schemas/org.gnome.shell.extensions.modernwindowmanager.gschema.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<description>Internal gaps between tiles in a layout.</description>
2929
</key>
3030
<key name="outer-gaps" type="u">
31-
<default>16</default>
31+
<default>8</default>
3232
<summary>Outer gaps</summary>
3333
<description>External gaps between the layout and the monitor borders.</description>
3434
</key>
@@ -52,6 +52,11 @@
5252
<summary>Restore window size</summary>
5353
<description>Restore the windows to their original size when untiled.</description>
5454
</key>
55+
<key name="resize-complementing-windows" type="b">
56+
<default>true</default>
57+
<summary>Enable auto-resize of the complementing tiled windows</summary>
58+
<description>When a tiled window is resized, auto-resize the other tiled windows near it.</description>
59+
</key>
5560
</schema>
5661

5762
</schemalist>

src/components/editor/editorDialog.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import LayoutButton from '../../indicator/layoutButton';
66
import GlobalState from '@/globalState';
77
import { logger } from '@/utils/shell';
88
import Layout from '@/components/layout/Layout';
9-
import SignalHandling from '@/signalHandling';
9+
1010
import Tile from '@/components/layout/Tile';
1111
import * as ModalDialog from 'resource:///org/gnome/shell/ui/modalDialog.js';
1212
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
@@ -27,7 +27,8 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
2727
onDeleteLayout: (ind: number, lay: Layout) => void,
2828
onSelectLayout: (ind: number, lay: Layout) => void,
2929
onNewLayout: () => void,
30-
legend: boolean
30+
legend: boolean,
31+
onClose: () => void
3132
}) {
3233
super({
3334
destroyOnClose: true,
@@ -39,8 +40,6 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
3940
const scalingFactor = getScalingFactor(monitor?.index || Main.layoutManager.primaryIndex);
4041
enableScalingFactorSupport(this, scalingFactor);
4142
}
42-
43-
this._signals = new SignalHandling();
4443

4544
this.contentLayout.add_child(new St.Label({
4645
text: "Select the layout to edit",
@@ -67,15 +66,13 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
6766
label: 'Close',
6867
default: true,
6968
key: Clutter.KEY_Escape,
70-
action: () => {
71-
this.destroy();
72-
},
69+
action: () => params.onClose(),
7370
});
7471

75-
if (params.legend) this._makeLegendDialog();
72+
if (params.legend) this._makeLegendDialog({ onClose: params.onClose });
7673
}
7774

78-
private _makeLegendDialog() {
75+
private _makeLegendDialog(params: { onClose: () => void }) {
7976
const suggestion1 = new St.BoxLayout({ vertical: false });
8077
// LEFT-CLICK to split a tile
8178
suggestion1.add_child(new St.Label({
@@ -164,17 +161,16 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
164161
label: 'Start editing',
165162
default: true,
166163
key: Clutter.KEY_Escape,
167-
action: () => {
168-
this.destroy();
169-
},
164+
action: params.onClose,
170165
});
171166
}
172167

173168
private _drawLayouts(params: {
174169
layouts: Layout[],
175170
onDeleteLayout: (ind: number, lay: Layout) => void,
176171
onSelectLayout: (ind: number, lay: Layout) => void,
177-
onNewLayout: () => void
172+
onNewLayout: () => void,
173+
onClose: () => void
178174
}) {
179175
const gaps = Settings.get_inner_gaps(1).top > 0 ? this._gapsSize:0
180176
this._layoutsBoxLayout.destroy_all_children();
@@ -188,7 +184,11 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
188184
this._layoutsBoxLayout.add_child(box);
189185
const btn = new LayoutButton(box, lay, gaps, this._layoutHeight, this._layoutWidth);
190186
if (params.layouts.length > 1) {
191-
const deleteBtn = new St.Button({xExpand: false, xAlign: Clutter.ActorAlign.CENTER, styleClass: "message-list-clear-button icon-button button delete-layout-button"});
187+
const deleteBtn = new St.Button({
188+
xExpand: false,
189+
xAlign: Clutter.ActorAlign.CENTER,
190+
styleClass: "message-list-clear-button icon-button button delete-layout-button"
191+
});
192192
deleteBtn.child = new St.Icon({ iconName: "edit-delete-symbolic", iconSize: 16 });
193193
deleteBtn.connect('clicked', (self) => {
194194
params.onDeleteLayout(btnInd, lay);
@@ -198,7 +198,7 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
198198
}
199199
btn.connect('clicked', (self) => {
200200
params.onSelectLayout(btnInd, lay);
201-
this._makeLegendDialog();
201+
this._makeLegendDialog({ onClose: params.onClose });
202202
});
203203
return btn;
204204
});
@@ -215,7 +215,7 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
215215
newLayoutBtn.child.add_child(icon);
216216
newLayoutBtn.connect('clicked', (self) => {
217217
params.onNewLayout();
218-
this._makeLegendDialog();
218+
this._makeLegendDialog({ onClose: params.onClose });
219219
});
220220
}
221221
}

src/components/tilepreview/blurTilePreview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default class BlurTilePreview extends TilePreview {
1515
new Shell.BlurEffect({
1616
//@ts-ignore
1717
sigma: sigma,
18-
radius: sigma * 2,
18+
//radius: sigma * 2,
1919
brightness: 1,
2020
mode: Shell.BlurMode.BACKGROUND, // blur what is behind the widget
2121
}),

src/components/tilingsystem/extendedWindow.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import Mtk from "gi://Mtk";
33

44
export default interface ExtendedWindow extends Meta.Window {
55
originalSize: Mtk.Rectangle | undefined;
6+
isTiled: boolean;
67
}

0 commit comments

Comments
 (0)