zed icon indicating copy to clipboard operation
zed copied to clipboard

Zed does not follow the system theme

Open georgetzlp opened this issue 11 months ago • 12 comments

Description

Using the following configs, zed does not follow the preferred dark theme, instead using the light mode theme.

➜  ~ cat .config/zed/settings.json
{
  "ui_font_size": 16,
  "buffer_font_size": 16,
  "theme": {
    "mode": "dark",
    "light": "One Light",
    "dark": "One Dark"
  }
}

➜  ~ gsettings get org.gnome.desktop.interface gtk-theme
'adw-gtk3-dark'

➜  ~ gsettings get org.gnome.desktop.interface color-scheme
'prefer-dark'

➜  ~ echo $QT_QPA_PLATFORMTHEME
qt6ct

➜  ~ cat .config/qt6ct/qt6ct.conf
[Appearance]
color_scheme_path=/usr/share/qt6ct/colors/airy.conf
custom_palette=false
standard_dialogs=default
style=Adwaita-Dark

...

Zed Version and System Specs

Zed: v0.166.2 (Zed) OS: Linux Wayland arch unknown WM: Hyprland Memory: 15.5 GiB Architecture: x86_64 GPU: AMD Radeon RX 580 Series (RADV POLARIS10) || radv || Mesa 24.3.2-arch1.1

georgetzlp avatar Dec 28 '24 21:12 georgetzlp

@wathhr

I tried reproducing this error, but failed to do so.
Zed followed the preferred dark theme on my Linux machine. Can you please try testing on X11, instead of Wayland?

CoderParth avatar Dec 29 '24 01:12 CoderParth

@wathhr Also, can you please check if any .panic files have been created on your ~/.local/share/zed/logs directory? Or just checking if there are some error messages in ~/.local/share/zed/logs/Zed.log file, might come out to be helpful.

CoderParth avatar Dec 29 '24 01:12 CoderParth

Can you please try testing on X11, instead of Wayland?

Running zed under xwayland with WAYLAND_DISPLAY='' zeditor also uses light theme

Also, can you please check if any .panic files have been created on your ~/.local/share/zed/logs directory? Or just checking if there are some error messages in ~/.local/share/zed/logs/Zed.log file, might come out to be helpful.

There are no .panic files in ~/.local/share/zed/logs, and Zed.log has the following content:

zed.log
2024-12-29T12:28:57.393480154+02:00 [INFO] ========== starting zed ==========
2024-12-29T12:28:57.414212991+02:00 [WARN] failed to load font 'SymbolsNFM'
2024-12-29T12:28:57.416094604+02:00 [WARN] failed to load font 'SymbolsNFM'
2024-12-29T12:28:57.417048025+02:00 [INFO] perform;
2024-12-29T12:28:57.417132825+02:00 [INFO] authenticate;
2024-12-29T12:28:57.417234648+02:00 [INFO] read_command;
2024-12-29T12:28:57.417315761+02:00 [INFO] Opening main db
2024-12-29T12:28:57.417396423+02:00 [INFO] send_secondary_commands;
2024-12-29T12:28:57.417727619+02:00 [INFO] new;
2024-12-29T12:28:57.417809373+02:00 [INFO] socket reader;
2024-12-29T12:28:57.418325959+02:00 [INFO] Opening main db
2024-12-29T12:28:57.419853484+02:00 [INFO] Using git binary path: None
2024-12-29T12:28:57.456927243+02:00 [INFO] No prompt template overrides directory found at /home/wathhr/.local/share/zed/prompt_overrides. Using built-in prompts.
2024-12-29T12:28:57.457340604+02:00 [INFO] extensions updated. loading 1, reloading 0, unloading 0
2024-12-29T12:28:57.459139782+02:00 [INFO] activate is not implemented on Linux, ignoring the call
2024-12-29T12:28:57.460223719+02:00 [INFO] Opening main db
2024-12-29T12:28:57.460547811+02:00 [INFO] perform;
2024-12-29T12:28:57.460631599+02:00 [INFO] authenticate;
2024-12-29T12:28:57.460741828+02:00 [INFO] read_command;
2024-12-29T12:28:57.461115022+02:00 [INFO] socket reader;
2024-12-29T12:28:57.463637557+02:00 [ERROR] DBus error service error org.freedesktop.zbus.Error: The name is not activatable
2024-12-29T12:28:57.484958915+02:00 [INFO] Enabling Vulkan Portability
2024-12-29T12:28:57.48505149+02:00 [INFO] Enabling color space support
2024-12-29T12:28:57.48866776+02:00 [INFO] Adapter: "AMD Radeon RX 580 Series (RADV POLARIS10)"
2024-12-29T12:28:57.489090709+02:00 [INFO] No ray tracing extensions are supported
2024-12-29T12:28:57.496984407+02:00 [INFO] Using surface present mode MAILBOX
2024-12-29T12:28:57.497280376+02:00 [WARN] Unable to forbid exclusive full screen
2024-12-29T12:28:57.497907791+02:00 [INFO] Creating a descriptor pool for at most 16 sets
2024-12-29T12:28:57.498015324+02:00 [INFO] Creating a descriptor pool for at most 16 sets
2024-12-29T12:28:57.498120824+02:00 [INFO] Initializing Blade pipelines for surface SurfaceInfo { format: Bgra8UnormSrgb, alpha: PreMultiplied }
2024-12-29T12:28:57.502529009+02:00 [INFO] set environment variables from shell:/usr/bin/zsh, path:/home/wathhr/.bun/bin:/home/wathhr/go/bin:/home/wathhr/.bun/bin:/home/wathhr/go/bin:/home/wathhr/.bun/bin:/home/wathhr/go/bin:/home/wathhr/.deno/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/rocm/bin:/usr/lib/rustup/bin
2024-12-29T12:28:57.504959209+02:00 [INFO] Using GPU: GPUSpecs { is_software_emulated: false, device_name: "AMD Radeon RX 580 Series (RADV POLARIS10)", driver_name: "radv", driver_info: "Mesa 24.3.2-arch1.1" }
2024-12-29T12:28:57.506559131+02:00 [INFO] Using surface present mode MAILBOX
2024-12-29T12:28:57.506995695+02:00 [WARN] Unable to forbid exclusive full screen
2024-12-29T12:28:57.507588845+02:00 [INFO] Initializing Blade pipelines for surface SurfaceInfo { format: Bgra8UnormSrgb, alpha: Ignored }
2024-12-29T12:28:57.514047363+02:00 [INFO] Using surface present mode MAILBOX
2024-12-29T12:28:57.514406832+02:00 [WARN] Unable to forbid exclusive full screen
2024-12-29T12:28:57.518456661+02:00 [ERROR] buffer has no file
2024-12-29T12:28:57.518629858+02:00 [INFO] Opening main db
2024-12-29T12:28:57.526558693+02:00 [INFO] Using surface present mode MAILBOX
2024-12-29T12:28:57.526875411+02:00 [WARN] Unable to forbid exclusive full screen
2024-12-29T12:28:57.527601693+02:00 [INFO] Opening main db
2024-12-29T12:28:57.61980372+02:00 [ERROR] missing field `name` at line 9 column 1
2024-12-29T12:28:57.696739034+02:00 [INFO] starting language server process. binary path: "/usr/bin/node", working directory: "/", args: ["/home/wathhr/.local/share/zed/copilot/copilot-v0.7.0/dist/language-server.js", "--stdio"]
2024-12-29T12:28:58.435951351+02:00 [INFO] Language server with id 0 sent unhandled notification window/logMessage:
{
  "type": 3,
  "message": "[lsp] GitHub Copilot Language Server 1.236.0 initialized"
}
2024-12-29T12:28:58.436073642+02:00 [INFO] Language server with id 0 sent unhandled notification workspace/configuration:
{
  "items": [
    {
      "section": "github.copilot"
    },
    {
      "section": "github-enterprise"
    },
    {
      "section": "http"
    },
    {
      "section": "telemetry"
    }
  ]
}

The only thing that seems off-place to me is missing field `name` at line 9 column 1

georgetzlp avatar Dec 29 '24 10:12 georgetzlp

One Light is what Zed falls back to if it fails to load your config, the config snippet seems fine though. Do you have a buggy custom theme in ~/.config/zed/themes/?

jansol avatar Jan 01 '25 14:01 jansol

I have not messed with custom themes at all, my ~/.config/zed/themes/ directory is empty.

In my case One Light is not being used as a fallback, considering if I use the following settings.json I do get the One Dark theme applied:

{
  "ui_font_size": 16,
  "buffer_font_size": 16,
  "theme": {
    "mode": "system",
    "light": "One Dark",
    "dark": "One Dark"
  }
}

georgetzlp avatar Jan 01 '25 14:01 georgetzlp

The gsettings system color scheme should be respected AFAIK (on an ootb Ubuntu install with GNOME Zed does follow light/dark mode, and even switches automatically). So it would seem something is going wrong with that here.

jansol avatar Jan 01 '25 15:01 jansol

That is very odd then, could this be a hyprland issue then? If you need any more info so I can send it over.

georgetzlp avatar Jan 01 '25 15:01 georgetzlp

Ah, XDG Desktop Portal has an API for this. Do you have the gtk/gnome portal installed?

jansol avatar Jan 01 '25 15:01 jansol

Ah, XDG Desktop Portal has an API for this. Do you have the gtk/gnome portal installed?

Yes I do:

➜  ~ paru -Qs xdg-desktop-portal
local/xdg-desktop-portal 1.18.4-2
    Desktop integration portals for sandboxed apps
local/xdg-desktop-portal-gtk 1.15.1-2
    A backend implementation for xdg-desktop-portal using GTK
local/xdg-desktop-portal-hyprland 1.3.9-3
    xdg-desktop-portal backend for hyprland

➜  ~ systemctl --user status xdg-desktop-portal.service
● xdg-desktop-portal.service - Portal service
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal.service; static)
     Active: active (running) since Wed 2025-01-01 11:36:57 EET; 5h 52min ago
 Invocation: 67260fe58bd948b286cb0d4c01f55f87
   Main PID: 1191 (xdg-desktop-por)
      Tasks: 5 (limit: 18939)
     Memory: 4.7M (peak: 20M)
        CPU: 583ms
     CGroup: /user.slice/user-1000.slice/[email protected]/session.slice/xdg-desktop-portal.service
             └─1191 /usr/lib/xdg-desktop-portal

# Logs omitted, but nothing about the system theme is mentioned

➜  ~ systemctl --user status xdg-desktop-portal-gtk.service
● xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME implementation)
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-gtk.service; static)
     Active: active (running) since Wed 2025-01-01 11:36:57 EET; 5h 52min ago
 Invocation: 7b4654e9ebba4ce397c45051cbb17a7a
   Main PID: 1230 (xdg-desktop-por)
      Tasks: 5 (limit: 18939)
     Memory: 8.7M (peak: 10.7M)
        CPU: 136ms
     CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/xdg-desktop-portal-gtk.service
             └─1230 /usr/lib/xdg-desktop-portal-gtk

# Logs omitted, but nothing about the system theme is mentioned

georgetzlp avatar Jan 01 '25 15:01 georgetzlp

Have the same issue. Not a big deal though.

2025-03-01T15:48:00.72526233+02:00 [ERROR] data did not match any variant of untagged enum ThemeSelection

Hyprland (wayland) 0.47.2 NixOs https://github.com/NixOS/nixpkgs/tree/6313551cd05425cd5b3e63fe47dbc324eabb15e4

woojiq avatar Mar 01 '25 13:03 woojiq

@woojiq Your error means something different:

2025-03-01T15:48:00.72526233+02:00 [ERROR] data did not match any variant of untagged enum ThemeSelection

It means your theme object in settings is incorrect -- theme can either be a string with the name of the theme or an object of the form:

  "theme": {
    "mode": "light",
    "dark": "Modus Vivendi Tinted",
    "light": "Modus Operandi Tinted"
  },

notpeter avatar Apr 23 '25 17:04 notpeter

For what it's worth, I'm having the same issue on Linux with Wayland and Sway. I also have xdg-desktop-portal installed and running.

mwillfox avatar May 08 '25 16:05 mwillfox

Running into this on X11 with i3 and gsd-xsettings daemon active. Firefox, Chrome, Electron apps, etc. receive updates and change themes when org.gnome.desktop.interface color-scheme value changes between prefer-dark and prefer-light. Zed does not seem to receive these events.

As a work-around, I have a process running to listen to gsettings events and use sed to swap .theme.mode between light and dark.

jwilm avatar Aug 22 '25 17:08 jwilm

Hi there! 👋 We're working to clean up our issue tracker by closing older bugs that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and it will be kept open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, it will close automatically in 14 days. Thanks for your help!

github-actions[bot] avatar Nov 19 '25 09:11 github-actions[bot]

The issue seems to be fixed using [email protected], [email protected] and [email protected]!

georgetzlp avatar Nov 22 '25 08:11 georgetzlp