|
| 1 | +# Development Notes |
| 2 | + |
| 3 | +## Applying changes without logout (GNOME 46 Wayland) |
| 4 | + |
| 5 | +On GNOME 46 Wayland, `gnome-extensions disable/enable` does **not** reload |
| 6 | +extension JS — GNOME Shell caches ESM modules for the lifetime of the process. |
| 7 | + |
| 8 | +**`prefs.js` changes** take effect immediately — the prefs dialog runs in a |
| 9 | +separate process and is freshly spawned each time. |
| 10 | + |
| 11 | +**All other JS changes** (`panel.js`, `appIcons.js`, `taskbar.js`, etc.) require |
| 12 | +a shell restart to clear the module cache. |
| 13 | + |
| 14 | +### Restarting the shell without logging out |
| 15 | + |
| 16 | +Use **Looking Glass** (`Alt+F2` → type `lg` → Enter), go to the **Console** tab, |
| 17 | +and run: |
| 18 | + |
| 19 | +```js |
| 20 | +Meta.restart("Restarting...", global.context) |
| 21 | +``` |
| 22 | + |
| 23 | +This restarts the GNOME Shell process in-place. Wayland clients (apps) survive and |
| 24 | +reconnect; the shell reloads all extension JS from disk. |
| 25 | + |
| 26 | +> Note: `Alt+F2 → r` (the classic X11 shortcut) is **disabled** on Wayland. |
| 27 | +> `Meta.restart()` with two arguments is required on GNOME 46+. |
| 28 | +
|
| 29 | +### Looking Glass inspector |
| 30 | + |
| 31 | +Looking Glass also has an **Inspector** (pick-icon in the toolbar): click it, then |
| 32 | +click any shell actor on screen to inspect its properties, style, children, and |
| 33 | +allocation in real time. Useful for diagnosing layout/centering issues without |
| 34 | +adding `log()` calls. |
| 35 | + |
| 36 | +## Clutter BoxLayout: x_expand vs x_align |
| 37 | + |
| 38 | +When a child of `St.BoxLayout` / `Clutter.BoxLayout` has `x_expand: true`, the |
| 39 | +layout gives it a larger **slot** (natural size + extra space). However, `x_align` |
| 40 | +controls how the child uses that slot: |
| 41 | + |
| 42 | +- `x_align = START` / `CENTER` / `END`: actor uses only its **natural width** within |
| 43 | + the slot, positioned accordingly. Extra space is wasted. ClutterText inside will |
| 44 | + ellipsize at its natural width even though the slot is bigger. |
| 45 | +- `x_align = FILL`: actor **fills the entire slot**. ClutterText gets the full width |
| 46 | + and only ellipsizes when text genuinely doesn't fit. |
| 47 | + |
| 48 | +So for a label that should fill available horizontal space, always pair |
| 49 | +`x_expand: true` with `x_align: Clutter.ActorAlign.FILL`. The text inside will |
| 50 | +still render left-to-right (left-aligned) naturally. |
| 51 | + |
| 52 | +### Evaluating JS against live shell objects |
| 53 | + |
| 54 | +```js |
| 55 | +// Get the DTP panel actor |
| 56 | +Main.layoutManager.panelBox |
| 57 | +// Inspect an actor's allocation |
| 58 | +let a = Main.panel._leftBox; a.get_allocation_box() |
| 59 | +``` |
0 commit comments