Skip to content

Commit

Permalink
version 7: smart resize of adjacent tiled windows
Browse files Browse the repository at this point in the history
  • Loading branch information
domferr committed May 21, 2024
1 parent e1515cd commit f5c1941
Show file tree
Hide file tree
Showing 18 changed files with 603 additions and 46 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Modern Window Manager #

![](https://img.shields.io/github/v/release/domferr/modernwindowmanager)
![](https://img.shields.io/badge/GNOME-40--46-e04196)
![](https://img.shields.io/github/downloads/domferr/modernwindowmanager/total)
![](https://img.shields.io/badge/Built%20with-Typescript-blue)
![](https://img.shields.io/github/license/domferr/modernwindowmanager)

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.
# Modern Window Manager #

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!
- 🤩 First and only extension that provides Windows 11's **snap assistant**
- 🖥️🖥️ **multiple monitors support**, even with different scaling factors!
- ⚙️ Manage, edit, create and delete layouts with a **built-in editor**
Expand Down
4 changes: 4 additions & 0 deletions resources/icons/add-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/icons/cancel-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions resources/icons/done-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions resources/icons/info-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<description>Internal gaps between tiles in a layout.</description>
</key>
<key name="outer-gaps" type="u">
<default>16</default>
<default>8</default>
<summary>Outer gaps</summary>
<description>External gaps between the layout and the monitor borders.</description>
</key>
Expand All @@ -52,6 +52,11 @@
<summary>Restore window size</summary>
<description>Restore the windows to their original size when untiled.</description>
</key>
<key name="resize-complementing-windows" type="b">
<default>true</default>
<summary>Enable auto-resize of the complementing tiled windows</summary>
<description>When a tiled window is resized, auto-resize the other tiled windows near it.</description>
</key>
</schema>

</schemalist>
32 changes: 16 additions & 16 deletions src/components/editor/editorDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import LayoutButton from '../../indicator/layoutButton';
import GlobalState from '@/globalState';
import { logger } from '@/utils/shell';
import Layout from '@/components/layout/Layout';
import SignalHandling from '@/signalHandling';

import Tile from '@/components/layout/Tile';
import * as ModalDialog from 'resource:///org/gnome/shell/ui/modalDialog.js';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
Expand All @@ -27,7 +27,8 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
onDeleteLayout: (ind: number, lay: Layout) => void,
onSelectLayout: (ind: number, lay: Layout) => void,
onNewLayout: () => void,
legend: boolean
legend: boolean,
onClose: () => void
}) {
super({
destroyOnClose: true,
Expand All @@ -39,8 +40,6 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
const scalingFactor = getScalingFactor(monitor?.index || Main.layoutManager.primaryIndex);
enableScalingFactorSupport(this, scalingFactor);
}

this._signals = new SignalHandling();

this.contentLayout.add_child(new St.Label({
text: "Select the layout to edit",
Expand All @@ -67,15 +66,13 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
label: 'Close',
default: true,
key: Clutter.KEY_Escape,
action: () => {
this.destroy();
},
action: () => params.onClose(),
});

if (params.legend) this._makeLegendDialog();
if (params.legend) this._makeLegendDialog({ onClose: params.onClose });
}

private _makeLegendDialog() {
private _makeLegendDialog(params: { onClose: () => void }) {
const suggestion1 = new St.BoxLayout({ vertical: false });
// LEFT-CLICK to split a tile
suggestion1.add_child(new St.Label({
Expand Down Expand Up @@ -164,17 +161,16 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
label: 'Start editing',
default: true,
key: Clutter.KEY_Escape,
action: () => {
this.destroy();
},
action: params.onClose,
});
}

private _drawLayouts(params: {
layouts: Layout[],
onDeleteLayout: (ind: number, lay: Layout) => void,
onSelectLayout: (ind: number, lay: Layout) => void,
onNewLayout: () => void
onNewLayout: () => void,
onClose: () => void
}) {
const gaps = Settings.get_inner_gaps(1).top > 0 ? this._gapsSize:0
this._layoutsBoxLayout.destroy_all_children();
Expand All @@ -188,7 +184,11 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
this._layoutsBoxLayout.add_child(box);
const btn = new LayoutButton(box, lay, gaps, this._layoutHeight, this._layoutWidth);
if (params.layouts.length > 1) {
const deleteBtn = new St.Button({xExpand: false, xAlign: Clutter.ActorAlign.CENTER, styleClass: "message-list-clear-button icon-button button delete-layout-button"});
const deleteBtn = new St.Button({
xExpand: false,
xAlign: Clutter.ActorAlign.CENTER,
styleClass: "message-list-clear-button icon-button button delete-layout-button"
});
deleteBtn.child = new St.Icon({ iconName: "edit-delete-symbolic", iconSize: 16 });
deleteBtn.connect('clicked', (self) => {
params.onDeleteLayout(btnInd, lay);
Expand All @@ -198,7 +198,7 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
}
btn.connect('clicked', (self) => {
params.onSelectLayout(btnInd, lay);
this._makeLegendDialog();
this._makeLegendDialog({ onClose: params.onClose });
});
return btn;
});
Expand All @@ -215,7 +215,7 @@ export default class EditorDialog extends ModalDialog.ModalDialog {
newLayoutBtn.child.add_child(icon);
newLayoutBtn.connect('clicked', (self) => {
params.onNewLayout();
this._makeLegendDialog();
this._makeLegendDialog({ onClose: params.onClose });
});
}
}
2 changes: 1 addition & 1 deletion src/components/tilepreview/blurTilePreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class BlurTilePreview extends TilePreview {
new Shell.BlurEffect({
//@ts-ignore
sigma: sigma,
radius: sigma * 2,
//radius: sigma * 2,
brightness: 1,
mode: Shell.BlurMode.BACKGROUND, // blur what is behind the widget
}),
Expand Down
1 change: 1 addition & 0 deletions src/components/tilingsystem/extendedWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import Mtk from "gi://Mtk";

export default interface ExtendedWindow extends Meta.Window {
originalSize: Mtk.Rectangle | undefined;
isTiled: boolean;
}
Loading

0 comments on commit f5c1941

Please sign in to comment.