Skip to content

Conversation

@bdsqqq
Copy link

@bdsqqq bdsqqq commented Dec 5, 2025

Toggle Theme

Toggle system color scheme between light and dark mode via GNOME's gsettings.

How it works

This extension toggles org.gnome.desktop.interface color-scheme between prefer-dark and prefer-light.

By default, it calls gsettings directly. This works on most GNOME-based desktops where DBUS_SESSION_BUS_ADDRESS is properly set.

Environment override

For setups where the default doesn't work (e.g., Hyprland on NixOS), set:

VICINAE_TOGGLE_THEME_CMD=/path/to/your/toggle-script

Requirements

  • gsettings command available
  • org.gnome.desktop.interface schema installed (comes with GNOME or gtk3)
  • A portal that reads color-scheme preference (e.g., xdg-desktop-portal-gtk)

bdsqqq added a commit to bdsqqq/dots that referenced this pull request Dec 5, 2025
- add toggle-theme extension for vicinae (toggles gsettings color-scheme)
- extension is self-contained with env var override for nix integration
- script in user/scripts/, symlinked to user/vicinae/toggle-theme/
- submitted to vicinae store: vicinaehq/extensions#74

Amp-Thread-ID: https://ampcode.com/threads/T-37b3eb9e-917f-4d3f-a741-f0ed8e139975
@@ -0,0 +1,32 @@
{
"$schema": "https://raw.githubusercontent.com/vicinaehq/vicinae/refs/heads/main/extra/schemas/extension.json",
"name": "toggle-theme",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should have a more specific name, like 'toggle-system-theme' because this can be confused with the native vicinae set theme command


export default async function ToggleTheme() {
try {
const overrideCmd = process.env.VICINAE_TOGGLE_THEME_CMD;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requiring that the user sets an environment variable is very impractical. You should either use a preference for that, or prompt the user to set their custom command using a Form component if gsettings is not available. I very much prefer the latter.

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.

2 participants