Skip to content

Commit

Permalink
Add gaps option (#146)
Browse files Browse the repository at this point in the history
* added config.rows with default of 2
* simplified showPreview
* added gaps around tiles (#133)

default gap is zero, but can can be increased to 50 in 2px increments


* fixes requested by gnome

Changed version checking to be float instead of int so we can deprecate < 3.36 later
Added settings-schema to metadata.json so ExtensionUtils.getSettings can find it
Removed disable function from prefs.js
Made extension.js definitions consistent with prefs.js

resolves #137

* cleaner resize-checker (#141)

Instead of doing silly pixel math with the pointer, check to see
if the metaGrabOp is any of the Meta.GrabOp resize constants.

* Update README.md

Fixed manual instalation instructions

* Fixed column math for previews

* inverted windowMoving guard clause

reduced indent level

* renamed loop variable

* Update prefs.js

removed a single newline that was causing github to go crazy and double create init in prefs.js

* mention gaps in metadata.json

* update gitignore

* standardized _log

each log line will now start with the name of the function followed by a ")"
This will make it easier to grep for relevant logs

* Update README.md

Gave instructions on getting wintile logs

* update README.md
  • Loading branch information
GrylledCheez authored Jun 26, 2023
1 parent e702d83 commit 3e43c62
Show file tree
Hide file tree
Showing 7 changed files with 481 additions and 415 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
wintile@nowsci.com.zip
node_modules/
package-lock.json
package.json
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WinTile also supports:
- Mouse preview and snapping for placing tiles
- "Maximize" mode, which adds/removes GNOME animations
- Ultrawide-only mode limits 16:9 screens to a 2x2 grid
- Adding gaps around tiles

<img src='demo.gif'>

Expand Down Expand Up @@ -61,10 +62,18 @@ https://extensions.gnome.org/extension/1723/wintile-windows-10-window-tiling-for
1. unzip the file
1. cd into the directory it creates
1. run `./build.sh`
1. run `unzip wintile@nowsci.com.zip`
1. run `unzip -d wintile@nowsci.com wintile@nowsci.com.zip`
1. run `cp -r wintile@nowsci.com ~/.local/share/gnome-shell/extensions/`
1. restart your session

Wayland users need to reboot to enable the extension.

Gnome users can press `<Alt>`+`<F2>` and run `r` from the prompt. **(IT WILL NOT WORK from a terminal)**

### Debugging
If you're having issues, please attach some debug logs to your issue.
Note: debugging must be enabled in WinTile settings

```bash
journalctl -qf | grep -i -e wintile -e 'js error'
```
806 changes: 410 additions & 396 deletions extension.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "WinTile: Windows 10 window tiling for GNOME",
"description": "WinTile is a hotkey driven window tiling system for GNOME that imitates the standard Win-Arrow keys of Windows 10, allowing you to maximize, maximize to sides, or 1/4 sized to corner across a single or multiple monitors using just Super+Arrow.\n\nAs of v10, WinTile also supports:\n- 2, 3, or 4 columns for standard or ultrawide monitors\n- Top/bottom half support\n- Mouse preview and snapping for placing windows\n- 'Maximize' mode, which adds/removes GNOME animations\n- 'Ultrawide-only' mode, to limit standard screens to 2x2 while allowing ultrawides to still have 3 or 4 columns.",
"description": "WinTile is a hotkey driven window tiling system for GNOME that imitates the standard Win-Arrow keys of Windows 10, allowing you to maximize, maximize to sides, or 1/4 sized to corner across a single or multiple monitors using just Super+Arrow.\n\nAs of v10, WinTile also supports:\n- 2, 3, or 4 columns for standard or ultrawide monitors\n- Top/bottom half support\n- Mouse preview and snapping for placing windows\n- 'Maximize' mode, which adds/removes GNOME animations\n- 'Ultrawide-only' mode, to limit standard screens to 2x2 while allowing ultrawides to still have 3 or 4 columns.\n- Add gaps around tiles to avoid the 'crowded elevator' feeling'.",
"uuid": "wintile@nowsci.com",
"url": "https://github.com/fmstrat/wintile",
"settings-schema":"org.gnome.shell.extensions.wintile",
Expand All @@ -13,5 +13,5 @@
"43",
"44"
],
"version": 11.2
"version": 12
}
68 changes: 52 additions & 16 deletions prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,36 @@ function buildPrefsWidget() {
layout.attach(previewDelayLabel, 0, row, 1, 1);
layout.attach(previewDelayInput, 1, row++, 1, 1);

// Gap setting
let gapLabel = new Gtk.Label({
label: _('Gap width around tiles'),
visible: true,
hexpand: true,
halign: Gtk.Align.START,
});
let gapInput = new Gtk.Box({
orientation: Gtk.Orientation.HORIZONTAL,
visible: true,
});
let gapAdjustment = new Gtk.Adjustment({
lower: 0,
upper: 50,
step_increment: 2,
});
let gapSettingInt = new Gtk.SpinButton({
adjustment: gapAdjustment,
snap_to_ticks: true,
visible: true,
});
gapSettingInt.set_value(gsettings.get_int('gap'));
if (SHELL_VERSION >= 40)
gapInput.append(gapSettingInt);
else
gapInput.add(gapSettingInt);

layout.attach(gapLabel, 0, row, 1, 1);
layout.attach(gapInput, 1, row++, 1, 1);

// Debug setting
let debugLabel = new Gtk.Label({
label: _('Turn on debugging'),
Expand All @@ -230,23 +260,29 @@ function buildPrefsWidget() {
layout.attach(debugLabel, 0, row, 1, 1);
layout.attach(debugInput, 1, row++, 1, 1);

gsettings.bind('cols', colsInput, 'active', Gio.SettingsBindFlags.DEFAULT);
gsettings.bind('ultrawide-only', ultrawideOnlyInput, 'active', Gio.SettingsBindFlags.DEFAULT);
gsettings.bind('use-maximize', maximizeInput, 'active', Gio.SettingsBindFlags.DEFAULT);
gsettings.bind('use-minimize', minimizeInput, 'active', Gio.SettingsBindFlags.DEFAULT);
gsettings.bind('preview', previewInput, 'active', Gio.SettingsBindFlags.DEFAULT);
gsettings.bind('double-width', doubleWidthInput, 'active', Gio.SettingsBindFlags.DEFAULT);
colsSettingInt.connect('value-changed', function (entry) {
gsettings.set_int('cols', entry.value);
});
previewDistanceSettingInt.connect('value-changed', function (entry) {
gsettings.set_int('distance', entry.value);
});
previewDelaySettingInt.connect('value-changed', function (entry) {
gsettings.set_int('delay', entry.value);
});
gsettings.bind('debug', debugInput, 'active', Gio.SettingsBindFlags.DEFAULT);
const bindSettings = (key, input) => {
gsettings.bind(key, input, 'active', Gio.SettingsBindFlags.DEFAULT);
};

const connectAndSetInt = (setting, key) => {
setting.connect('value-changed', entry => {
gsettings.set_int(key, entry.value);
});
};

// settings that aren't toggles need a connect
connectAndSetInt(colsSettingInt, 'cols');
connectAndSetInt(previewDistanceSettingInt, 'distance');
connectAndSetInt(previewDelaySettingInt, 'delay');
connectAndSetInt(gapSettingInt, 'gap');

// all other settings need a bind
bindSettings('ultrawide-only', ultrawideOnlyInput);
bindSettings('use-maximize', maximizeInput);
bindSettings('use-minimize', minimizeInput);
bindSettings('preview', previewInput);
bindSettings('double-width', doubleWidthInput);
bindSettings('debug', debugInput);

// Return our widget which will be added to the window
return layout;
Expand Down
Binary file modified schemas/gschemas.compiled
Binary file not shown.
6 changes: 6 additions & 0 deletions schemas/org.gnome.shell.extensions.wintile.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
<description></description>
<range min="25" max="1000"/>
</key>
<key name="gap" type="i">
<default>0</default>
<summary>Gap width around tiles</summary>
<description></description>
<range min="0" max="50"/>
</key>
<key name="debug" type="b">
<default>false</default>
<summary>Turn on/off debug output</summary>
Expand Down

0 comments on commit 3e43c62

Please sign in to comment.