New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cursor hiding in Wayland #3334
Comments
Facing the same issue, but i don't need to open neovim. As soon as i start typing the cursor disappears - as per the feature- but then does not reappear unless it is moved outside the terminal window With forced Xwayland - |
Hard to reproduce on my side, but can confirm that this often happens with me as well (on Wayland) |
Can confirm |
I cannot reproduce this with a few different wayland compositors (sway and river), but I |
You're right, I thought it was to do with neovim, but it happens without neovim too. I changed the description to remove the neovim part. Thanks! |
I tried to find the issue, seems it has to do with this line. Changing that function resolves the issue (effectively removing the use of pub fn set_cursor(&self, name: Option<&str>, serial: Option<u32>) {
if let Some(name) = name {
if let Err(err) = self.auto_pointer.set_cursor(name, serial) {
log::error!("Unable to set cursor to {}: {:#}", name, err);
}
} else {
(*self.auto_pointer).set_cursor(0, None, 0, 0);
}
} It seems that clicking the Wezterm window changes the value of I only have a rough idea of what I'm doing and I wouldn't be surprised if my proposal is wrong. I mainly hope this helps @wez (or maybe @jmbaur ?) to more easily find the issue and propose a correct fix. Otherwise, if my proposal happens to be correct, I'd be happy to submit a PR. |
I have a similar bug on Wayland Gnome on the latest version of wezterm without a config. The cursor disappears when I hover over the terminal window. I can highlight things, but the cursor stays hidden. HOWEVER, when I open another app, this buggy behavior disappears, and the cursors stays visible. Weird, huh? See the GIF below demonstrating this bug. P.S. Of course, this bug disappears if I set @hgaiser I tried your proposal. Unfortunately, it didn't help in my case. |
I can reproduce this issue on NixOS unstable running Sway, by setting the GTK/X11 cursor/cursor theme it fixed itself. That might cause issues reproducing it: try using a fresh install of a distro with few defaults (Arch/NixOS minimal). |
I keep getting this error -
further, previously i was using a catpuccin cursor theme and now i changed my cursor theme to Adwaita, yet and it does not resolve itself. If it might help, I am using Hyprland |
This issue also happened to me in conjunction with various error messages mentioning EDIT: I am also on NixOS btw. The following are just some thoughs and research about possibly fixing this issue on wezterm's side without requiring user action, feel free to disregard: Since it seems like this bug mainly stems from either no cursor theme being set or the cursor theme being set to a theme that is not currently installed, it might be beneficial for wezterm to query the icon theme via other sources instead of just the config option and the environment variable (as is currently the case?). |
My Xcursor theme env variable is set though.
It does not work with Adwaita also. However when i do this it works instead
|
FWIW, I use this when I run under wayland/gnome:
local wezterm = require 'wezterm'
local mod = {}
local function gsettings(key)
return wezterm.run_child_process({"gsettings", "get", "org.gnome.desktop.interface", key})
end
function mod.apply_to_config(config)
if wezterm.target_triple ~= "x86_64-unknown-linux-gnu" then
-- skip if not running on linux
return
end
local success, stdout, stderr = gsettings("cursor-theme")
if success then
config.xcursor_theme = stdout:gsub("'(.+)'\n", "%1")
end
local success, stdout, stderr = gsettings("cursor-size")
if success then
config.xcursor_size = tonumber(stdout)
end
config.enable_wayland = true
if config.enable_wayland and os.getenv("WAYLAND_DISPLAY") then
local success, stdout, stderr = gsettings("text-scaling-factor")
if success then
config.font_size = (config.font_size or 10.0) * tonumber(stdout)
end
end
end
return mod then in my main config file I pull it in like this: (See: Making your own lua modules) local wezterm = require 'wezterm'
local config = {}
if wezterm.config_builder then
config = wezterm.config_builder()
end
local wayland_gnome = require 'wayland_gnome'
wayland_gnome.apply_to_config(config)
return config This obviously assumes gnome, and thus isn't suitable for non-gnome compatible environments. |
Ok, I think i know how to fix my issue. Few cursor themes (read catppuccin) does not have xterm.png or whatever image format ref. Whereas Adwaita has ( see there is a xterm.png file present). Instead, catppuccin has a default.svg Now in here it is being set to xterm by default wezterm/window/src/os/wayland/window.rs Line 1115 in db720bd
So there are two possibilities,
|
This allows for potentially listing multiple candidate cursor names, like we do for x11, but doesn't add any. Attempt to load default if our desired cursor is not found. refs: #3334
If the issue is really that your chosen theme doesn't have a full set of icons, then 048e8dd should help with that. That should show up in nightly builds within the hour. |
I'm seeing what's reported in the original comment -- the mouse cursor disappears when I press shift, at least in |
The mouse cursor is supposed to hide when you press a key. It should reappear when you move the mouse; that's the behavior that I see on all the systems that I use. |
Is there anything I can do to help debug this issue? As per my comment #3334 (comment), changing that code helps for me, while without it the cursor does not reappear when I move the mouse. I'm using that for 3 weeks now and I am happy with how it works, though I have no clue if it is correct or not. |
@hgaiser Oh, I missed that. Wayland is a bit picky about the serial, so I would have expected the opposite behavior to be true! We can try taking out the serial in the nightly and see what people say about it. |
Would you like a PR for that change? |
Can you paste the diff here? |
Absolutely: diff --git a/window/src/os/wayland/pointer.rs b/window/src/os/wayland/pointer.rs
index 5dc2f0f4..72024f72 100644
--- a/window/src/os/wayland/pointer.rs
+++ b/window/src/os/wayland/pointer.rs
@@ -341,11 +341,8 @@ impl PointerDispatcher {
}
pub fn set_cursor(&self, name: Option<&str>, serial: Option<u32>) {
- let inner = self.inner.lock().unwrap();
- let serial = serial.unwrap_or(inner.serial);
-
if let Some(name) = name {
- if let Err(err) = self.auto_pointer.set_cursor(name, Some(serial)) {
+ if let Err(err) = self.auto_pointer.set_cursor(name, serial) {
log::error!("Unable to set cursor to {}: {:#}", name, err);
}
} else { |
Don't fallback to some other serial. In a new version of SCTK, it looks like the serial we pass should be the serial from the time we entered the surface, rather than the latest serial that we have. In practice, this commit uses None for the serial which seems to have better results, but may come back to haunt us until we upgrade to the latest SCTK. refs: #3334 (comment)
Thanks; I've applied the equivalent of that to |
Great, thanks 👍 . Hope it solves other peoples problems too. |
Ok this works for me with Adwaita, sadly not with catppuccin, maybe that is a different issue. Will recheck. |
Neither of the commits above (048e8dd and e204f8b) fixed the issue for me. I still had these errors:
What fixed my problem of the invisible cursor was #3334 (comment). Thanks, @feathecutie!
|
Thanks, this is fixed for me.
This is less nice than in other terminal emulators. It disappears on |
@lnicola please file a separate issue for that |
@chrysos349 what did you set the theme to? |
@wez I have |
@chrysos349 the way that wezterm (and other software) works is that if you don't specify a theme, |
@wez I did a little digging. I compared both of my systems (voidlinux and archlinux). I had the issue with the cursor on voidlinux. It turns out there was no
The issue is solved! There is no need to export the environment variable |
I have figured out the problem and the solution. echo $XCURSOR_THEME
Catppuccin-Mocha-Maroon This works in all other GUI applications including browser, kitty, etc. The issue is that in local wezterm = require("wezterm")
return {
-- other setttings
xcursor_theme="Catppuccin-Mocha-Maroon-Cursors"
} and now it works !
UPD: Just checked with XWayland without the |
I suspect that may be an issue in the upstream https://github.com/smithay/client-toolkit that is used to manage themed cursors when running under Wayland. Under X11, wezterm uses its own logic. |
I see, then this issue can be closed, because mine is no longer related to it. Thank you for your help and quick responses |
Just tested this with the latest nightly: 20230515-073311-76406e84 EDIT: Seems that the issue that is still here is not split pane related, but maximized window related (I just combine these). Also, it only happens when you just have maximized the window, and still have not given focus to any other window. If you give focus to another window and come back, then mouse hiding starts to work as expected. To reproduce that case you just do:
And even if this seems like a corner case, it is highly visible if you are using maximized windows in your workflow, since you tend to maximize the window and then right away start typing. So, this issue is not fully fixed in nightly, and should probably not have the "fixed-in-nightly" label. |
@snaggen please open a separate issue! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
For those landing here from search engines: see #1742 (comment) for a way to explicitly apply GNOME's settings to your wezterm mouse cursor |
What Operating System(s) are you seeing this problem on?
Linux Wayland
Which Wayland compositor or X11 Window manager(s) are you using?
Gnome
WezTerm version
wezterm 20230320-124340-559cb7b0
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
No, and I'll explain why below
Describe the bug
Moving the cursor after clicking in Wezterm and typing doesn't make it reappear.
To Reproduce
Configuration
no config
Expected Behavior
I expect the cursor to reappear after moving it.
Logs
No response
Anything else?
Related PR: #2977
Screencast.from.2023-03-23.10-59-43.webm
The text was updated successfully, but these errors were encountered: