Skip to content

Apply a profile when active-profile is written externally - #3

Merged
joaoferrete merged 2 commits into
mainfrom
jf-add-profiling
Aug 11, 2026
Merged

Apply a profile when active-profile is written externally#3
joaoferrete merged 2 commits into
mainfrom
jf-add-profiling

Conversation

@joaoferrete

Copy link
Copy Markdown
Owner

What

Wires changed::active-profile in enable() so that writing the key from outside
the extension applies that profile, and documents the capability in the README.

Why

The key already existed, but only the preferences process listened to it — and only
to refresh its own UI. An external program could set active-profile and nothing
happened on screen
, which made the key look like an entry point without being one.

The other appearance keys (thickness-*, opacity, color, temperature,
multi-monitor, maximize-brightness) are already picked up by the existing
changed handler over SYNC_KEYS. active-profile was the gap.

This closes it, so another program can drive the borders by naming a profile instead
of reimplementing the nine appearance keys. The calibration stays in Lighter, where
it belongs — the caller says which, the extension says how.

No feedback loop

applyProfile writes active-profile back with the same value, and GSettings does
not emit changed when the value is unchanged. The handler is disconnected in
disable() alongside the existing ones.

Docs

New README section, written from commands run against a live install:

  • --schemadir is required — an extension's schema is not in the default search
    path, and omitting it fails with "No such schema".
  • Profile ids are UUIDs generated at creation time, so the section shows how to look
    one up by name and explicitly says not to hardcode it.
  • The profiles key holds a JSON document wrapped in a GVariant string, which is why
    the example pipes through sed before jq.

It also warns about the two things that cost real debugging time: Auto-switch
profiles
competing with an external controller over the same state, and Wayland
needing a logout/login for code changes (settings changes apply immediately).

Testing

make lint passes. The runtime behaviour is not yet verified on a live session:
on Wayland the GNOME Shell cannot reload an extension, so this only takes effect
after logout/login. What is verified is that the settings path works — reading and
writing the keys with gsettings, and resolving a profile id by name, were both run
successfully against the installed copy.

🤖 Generated with Claude Code

joaoferrete and others added 2 commits August 10, 2026 18:24
Only the preferences process listened to this key, and only to refresh its
own UI — so another program could set it and nothing happened on screen.

Wiring it in `enable()` turns the key into a real entry point: writing it
with gsettings applies the profile, which lets an external program drive
the borders without knowing the nine appearance keys or duplicating the
per-camera calibration. The calibration stays here, where it belongs.

No feedback loop: `applyProfile` writes the key back with the same value,
and GSettings does not emit `changed` when the value is unchanged. The
handler is disconnected in `disable()` alongside the existing ones.

Note: on Wayland the GNOME Shell cannot reload an extension, so this only
takes effect after logout/login.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The `active-profile` change turns gsettings into a real entry point, but a
capability nobody can find is not a capability. Adds a README section with
commands that were run on a live install, not written from memory:

- `--schemadir` is required, because an extension's schema is not in the
  default search path. Omitting it fails with "No such schema".
- Profile ids are UUIDs generated at creation, so the section shows how to
  look one up by name and says not to hardcode it.
- The `profiles` key holds a JSON document wrapped in a GVariant string,
  which is why the example pipes through sed before jq.

Also warns about the two things that cost real debugging time: auto-switch
competing with an external controller for the same state, and Wayland
needing a logout for code changes (settings changes apply immediately).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@joaoferrete joaoferrete self-assigned this Aug 11, 2026
@joaoferrete
joaoferrete merged commit 1bcb84e into main Aug 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant