wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.05k stars 770 forks source link

Regression: Unable to set cursor to xterm: cursor not found #4681

Open signed-log opened 9 months ago

signed-log commented 9 months ago

What Operating System(s) are you seeing this problem on?

Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

GNOME (Mutter)

WezTerm version

wezterm 20231211_013626_7244b5a2

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

Log flooding with that message and occasionaly cursor disappearing

To Reproduce

No response

Configuration

return { color_scheme = "Espresso", check_for_updates = false, font_size = 11.0, default_prog = {"/usr/bin/tmux"}, enable_wayland = true, }

Expected Behavior

No log and cursor being visible at all time

Logs

wezterm version: 20231211_013626_7244b5a2 x86_64-unknown-linux-gnu Window Environment: Wayland WebGPU: name=AMD Radeon RX 6900 XT (RADV NAVI21), device_type=DiscreteGpu, backend=Vulkan, driver=radv, driver_info=Mesa 23.2.1, vendor=4098, device=29631 Enter lua statements or expressions and hit Enter. Press ESC or CTRL-D to exit 20:40:25.873 ERROR window::os::wayland::pointer > set_cursor: Unable to set cursor to xterm: cursor not found, Unable to set cursor to 'default': cursor not found 20:40:25.880 ERROR window::os::wayland::pointer > set_cursor: Unable to set cursor to xterm: cursor not found, Unable to set cursor to 'default': cursor not found 20:40:25.888 ERROR window::os::wayland::pointer > set_cursor: Unable to set cursor to xterm: cursor not found, Unable to set cursor to 'default': cursor not found 20:40:25.895 ERROR window::os::wayland::pointer > set_cursor: Unable to set cursor to xterm: cursor not found, Unable to set cursor to 'default': cursor not found 20:40:25.903 ERROR window::os::wayland::pointer > set_cursor: Unable to set cursor to xterm: cursor not found, Unable to set cursor to 'default': cursor not found

Anything else?

Regression from #2743

SuperSandro2000 commented 8 months ago

KDE is not exporting XCURSOR_THEME by default. Not sure if there is another way to get that.

jayvdb commented 8 months ago

Running find /usr/share/icons ~/.local/share/icons ~/.icons -type d -name "cursors" will give a list of available cursor themes, and then running XCURSOR_THEME=Adwaita wezterm will resolve the problem for me.

https://wezfurlong.org/wezterm/config/lua/config/index.html doesnt mention this, but xcursor_theme can be used to hardwire this. c.f. https://github.com/wez/wezterm/issues/2743#issuecomment-1314197400

SuperSandro2000 commented 7 months ago

I think my system was missing this default config file https://wiki.archlinux.org/title/Cursor_themes#:~:text=example%20Breeze_Snow%3A-,~%2F.icons%2Fdefault%2Findex.theme,-%5Bicon%20theme%5D%20%0AInherits%3Dcursor

eshom commented 4 months ago

Found this issue Googling. I Had the same problem. I'm on OpenSUSE Tumbleweed (20240523), Wayland, KDE Plasma. Adding export XCURSOR_THEME=Adwaita in .bashrc and as a session environment variable + restart fixed it for me.

zierf commented 1 month ago

The problem with this approach is that if you change your cursor you have to remember to read the selected theme again.

xprop -root | grep RESOURCE_MANAGER | perl -pe 's/\\n/\n/g' | grep -i cursor

And then you have to edit the ~/.wezterm.lua or overwrite the environment variable XCURSOR_THEME.

Actually, after a standard installation without any further action, an error should not automatically be thrown. Anyone who tries out Wezterm and encounters this error would have to first find this issue and then make the manual adjustments.

On my NixOS, the variable XCURSOR_PATH contains (among other things) the path to /run/current-system/sw/share/icons, but without the variable XCURSOR_THEME, the cursor is still not selected, as mentioned by SuperSandro2000 for KDE.

cezdro commented 1 month ago

Based on the answers above, I put together the following solution:

local wezterm = require 'wezterm'

local function get_cursor_theme()
    local success, stdout, stderr =
        wezterm.run_child_process { 'xprop', '-root' }
    if not success then
        wezterm.log_error(
            ('Command exited with non-zero exit code.\nStdout:\n%s\nStderr:\n%s'):format(
                stdout,
                stderr
            )
        )
        return nil
    end

    return stdout:match [[RESOURCE_MANAGER%(STRING%) = ".+\nXcursor.theme:\t(.+)\n.+"]]
end

return {
    xcursor_theme = get_cursor_theme(),
}

It will automatically pick up the cursor theme, based on the xprop -root output. There are some cases which I didn't cover in the regex, so it may not work for everybody.