-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
version 15.1: smart window border, new keybindings, bugfixes and more! (
#217)
- Loading branch information
Showing
36 changed files
with
2,288 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
[ | ||
{ | ||
"id": "split-half", | ||
"tiles": [ | ||
{ | ||
"x": 0, | ||
"y": 0, | ||
"width": 0.5, | ||
"height": 1, | ||
"groups": [ | ||
2 | ||
] | ||
}, | ||
{ | ||
"x": 0.5, | ||
"y": 0, | ||
"width": 0.5, | ||
"height": 1, | ||
"groups": [ | ||
1 | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "split-thirds", | ||
"tiles": [ | ||
{ | ||
"x": 0, | ||
"y": 0, | ||
"width": 0.333, | ||
"height": 1, | ||
"groups": [ | ||
2, | ||
3 | ||
] | ||
}, | ||
{ | ||
"x": 0.333, | ||
"y": 0, | ||
"width": 0.333, | ||
"height": 1, | ||
"groups": [ | ||
3, | ||
1 | ||
] | ||
}, | ||
{ | ||
"x": 0.666, | ||
"y": 0, | ||
"width": 0.333, | ||
"height": 1, | ||
"groups": [ | ||
2, | ||
1 | ||
] | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Documentation for JSON exported layouts | ||
|
||
*Tiling Shell* supports importing and exporting its layouts as a JSON file. With this you can create your own custom layouts, or fine-tune already existing layouts. | ||
|
||
The exported layouts (from the preferences) are a collection of `Layout` objects. A `Layout` object is an object with two (2) properties: | ||
|
||
- identifier as a `string` | ||
- a list of `Tile` objects | ||
|
||
Example JSON of a `Layout` object would look like | ||
|
||
```json | ||
{ | ||
"id": "The identifier", | ||
"tiles": [ | ||
... | ||
] | ||
} | ||
``` | ||
|
||
A `Tile` object has five (5) properties: | ||
|
||
- The X (`x`) axis as a `float` | ||
- The Y (`y`) axis as a `float` | ||
- The width (`width`) as a `float` | ||
- The height (`height`) as a `float` | ||
- A list of identifiers `groups` | ||
|
||
The `x`, `y`, `width` and `height` are percentages relative to the screen size. Both `x` and `y` start from the top left of a `Tile`. | ||
|
||
So a `Tile` with `x` = 0.5 and `y` = 0.5, on a screen with a resolution of 1920x1080 pixels is placed at `x = 0.5 * 1920 = 960px` and `y = 0.5 * 1080 = 540px`. For example, if the `width` and `height` of the `Tile` are set to `0.25`, this gives a `Tile` of `width = 0.25 * 1920 = 480px` and `height = 0.25 * 1080 = 270px`. | ||
|
||
The `group` attribute is mainly used in the layout editor where it determines which `Tile`(s) are "linked": if you resize a single `Tile` it's linked neighbour(s) are also updated. | ||
|
||
For more in depth information you can look at an [in depth explanation](https://github.com/domferr/tilingshell/issues/177#issuecomment-2458322208) of `group`(s). | ||
|
||
Example JSON of a `Tile` object would look like this | ||
|
||
```json | ||
{ | ||
"x": 0, | ||
"y": 0, | ||
"width": 1, | ||
"height": 1, | ||
"groups": [ | ||
1 | ||
] | ||
} | ||
``` | ||
|
||
## Example JSON file | ||
|
||
Finally, an example JSON file describing one Layout with two tiles. | ||
|
||
```json | ||
{ | ||
"id": "Equal split", | ||
"tiles": [ | ||
{ | ||
"x": 0, | ||
"y": 0, | ||
"width": 0.5, | ||
"height": 1, | ||
"groups": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"x": 0.5, | ||
"y": 0, | ||
"width": 0.5, | ||
"height": 1, | ||
"groups": [ | ||
1 | ||
] | ||
} | ||
] | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
`); | ||
} | ||
} |
Oops, something went wrong.