Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tilingshell",
"version": "15.0",
"version": "15.1",
"author": "Domenico Ferraro <ferraro.domenico125@gmail.com>",
"private": true,
"license": "GPL v2.0",
Expand Down
2 changes: 1 addition & 1 deletion resources/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"47"
],
"version": 99,
"version-name": "15.0",
"version-name": "15.1",
"url": "https://github.com/domferr/tilingshell",
"settings-schema": "org.gnome.shell.extensions.tilingshell",
"gettext-domain": "tilingshell",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
<summary>Restore window size</summary>
<description>Restore the windows to their original size when untiled.</description>
</key>
<key name="enable-wraparound-focus" type="b">
<default>false</default>
<summary>Enable next/previous window focus to wrap around</summary>
<description>When focusing next or previous window, wrap around at the window edge</description>
</key>
<key name="resize-complementing-windows" type="b">
<default>true</default>
<summary>Enable auto-resize of the complementing tiled windows</summary>
Expand Down Expand Up @@ -137,6 +142,11 @@
<summary>Focused window border width</summary>
<description>The width of the focused window's border.</description>
</key>
<key name="enable-smart-window-border-radius" type="b">
<default>true</default>
<summary>Enable smart window border radius</summary>
<description>Dinamically adapt to the window's border radius.</description>
</key>
<key name="snap-assistant-animation-time" type="u">
<default>180</default>
<summary>Snap assistant animation time (milliseconds)</summary>
Expand Down Expand Up @@ -209,6 +219,14 @@
<default><![CDATA[['']]]></default>
<summary>Focus the window below the current focused window</summary>
</key>
<key type="as" name="focus-window-next">
<default><![CDATA[['']]]></default>
<summary>Focus the window next to the current focused window</summary>
</key>
<key type="as" name="focus-window-prev">
<default><![CDATA[['']]]></default>
<summary>Focus the window prior to the current focused window</summary>
</key>
</schema>

