GridSpaces: per-workspace n×m tiling for GNOME Shell 48

Mark a workspace as a grid; windows auto-fill cells, Alt+drag dividers to
resize rows/columns, drag-to-swap, overflow pops to a normal workspace.
Normal workspaces untouched. Tiling Assistant coexistence.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
h z
2026-05-19 12:47:23 +01:00
commit 57df2bcfbd
5 changed files with 1107 additions and 0 deletions

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 hzhang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

57
README.md Normal file
View File

@@ -0,0 +1,57 @@
# GridSpaces
A GNOME Shell extension that turns a chosen workspace into a flexible tiling
grid. Normal workspaces are left completely untouched.
> **Status: experimental / alpha.** GNOME Shell 48, Wayland & X11.
> Developed and tested inside a throwaway VM — a buggy shell extension can
> crash your session on Wayland. Try it the same way (see *Safety* below).
## What it does
- Mark any workspace as a **grid workspace** from the panel button (⊞).
- A grid workspace is a stack of **rows**; each row has its own column count.
Every cell holds at most one window, which is resized to fill the cell.
- Any window entering a grid workspace auto-fills the first free cell.
When the grid is full, the window bounces back to where it came from.
- **Drag a window onto another cell to swap** the two windows.
- **Alt+drag the divider lines** to resize adjacent rows / columns. Sizes are
percentages of the work area and always sum to 100; a preview line follows
the pointer and the change is applied on release.
- Removing a row / shrinking the grid pops the overflow windows to the
nearest normal workspace.
- Coexists with Ubuntu's **Tiling Assistant**: its drop popup is suppressed
only while a grid workspace is active, and restored otherwise.
## Install
```sh
git clone https://git.hangman-lab.top/hzhang/GridSpaces.git \
~/.local/share/gnome-shell/extensions/gridspaces@hzhang.local
```
Then log out and back in (Wayland cannot hot-load a new extension), and:
```sh
gnome-extensions enable gridspaces@hzhang.local
```
## Usage
1. Switch to the workspace you want to tile.
2. Click the ⊞ panel button → toggle **Grid workspace** on.
3. Use **Add row** and the per-row column steppers to shape the layout.
4. **Alt+drag** the divider lines to adjust row heights / column widths.
5. Open or drag windows in; drag a window onto another cell to swap.
## Safety
This is an in-development GNOME Shell extension. On a Wayland session an
unhandled error in a shell extension can crash the whole session. **Do not
add it to your autostart while iterating.** Test in a VM with a clean
snapshot, or at minimum enable it manually (never via the autostart list) so
a crash recovers to a clean desktop instead of a login loop.
## License
MIT

1006
extension.js Normal file

File diff suppressed because it is too large Load Diff

7
metadata.json Normal file
View File

@@ -0,0 +1,7 @@
{
"uuid": "gridspaces@hzhang.local",
"name": "GridSpaces",
"description": "Mark a workspace as an n×m tiling grid. Windows entering it auto-fill the first free cell and fully occupy it; drag a window onto another cell to swap. Normal workspaces are untouched. Overflow windows pop to the nearest normal workspace.",
"shell-version": ["48"],
"version": 1
}

16
stylesheet.css Normal file
View File

@@ -0,0 +1,16 @@
.gridspaces-divider-h,
.gridspaces-divider-v {
background-color: rgba(255, 255, 255, 0.10);
border-radius: 3px;
transition-duration: 120ms;
}
.gridspaces-divider-h:hover,
.gridspaces-divider-v:hover {
background-color: rgba(120, 170, 255, 0.55);
}
.gridspaces-preview {
background-color: rgba(120, 170, 255, 0.85);
border-radius: 3px;
}