Files
coredesktop-extension/README.md
T
2026-11-27 12:28:07 -07:00

123 lines
5.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CoreDesktop GNOME extension
A top bar menu for CoreDesktop's own commands, so you don't need a terminal to
know whether you're up to date or to start an update.
## What's in the menu
| Item | Runs | What you see |
| --- | --- | --- |
| Header | `git log` on `~/.local/share/coredesktop` | Your version, e.g. `2026.11.25 (4fb3539)`, and one status line: *Up to date*, *2026.11.27 (f798974) is available*, *Updating…*, *Restart to finish the last update* |
| Restart to finish updating | `gnome-session-quit --reboot` | Shown only while `~/.local/state/coredesktop/reboot-needed` exists |
| Update | `update` in a terminal | **New version** pill when `version --check` finds one; **Running…** while it runs |
| Refresh | `refresh` in a terminal | First, a dialog explaining what refresh does (this can be turned off) |
| Check for updates | `version --check` | Leaves the menu open; shows when it last checked and when you last updated |
| Configure | `configure --list` | **N to do** pill. Opens a dialog listing every item with **Done** or **To do**, its description from `configure.d`, and a **Set up** or **Change** button that runs `configure <item>` |
| Version | `version` | A dialog with the full report: newer versions highlighted, plus **Copy** and **Update now** buttons |
| Network audit | `audit` in a terminal | |
| Report a problem | `report` in a terminal | |
| Latest update log | | Opens the newest log in `~/.local/state/coredesktop/logs` |
The top bar icon gets a **blue dot** when an update is available and an
**orange dot** when a restart is needed. It **pulses** while update or refresh runs.
When a command started from the menu finishes, a notification says how it went:
- **Finished**, with **Restart now** if the update needs a restart.
- **Ran into problems**, with **Open log** and **Report problem**.
- **Was stopped**, if its window was closed early.
## How it works
Commands that need a password or ask questions run in a terminal, the same way
CoreDesktop's own `system/run-in-terminal` does. The terminal runs as its own
`systemd-run --user` unit, so it survives a GNOME Shell restart. The terminal
choice is automatic by default (xdg-terminal-exec, kgx, ghostty, kitty, …), and
you can pick one in the settings.
Each terminal runs the command through `bin/run-tracked`, which writes
`$XDG_RUNTIME_DIR/coredesktop-extension/<name>.status`: first `running <pid>`,
then `exit <status>` when it ends. Closing the window records 129. The extension
watches that folder, which is how it knows to show **Running…** and when to notify.
The extension never runs `update` or `refresh` itself: they always run in a
terminal, where you can see what they do.
## Install
CoreDesktop installs it for you, the same way it installs Federated Calendar.
It's the `gnome-shell-extension-coredesktop` package in the `[federated]`
pacman repo, listed in CoreDesktop's `packages.conf`, so every `update` upgrades
it. CoreDesktop turns it on for each user (`gnome/gnome-extensions.sh` and a
migration). The package installs it to `/usr/share/gnome-shell/extensions`.
Updated code loads at your next login.
Users get a change only after it's released. To release, push to `main`, then:
```sh
GITEA_TOKEN=... make release
```
This builds the package from `main` on Gitea, not from your checkout. It tells
you if your checkout has uncommitted changes or differs from `origin/main`.
Then it uploads the package to the `[federated]` repo.
`GITEA_TOKEN` is a Gitea access token with "package: Read and write" scope
(Settings > Applications), for an account that can publish
Federated_Computer's packages.
The version is `version-name` from `metadata.json`, plus the commit count and
hash, so each commit on `main` can be released once. Releasing the same commit
again stops with "already has this version".
To try local changes before releasing them:
```sh
make install # packs, installs and enables it for your user
# then log out and back in: on Wayland, GNOME Shell finds new extensions only at login
```
This copy in `~/.local/share/gnome-shell/extensions` loads in place of the
package's. Remove it when you're done
(`gnome-extensions uninstall coredesktop@federated.computer`), or the package's
updates won't load.
Running `gnome-extensions enable` before logging out fails with "does not
exist": the running shell hasn't found the extension yet. `make enable` handles
that by adding the extension to the `enabled-extensions` list directly.
Settings: the menu's **Extension settings** item, or
`gnome-extensions prefs coredesktop@federated.computer`. You can change:
- how often to check for updates (0 turns checking off),
- whether to show the dot,
- which terminal to use,
- whether to notify when a command finishes,
- whether to explain refresh before running it.
## Develop
```sh
make lint # syntax-checks the JS, the wrapper script and the schema
make pack # builds coredesktop@federated.computer.shell-extension.zip
```
Supports GNOME Shell 48–51.
Layout:
- `extension.js`: the indicator and menu.
- `lib/cli.js`: runs the CLI and parses its output.
- `lib/dialogs.js`: the version, configure and refresh dialogs.
- `prefs.js`: the settings window.
- `bin/run-tracked`: the terminal wrapper.
To try it without touching your session, run a headless shell with everything
isolated, including the session bus's environment:
```sh
env HOME=$TMP/home XDG_CONFIG_HOME=$TMP/home/.config XDG_DATA_HOME=$TMP/home/.local/share \
XDG_RUNTIME_DIR=$TMP/runtime dbus-run-session -- gnome-shell --headless --virtual-monitor 1280x800
```
Set those variables on `dbus-run-session` itself, not inside the session. The
bus starts `dconf-service` with its own environment, so otherwise settings
writes land in your real `~/.config/dconf/user`.