Skip to content

Commit 13fce64

Browse files
committed
version 10.0: edge-tiling, blur, customize keybindings, dbus changes
1 parent 5ba65f9 commit 13fce64

20 files changed

+835
-219
lines changed

README.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Have issues, you want to suggest a new feature or contribute? Please open a new
3030
## Usage ##
3131

3232
### Tiling System ###
33-
When grabbing and moving a window, press <kbd>CTRL</kbd> key to show the tiling layout. When moving on a tile, it will highlight. Ungrab the window to place that window on the highlighted tile.
33+
When grabbing and moving a window, press <kbd>CTRL</kbd> key to show the tiling layout (you can choose another key from the preferences). When moving on a tile, it will highlight. Ungrab the window to place that window on the highlighted tile.
3434

3535
[tiling_system.webm](https://github.com/domferr/tilingshell/assets/14203981/a45ec416-ad39-458d-9b9f-cddce8b25666)
3636

@@ -54,7 +54,9 @@ The layout is not strict. You can select multiple tiles too! Just hold <kbd>ALT<
5454

5555
### Layout editor ###
5656

57-
> <kbd>LEFT CLICK</kbd> to split a tile. <kbd>LEFT CLICK</kbd> + <kbd>CTRL</kbd> to split a tile _vertically_. <kbd>RIGHT CLICK</kbd> to delete a tile.
57+
| Split a tile | Split a tile _vertically_ | Delete a tile | Save, close the editor or open the menu |
58+
|:---:|:---:|:---:|:---:|
59+
| <kbd>LEFT CLICK</kbd> | <kbd>LEFT CLICK</kbd> + <kbd>CTRL</kbd> | <kbd>RIGHT CLICK</kbd> | Click the Tiling Shell's icon <img src="https://github.com/domferr/tilingshell/assets/14203981/13e27ec1-6a5d-420f-a87f-8f3df0b34c92" width=96 /> on the panel. |
5860

5961
[layout_editor.webm](https://github.com/domferr/tilingshell/assets/14203981/c6e05589-69d9-4fa3-a4df-61ee875cf9e1)
6062

@@ -66,6 +68,20 @@ You can resize adjacent tiled windows together!
6668

6769
> It can be enabled/disabled from the preferences
6870
71+
### Tile using Keyboard ###
72+
73+
Move window through the tiles using keyboard shortcuts (<kbd>SUPER</kbd>+<kbd>←</kbd>/<kbd>↑</kbd>/<kbd>↓</kbd>/<kbd>→</kbd>). They can be customized from the preferences!
74+
75+
[Screencast from 2024-06-18 23-06-56.webm](https://github.com/domferr/tilingshell/assets/14203981/11c966b7-c140-4ecb-b8af-b514ec186ad6)
76+
77+
> It can be enabled/disabled from the preferences
78+
79+
### Edge Tiling ###
80+
81+
You can tile a window by moving it to the edge.
82+
83+
[Screencast from 2024-06-22 22-12-22.webm](https://github.com/domferr/tilingshell/assets/14203981/6e5a2ba9-cd38-44bb-b791-51e41e07f7a0)
84+
6985
## Installation
7086

7187
This extension is published on [extensions.gnome.org](https://extensions.gnome.org/extension/7065/tiling-shell/)! You can install from there or install manually. By installing from [extensions.gnome.org](https://extensions.gnome.org/extension/7065/tiling-shell/) you will always have the latest update.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tilingshell",
3-
"version": "9.1",
3+
"version": "10.0",
44
"author": "Domenico Ferraro <ferraro.domenico125@gmail.com>",
55
"private": true,
66
"license": "GPL v2.0",

resources/metadata.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"45",
1010
"46"
1111
],
12-
"version": 9,
13-
"version-name": "9.1",
12+
"version": 10,
13+
"version-name": "10.0",
1414
"url": "https://github.com/domferr/tilingshell",
1515
"settings-schema": "org.gnome.shell.extensions.tilingshell",
1616
"donations": {

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

+21
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,27 @@
6767
<summary>Enable auto-resize of the complementing tiled windows</summary>
6868
<description>When a tiled window is resized, auto-resize the other tiled windows near it.</description>
6969
</key>
70+
<key name="enable-blur-snap-assistant" type="b">
71+
<default>false</default>
72+
<summary>Enable Snap Assistant blur</summary>
73+
<description>Blur snap assistant</description>
74+
</key>
75+
<key name="enable-blur-selected-tilepreview" type="b">
76+
<default>false</default>
77+
<summary>Enable selected tile preview blur</summary>
78+
<description>Blur selected tile previews</description>
79+
</key>
80+
<key name="enable-move-keybindings" type="b">
81+
<default>true</default>
82+
<summary>Enable keybindings</summary>
83+
<description>Move focused window through tiles by using keybindings.</description>
84+
</key>
85+
<key name="overridden-settings" type="s">
86+
<default>'{}'</default>
87+
<summary>Overridden settings</summary>
88+
<description>The settings that are overridden and their old value.</description>
89+
</key>
90+
7091
<key type="as" name="move-window-right">
7192
<default><![CDATA[['<Super>Right']]]></default>
7293
<summary>Move focused window to the tile to its right</summary>

src/components/editor/editableTilePreview.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import Tile from "../layout/Tile";
66
import Slider from "./slider";
77
import TileUtils from "../layout/TileUtils";
88
import { logger } from "@/utils/shell";
9-
import { MetaInfo } from "gi://GObject";
9+
import GObject from "gi://GObject";
1010
import { registerGObjectClass } from "@utils/gjs";
1111

1212
const debug = logger("EditableTilePreview");
1313

1414
@registerGObjectClass
1515
export default class EditableTilePreview extends TilePreview {
16-
static metaInfo: MetaInfo = {
16+
static metaInfo: GObject.MetaInfo<any, any, any> = {
1717
Signals: {
1818
"size-changed": {
1919
//@ts-ignore todo

src/components/editor/slider.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ import { logger } from "@/utils/shell";
66
import Meta from 'gi://Meta';
77
import Mtk from 'gi://Mtk';
88
import GObject from "gi://GObject";
9-
import { MetaInfo } from "gi://GObject";
109
import { getEventCoords, getScalingFactorOf } from "@utils/ui";
1110

1211
const debug = logger("Slider");
1312

1413
@registerGObjectClass
1514
export default class Slider extends St.Button {
16-
static metaInfo: MetaInfo = {
15+
static metaInfo: GObject.MetaInfo<any, any, any> = {
1716
Signals: {
1817
"slide": {
1918
param_types: [ GObject.TYPE_INT ] // movement

src/components/snapassist/snapAssist.ts

+47-34
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import Clutter from "gi://Clutter";
33
import Meta from "gi://Meta";
44
import Mtk from "gi://Mtk";
55
import St from "gi://St";
6-
import Shell from "gi://Shell";
6+
import Gio from "gi://Gio";
77
import { logger } from "@/utils/shell";
8-
import { MetaInfo } from "gi://GObject";
8+
import GObject from "gi://GObject";
99
import SnapAssistTile from "./snapAssistTile";
1010
import SnapAssistLayout from "./snapAssistLayout";
1111
import Layout from "../layout/Layout";
1212
import Tile from "../layout/Tile";
1313
import Settings from "@/settings";
1414
import GlobalState from "@/globalState";
1515
import SignalHandling from "@/signalHandling";
16-
import { buildMargin, enableScalingFactorSupport, getScalingFactorOf } from "@utils/ui";
16+
import { buildBlurEffect, buildMargin, enableScalingFactorSupport, getScalingFactorOf } from "@utils/ui";
1717

1818
export const SNAP_ASSIST_SIGNAL = 'snap-assist';
1919
export const SNAP_ASSIST_ANIMATION_TIME = 180;
@@ -22,6 +22,19 @@ const debug = logger("snapAssist");
2222

2323
@registerGObjectClass
2424
class SnapAssistContent extends St.BoxLayout {
25+
static metaInfo: GObject.MetaInfo<any, any, any> = {
26+
GTypeName: "SnapAssistContent",
27+
Properties: {
28+
'blur': GObject.ParamSpec.boolean(
29+
'blur',
30+
'blur',
31+
'Enable or disable the blur effect',
32+
GObject.ParamFlags.READWRITE,
33+
false
34+
),
35+
},
36+
};
37+
2538
// distance from top when the snap assistant is enlarged
2639
private readonly _enlargedVerticalDistance = 24;
2740
// cursor's max distance from the snap assistant to enlarge it
@@ -36,6 +49,7 @@ class SnapAssistContent extends St.BoxLayout {
3649
private _isEnlarged = false;
3750
private _hoveredTile: SnapAssistTile | undefined;
3851
private _bottomPadding: number;
52+
private _blur: boolean;
3953

4054
constructor(container: St.Widget) {
4155
super({
@@ -54,17 +68,14 @@ class SnapAssistContent extends St.BoxLayout {
5468
this._isEnlarged = false;
5569
this._showing = true;
5670
this._bottomPadding = 0;
71+
this._blur = false;
72+
73+
Settings.bind(Settings.SETTING_ENABLE_BLUR_SNAP_ASSISTANT, this, "blur", Gio.SettingsBindFlags.GET);
5774

58-
/*this._recolor();
75+
this._applyStyle();
5976
this._signals.connect(St.ThemeContext.get_for_stage(global.get_stage()), "changed", () => {
60-
this.set_style(null);
61-
this._recolor();
62-
});*/
63-
const [alreadyScaled, finalScalingFactor] = getScalingFactorOf(this);
64-
this._bottomPadding = (alreadyScaled ? 1:finalScalingFactor) * (this.get_theme_node().get_padding(St.Side.BOTTOM) / (alreadyScaled ? finalScalingFactor:1));
65-
this.set_style(`
66-
padding: ${this._bottomPadding}px !important;
67-
`);
77+
this._applyStyle();
78+
});
6879

6980
this._setLayouts(GlobalState.get().layouts);
7081
this._signals.connect(GlobalState.get(), GlobalState.SIGNAL_LAYOUTS_CHANGED, () => {
@@ -73,38 +84,40 @@ class SnapAssistContent extends St.BoxLayout {
7384

7485
this.connect("destroy", () => this._signals.disconnect());
7586

76-
this.close(false);
87+
this.close();
7788
}
7889

79-
/*_init() {
90+
set blur(value: boolean) {
91+
if (this._blur === value) return;
92+
93+
this._blur = value;
94+
this.get_effect("blur")?.set_enabled(value);
95+
this._applyStyle();
96+
}
97+
98+
_init() {
8099
super._init();
81100

82-
// changes in GNOME 46+
83-
// The sigma in Shell.BlurEffect should be replaced by radius. Since the sigma value
84-
// is radius / 2.0, the radius value will be sigma * 2.0.
85-
const sigma = 36;
86-
this.add_effect(
87-
new Shell.BlurEffect({
88-
//@ts-ignore
89-
sigma: sigma,
90-
//radius: sigma * 2,
91-
brightness: 1,
92-
mode: Shell.BlurMode.BACKGROUND, // blur what is behind the widget
93-
}),
94-
);
101+
const effect = buildBlurEffect(48);
102+
effect.set_name("blur");
103+
effect.set_enabled(this._blur);
104+
this.add_effect(effect);
105+
95106
this.add_style_class_name("popup-menu-content snap-assistant");
96107
}
97108

98-
private _recolor() {
109+
private _applyStyle() {
110+
this.set_style(null);
111+
99112
const [alreadyScaled, finalScalingFactor] = getScalingFactorOf(this);
100113
this._bottomPadding = (alreadyScaled ? 1:finalScalingFactor) * (this.get_theme_node().get_padding(St.Side.BOTTOM) / (alreadyScaled ? finalScalingFactor:1));
101114
const backgroundColor = this.get_theme_node().get_background_color().copy();
102-
const alpha = 0.6;
115+
const alpha = this._blur ? 0.6:backgroundColor.alpha;
103116
this.set_style(`
104117
padding: ${this._bottomPadding}px !important;
105118
background-color: rgba(${backgroundColor.red}, ${backgroundColor.green}, ${backgroundColor.blue}, ${alpha}) !important;
106119
`);
107-
}*/
120+
}
108121

109122
public close(ease: boolean = false) {
110123
if (!this._showing) return;
@@ -248,13 +261,13 @@ class SnapAssistContent extends St.BoxLayout {
248261

249262
@registerGObjectClass
250263
export default class SnapAssist extends St.Widget {
251-
static metaInfo: MetaInfo = {
264+
static metaInfo: GObject.MetaInfo<any, any, any> = {
265+
GTypeName: "SnapAssist",
252266
Signals: {
253267
"snap-assist": {
254268
param_types: [ Tile.$gtype ]
255269
},
256-
},
257-
GTypeName: "SnapAssist"
270+
}
258271
}
259272

260273
private readonly _content: SnapAssistContent;
@@ -265,10 +278,10 @@ export default class SnapAssist extends St.Widget {
265278
this.workArea = workArea;
266279
this.set_clip(0, 0, workArea.width, workArea.height);
267280
if (scalingFactor) enableScalingFactorSupport(this, scalingFactor);
281+
268282
this._content = new SnapAssistContent(this);
269283
}
270284

271-
272285
public set workArea(newWorkArea: Mtk.Rectangle) {
273286
this.set_position(newWorkArea.x, newWorkArea.y);
274287
this.set_width(newWorkArea.width);
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,75 @@
11
import { registerGObjectClass } from "@/utils/gjs";
22
import Clutter from 'gi://Clutter';
33
import St from 'gi://St';
4+
import Gio from 'gi://Gio';
45
import TilePreview from "./tilePreview";
56
import { logger } from "@/utils/shell";
6-
import BlurTilePreview from "./blurTilePreview";
7+
import Settings from "@settings";
8+
import GObject from "gi://GObject";
9+
import { buildBlurEffect } from "@utils/ui";
710

811
const debug = logger("SelectionTilePreview");
912

1013
@registerGObjectClass
1114
export default class SelectionTilePreview extends TilePreview {
15+
static metaInfo: GObject.MetaInfo<any, any, any> = {
16+
GTypeName: "SelectionTilePreview",
17+
Properties: {
18+
'blur': GObject.ParamSpec.boolean(
19+
'blur',
20+
'blur',
21+
'Enable or disable the blur effect',
22+
GObject.ParamFlags.READWRITE,
23+
false
24+
)
25+
},
26+
};
27+
28+
private _blur: boolean;
29+
1230
constructor(params: {
13-
parent: Clutter.Actor,
31+
parent: Clutter.Actor
1432
}) {
1533
super({ parent: params.parent, name: "SelectionTilePreview" });
1634

35+
this._blur = false;
36+
37+
Settings.bind(Settings.SETTING_ENABLE_BLUR_SELECTED_TILEPREVIEW, this, "blur", Gio.SettingsBindFlags.GET);
38+
1739
this._recolor();
1840
const styleChangedSignalID = St.ThemeContext.get_for_stage(global.get_stage()).connect("changed", () => {
19-
this.set_style(null);
2041
this._recolor();
2142
});
2243
this.connect("destroy", () => St.ThemeContext.get_for_stage(global.get_stage()).disconnect(styleChangedSignalID));
2344
this._rect.width = this.gaps.left + this.gaps.right;
2445
this._rect.height = this.gaps.top + this.gaps.bottom;
2546
}
2647

48+
set blur(value: boolean) {
49+
if (this._blur === value) return;
50+
51+
this._blur = value;
52+
this.get_effect("blur")?.set_enabled(value);
53+
if (this._blur) this.add_style_class_name("blur-tile-preview");
54+
else this.remove_style_class_name("blur-tile-preview");
55+
56+
this._recolor();
57+
}
58+
2759
_init() {
2860
super._init();
61+
62+
const effect = buildBlurEffect(48);
63+
effect.set_name("blur");
64+
effect.set_enabled(this._blur);
65+
this.add_effect(effect);
66+
2967
this.add_style_class_name("selection-tile-preview");
3068
}
3169

3270
_recolor() {
71+
this.set_style(null);
72+
3373
const backgroundColor = this.get_theme_node().get_background_color().copy();
3474
// since an alpha value lower than 160 is not so much visible, enforce a minimum value of 160
3575
const newAlpha = Math.max(Math.min(backgroundColor.alpha + 35, 255), 160);
@@ -42,11 +82,11 @@ export default class SelectionTilePreview extends TilePreview {
4282
`);*/
4383
}
4484

45-
close() {
85+
close(ease: boolean = false) {
4686
if (!this._showing) return;
4787

4888
this._rect.width = this.gaps.left + this.gaps.right;
4989
this._rect.height = this.gaps.top + this.gaps.bottom;
50-
super.close();
90+
super.close(ease);
5191
}
5292
}

src/components/tilepreview/tilePreview.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ export default class TilePreview extends St.Widget {
130130
this.open(ease, position);
131131
}
132132

133-
public close() {
133+
public close(ease: boolean = false) {
134134
if (!this._showing) return;
135135

136136
this._showing = false;
137137
// @ts-ignore
138138
this.ease({
139139
opacity: 0,
140-
duration: WINDOW_ANIMATION_TIME,
140+
duration: ease ? WINDOW_ANIMATION_TIME : 0,
141141
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
142142
onComplete: () => this.hide(),
143143
});

0 commit comments

Comments
 (0)