</schemalist>
5 changes: 0 additions & 5 deletions src/components/editor/editableTilePreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export default class EditableTilePreview extends TilePreview {
public static MIN_TILE_SIZE: number = 140;

private readonly _btn: St.Button;
private readonly _tile: Tile;
private readonly _containerRect: Mtk.Rectangle;

private _sliders: (Slider | null)[];
Expand Down Expand Up @@ -51,10 +50,6 @@ export default class EditableTilePreview extends TilePreview {
this.connect('destroy', this._onDestroy.bind(this));
}

public get tile(): Tile {
return this._tile;
}

public getSlider(side: St.Side): Slider | null {
return this._sliders[side];
}
Expand Down
1 change: 1 addition & 0 deletions src/components/editor/layoutEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default class LayoutEditor extends St.Widget {

this._layout = layout;
this._drawEditor();
this.grab_key_focus();

this.connect('destroy', this._onDestroy.bind(this));
}
Expand Down
5 changes: 0 additions & 5 deletions src/components/snapassist/snapAssistTile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { getScalingFactorOf } from '@utils/ui';

@registerGObjectClass
export default class SnapAssistTile extends TilePreview {
protected _tile: Tile;
private _styleChangedSignalID: number | undefined;

constructor(params: {
Expand Down Expand Up @@ -53,10 +52,6 @@ export default class SnapAssistTile extends TilePreview {
this.set_style_class_name('snap-assist-tile button');
}

public get tile() {
return this._tile;
}

_applyStyle() {
// the tile will be light or dark, following the text color
const [hasColor, { red, green, blue }] =
Expand Down
95 changes: 95 additions & 0 deletions src/components/tilepreview/popupTilePreview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { registerGObjectClass } from '@/utils/gjs';
import { GObject, St, Clutter, Gio, Mtk } from '@gi.ext';
import TilePreview from './tilePreview';
import Settings from '@settings/settings';
import { buildBlurEffect } from '@utils/ui';
import Tile from '@components/layout/Tile';

@registerGObjectClass
export default class PopupTilePreview extends TilePreview {
static metaInfo: GObject.MetaInfo<unknown, unknown, unknown> = {
GTypeName: 'PopupTilePreview',
Properties: {
blur: GObject.ParamSpec.boolean(
'blur',
'blur',
'Enable or disable the blur effect',
GObject.ParamFlags.READWRITE,
false,
),
},
};

private _blur: boolean;

constructor(params: {
parent: Clutter.Actor;
tile?: Tile;
rect?: Mtk.Rectangle;
gaps?: Clutter.Margin;
}) {
super(params);

this._blur = false;

// blur not supported due to GNOME shell known bug
/* Settings.bind(
Settings.KEY_ENABLE_BLUR_SELECTED_TILEPREVIEW,
this,
'blur',
Gio.SettingsBindFlags.GET,
);*/

this._recolor();
const styleChangedSignalID = St.ThemeContext.get_for_stage(
global.get_stage(),
).connect('changed', () => {
this._recolor();
});
this.connect('destroy', () =>
St.ThemeContext.get_for_stage(global.get_stage()).disconnect(
styleChangedSignalID,
),
);
}

set blur(value: boolean) {
if (this._blur === value) return;

this._blur = value;
// blur not supported due to GNOME shell known bug
/* this.get_effect('blur')?.set_enabled(value);
if (this._blur) this.add_style_class_name('blur-tile-preview');
else this.remove_style_class_name('blur-tile-preview');

this._recolor();*/
}

_init() {
super._init();

const effect = buildBlurEffect(48);
effect.set_name('blur');
effect.set_enabled(this._blur);
this.add_effect(effect);

this.add_style_class_name('selection-tile-preview');
}

_recolor() {
this.set_style(null);

const backgroundColor = this.get_theme_node()
.get_background_color()
.copy();
// since an alpha value lower than 160 is not so much visible, enforce a minimum value of 160
const newAlpha = Math.max(
Math.min(backgroundColor.alpha + 35, 255),
160,
);
// The final alpha value is divided by 255 since CSS needs a value from 0 to 1, but ClutterColor expresses alpha from 0 to 255
this.set_style(`
background-color: rgba(${backgroundColor.red}, ${backgroundColor.green}, ${backgroundColor.blue}, ${newAlpha / 255}) !important;
`);
}
}
13 changes: 10 additions & 3 deletions src/components/tilepreview/selectionTilePreview.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { registerGObjectClass } from '@/utils/gjs';
import { GObject, St, Clutter, Gio } from '@gi.ext';
import { GObject, St, Clutter, Gio, Mtk } from '@gi.ext';
import TilePreview from './tilePreview';
import Settings from '@settings/settings';
import { buildBlurEffect } from '@utils/ui';
import Tile from '@components/layout/Tile';

@registerGObjectClass
export default class SelectionTilePreview extends TilePreview {
Expand All @@ -21,8 +22,14 @@ export default class SelectionTilePreview extends TilePreview {

private _blur: boolean;

constructor(params: { parent: Clutter.Actor }) {
super({ parent: params.parent, name: 'SelectionTilePreview' });
constructor(params: {
parent: Clutter.Actor;
tile?: Tile;
containerRect?: Mtk.Rectangle;
rect?: Mtk.Rectangle;
gaps?: Clutter.Margin;
}) {
super(params);

this._blur = false;

Expand Down
10 changes: 10 additions & 0 deletions src/components/tilepreview/tilePreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@ import { St, Clutter, Mtk, Meta } from '@gi.ext';
import { registerGObjectClass } from '@/utils/gjs';
import { buildRectangle, getScalingFactorOf } from '@utils/ui';
import GlobalState from '@utils/globalState';
import Tile from '@components/layout/Tile';

// export module TilePreview {
export interface TilePreviewConstructorProperties
extends St.Widget.ConstructorProps {
parent: Clutter.Actor;
rect: Mtk.Rectangle;
gaps: Clutter.Margin;
tile: Tile;
}
// }

@registerGObjectClass
export default class TilePreview extends St.Widget {
protected _rect: Mtk.Rectangle;
protected _showing: boolean;
protected _tile: Tile;

private _gaps: Clutter.Margin;

Expand All @@ -27,6 +30,9 @@ export default class TilePreview extends St.Widget {
this._rect = params.rect || buildRectangle({});
this._gaps = new Clutter.Margin();
this.gaps = params.gaps || new Clutter.Margin();
this._tile =
params.tile ||
new Tile({ x: 0, y: 0, width: 0, height: 0, groups: [] });
}

public set gaps(gaps: Clutter.Margin) {
Expand All @@ -50,6 +56,10 @@ export default class TilePreview extends St.Widget {
return this._gaps;
}

public get tile() {
return this._tile;
}

_init() {
super._init();
this.set_style_class_name('tile-preview custom-tile-preview');
Expand Down
Loading