Skip to content

Commit fa36325

Browse files
committed
version 16.3: windows suggestions for snap assistant, multiple translations, improve border radius and width
1 parent 8a1f216 commit fa36325

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+5098
-1286
lines changed

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,72 @@ To uninstall, first disable the extension and then remove it. To disable via the
232232
## Contributing
233233

234234
Feel free to submit [issues](https://github.com/domferr/tilingshell/issues/new/choose) and [Pull Requests](https://github.com/domferr/tilingshell/pulls)!
235+
236+
### How to add new keybindings
237+
238+
1. Edit the file `resources/schemas/org.gnome.shell.extensions.tilingshell.gschema.xml` and add a new key with a name, default empty value and a summary. For example, add the following if the name is `highlight-current-window` and the summary is `Minimize all the other windows and show only the focused window`:
239+
```xml
240+
<key type="as" name="highlight-current-window">
241+
<default><![CDATA[['']]]></default>
242+
<summary>Minimize all the other windows and show only the focused window</summary>
243+
</key>
244+
```
245+
246+
2. Edit the file `src/settings/settings.ts` and add a static constant at the end of the list of the static constants (for example [here](https://github.com/domferr/tilingshell/blob/8a1f21620d5d8f1db7c5b6b45c0ef0c483801420/src/settings/settings.ts#L138)). The static constant must be a string equal to the key name. The constant name must start with `SETTING_` and must be the key name capitalized and using underscores. For example if the key name is `highlight-current-window`, add this to the file:
247+
```js
248+
static SETTING_HIGHLIGHT_CURRENT_WINDOW = 'highlight-current-window';
249+
```
250+
251+
3. Edit the file `src/keybindings.ts` by adding a new signal with a name equal to the key name. Be sure to put `Meta.Display.$gtype` followed by all the parameter types you need (if any). For example, if the key name is `highlight-current-window` and it doesn't need any parameter, add this:
252+
```js
253+
'highlight-current-window': {
254+
param_types: [Meta.Display.$gtype], // Meta.Display,
255+
},
256+
```
257+
258+
4. The idea is that, when the user presses the keybindings, the Keybinding singleton class will emit that signal. To achieve that, edit the file `src/keybindings.ts` by emitting the signal when the keybindings are used, for example [here](https://github.com/domferr/tilingshell/blob/8a1f21620d5d8f1db7c5b6b45c0ef0c483801420/src/keybindings.ts#L223). For example if the key name is `highlight-current-window`, add this:
259+
```js
260+
Main.wm.addKeybinding(
261+
Settings.SETTING_HIGHLIGHT_CURRENT_WINDOW,
262+
extensionSettings,
263+
Meta.KeyBindingFlags.NONE,
264+
Shell.ActionMode.NORMAL,
265+
(display: Meta.Display) => {
266+
this.emit('highlight-current-window', display);
267+
},
268+
);
269+
```
270+
You can put after `display` all the parameters you need (if any).
271+
272+
5. Ensure you disable the keybindings when the extension is disabled. To achieve that edit the file `src/keybindings.ts` to remove the keybindings, for example [here](https://github.com/domferr/tilingshell/blob/8a1f21620d5d8f1db7c5b6b45c0ef0c483801420/src/keybindings.ts#L318). For example, if the key name is `highlight-current-window` then add this:
273+
```js
274+
Main.wm.removeKeybinding(Settings.SETTING_HIGHLIGHT_CURRENT_WINDOW);
275+
```
276+
277+
6. You can now listen to the keybindings from everywhere by just connecting to the signal. A good place to do so is in the `src/extension.ts` file, for example [here](https://github.com/domferr/tilingshell/blob/8a1f21620d5d8f1db7c5b6b45c0ef0c483801420/src/extension.ts#L264). For example, if the key name is `highlight-current-window` then add this:
278+
```js
279+
this._signals.connect(
280+
this._keybindings,
281+
'highlight-current-window',
282+
(kb: KeyBindings, dp: Meta.Display) => {
283+
// handle the keybinding and perform the actions you want
284+
// to happen when the keybinding is used by the user
285+
...
286+
},
287+
);
288+
```
289+
290+
7. Edit the file `src/prefs.ts` to allow the user to choose its preferred keybindings. This can be easily done by adding a new entry in the `keybindings` array. For example by adding a new entry [here](https://github.com/domferr/tilingshell/blob/8a1f21620d5d8f1db7c5b6b45c0ef0c483801420/src/prefs.ts#L639). For example, if the key name is `highlight-current-window` then add this:
291+
```js
292+
[
293+
Settings.SETTING_HIGHLIGHT_CURRENT_WINDOW,
294+
_('Highlight focused window'),
295+
_('Minimize all the other windows and show only the focused window'),
296+
false,
297+
false,
298+
],
299+
```
300+
The first element is the settings key, the second element is the title and the third is the description. The fourth is a boolean used by the preferences to store if that setting is set or not. The last is a boolean that indicates whether or not this setting must be on the main page, otherwise it can be accessed by expanding the list of available keybindings. However, any keybinding set by the user is always put on the main page.
301+
_Please use the same description you wrote in the schema at step 1._
302+
303+
For any problem, doubts or if you are stuck, feel free to open a pull request with what you have already done. I'm more than happy to help!

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tilingshell",
3-
"version": "16.2",
3+
"version": "16.3",
44
"author": "Domenico Ferraro <[email protected]>",
55
"private": true,
66
"license": "GPL v2.0",
@@ -16,7 +16,7 @@
1616
"wayland-session": "dbus-run-session -- env MUTTER_DEBUG_NUM_DUMMY_MONITORS=1 MUTTER_DEBUG_DUMMY_MODE_SPECS=1920x1080 gnome-shell --nested --wayland",
1717
"dev:wayland": "npm run build && npm run install:extension && npm run wayland-session",
1818
"build:translations": "for file in $(ls translations/*.po); do mkdir -p resources/locale/$(basename $file .po)/LC_MESSAGES; msgfmt -c $file -o resources/locale/$(basename $file .po)/LC_MESSAGES/tilingshell.mo; done",
19-
"create:translations": "xgettext --from-code=UTF-8 --output=translations/[email protected] -j --language=javascript --force-po dist/prefs.js dist/extension.js",
19+
"create:translations": "rm -f translations/[email protected] && xgettext --from-code=UTF-8 --output=translations/[email protected] --language=javascript --force-po dist/prefs.js dist/extension.js",
2020
"merge:translations": "for file in $(ls translations/*.po); do msgmerge -U $file translations/[email protected] --backup=none; done",
2121
"lint": "eslint .",
2222
"lint:fix": "eslint . --fix",
12.9 KB
Binary file not shown.
-708 Bytes
Binary file not shown.
14 KB
Binary file not shown.
-57 Bytes
Binary file not shown.
12.6 KB
Binary file not shown.
13.1 KB
Binary file not shown.
17.7 KB
Binary file not shown.
-753 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)