Open jgcodes2020 opened 2 years ago
It sounds like things are actually working correctly: setting the XCURSOR_THEME
does work and respects what you've configured.
The heart of the issue is that wayland doesn't have a way to advise clients of the configured theme, so there's no way for wezterm to know which theme should be used without using some kind of desktop-environment specific mechanism to do so.
For now, I've created a workaround using gsettings on GNOME:
#!/usr/bin/sh
export XCURSOR_SIZE="$(gsettings get org.gnome.desktop.interface cursor-size)"
export XCURSOR_THEME="$(gsettings get org.gnome.desktop.interface cursor-theme | sed -E "s/(^'|'\$)//g")"
exec /usr/bin/wezterm $@
With the commit that I just pushed, you can move your workaround into your lua config:
local wezterm = require 'wezterm'
local xcursor_size = nil
local xcursor_theme = nil
local success, stdout, stderr = wezterm.run_child_process({"gsettings", "get", "org.gnome.desktop.interface", "cursor-theme"})
if success then
xcursor_theme = stdout:gsub("'(.+)'\n", "%1")
end
local success, stdout, stderr = wezterm.run_child_process({"gsettings", "get", "org.gnome.desktop.interface", "cursor-size"})
if success then
xcursor_size = tonumber(stdout)
end
return {
xcursor_theme = xcursor_theme,
xcursor_size = xcursor_size,
}
In addition to no longer requiring a wrapper script, this has the advantage of you being able to manually trigger a config reload (ctrl-shift-r
by default) to update the theme without having to restart wezterm.
main
is now technically capable of talking to XDG Desktop Portal to query these sorts of settings. The settings interface currently only portably defines the dark mode/appearance in a DE-agnostic way; these are the portable settings:
gdbus call --session --dest=org.freedesktop.portal.Desktop --object-path=/org/freedesktop/portal/desktop --method=org.freedesktop.portal.Settings.ReadAll '["org.freedesktop.appearance"]'
({'org.freedesktop.appearance': {'color-scheme': <uint32 1>}, 'org.freedesktop.appearance': {'color-scheme': <uint32 1>}, 'org.freedesktop.appearance': {'color-scheme': <uint32 1>}},)
However, the cursor theme and size are reported under a org.gnome.desktop.interface
namespace along with a lot of other gnome specific stuff; you can see for yourself by running:
gdbus call --session --dest=org.freedesktop.portal.Desktop --object-path=/org/freedesktop/portal/desktop --method=org.freedesktop.portal.Settings.ReadAll '[]'
It wouldn't be terribly difficult to hook this up in wezterm, but I'm not sure if this would give surprising results sometimes. For example, if you have two sessions running different DE on the same machine, would they both end up using the gnome settings? That's probably not desirable. I don't know if this stuff is smart enough to avoid that or not.
For example, if you have two sessions running different DE on the same machine, would they both end up using the gnome settings?
I don't think that will cause problem because if I understand correctly, when you query the session dbus (--session
), it gets the session address from DBUS_SESSION_BUS_ADDRESS
env var, and different login sessions will have different session addresses.
The code snippet at https://github.com/wez/wezterm/issues/1742#issuecomment-1075333507, which explicitly sets wezterm's xcursor_theme
and xcursor_size
configs based on GNOME's existing settings for those configs, is the only solution I found to fix the mouse cursor from disappearing as described at https://github.com/wez/wezterm/issues/3334.
I would have added this comment to the linked issue, but couldn't because that issue is closed. Maybe @wez could add that, as the linked issue is the first Google result when searching for e.g. "wezterm mouse disappearing"?
Done
What Operating System(s) are you seeing this problem on?
Linux Wayland
WezTerm version
wezterm 20220319-163727-ee5d5714
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
Yes, and I updated the version box above to show the version of the nightly that I tried
Describe the bug
524 reported the same bug on X11. Although Wayland does not have a cursor configuration protocol just yet (see here for some work being done), the de-facto configuration method is still to use the Xcursor theme.
Setting the relevant environment variables
XCURSOR_THEME
andXCURSOR_SIZE
does change the cursor, so there's that.To Reproduce
Configuration
The only relevant setting is
enable_wayland = true
.Expected Behavior
This is my normal cursor (Yaru):
This is the cursor I see when mousing over WezTerm (Breeze):
I would expect to not see the cursor change when mousing over WezTerm
Logs
Logs don't provide relevant info
Anything else?
No response