-
Notifications
You must be signed in to change notification settings - Fork 83
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
hide cursor #299
Comments
I have a (admittedly janky) solution to hiding the cursor, which is just removing or hiding Outside of that hack, or this patch, I don't believe |
Thanks for the tip! I also noticed setting the I ultimately ended up replacing all the themes with the above mentioned to get it to work, but I like the inaccessible path approach better frankly. I'll try that and see if it takes effect. |
|
Hmm, you're right. Ironically, I was assuming a cursor package I installed was what allowed me to see a cursor in EDIT: Okay, so |
If I remember correctly, if no pointer input is available no cursor should be displayed by Cage. Could you check the inputs seen by the compositor? |
How would I check the inputs? Sorry for the ignorance, don’t really know what I am doing as it relates to the compositor :( Based on my ignorant reading of the relevant PR my understanding was that if a touch device is found it hides the cursor. Subtly different from no pointer devices found (which should be my case). But even if a pointer device is present I prefer to make it disappear after a certain inactivity timeout. When I was messing with sway it had setting of this nature (which incidentally didn’t work when set in the config file but did work if I sent a swaymsg). Regarding the cursor env vars, those variables are actually explicitly called out in the docs as supported so we probably want to update the docs if indeed they are ignored. |
From what I understand, they should already be supported, but only if you're using hardware cursors (although I've never figured out how to fix the |
Though to answer your question, run |
Maybe this is why it still shows up for me even if I don't have a keyboard/mouse plugged in?
Seems odd an hdmi device is a keyboard and a pointer but I suppose it's something to do with cec? |
This pointer device should be exactly why a cursor is displayed: here in the code. HDMI-CEC seems to be a good explanation. |
Thanks for looking that up! I think the transparent cursor is the better option in my case as someone may have a mouse plugged in etc. That should work perfectly well until a proper inactivity or similar solution is available. I think the current logic (as I understand it) is sound:
additionally the 3rd bit would be:
As an interim solution, maybe it would be possible currently to default the position to the upper left corner or something instead of sitting dead center of the content area. Would at least make it a little less noticeable. |
Current logic is quite "simple". If any input device has pointer capability, show the cursor. If not, do not show any cursor. This is how I understand it. |
Yeah, would be good to understand why the env vars don't seem to be working. For example setting the cursor path to /dev/null would be cleaner than replacing all cursors...or even setting the theme properly would be great as well. Perhaps I have something messed up on my end preventing those from working as desired? |
Here are two possible solutions with udev:
|
Cage handles the cursor differently than Weston. When I start the same electron application with cage as compositor, there is a cursor in the center of the screen (although only a touch screen is connected, no mouse). When I start the application with weston as compositor, the cursor is NOT displayed. So it would be nice if cage could use the same logic for displaying the cursor as weston does. |
Coming from the future, I also want to disable the cursor only when running Using the suggestion from @travisghansen for setting a transparent cursor theme didn't work, and the way I did it was modifying the Relevant { config, pkgs, ... }:
let
transparent-cursor = pkgs.fetchFromGitHub {
owner = "johnodon";
repo = "Transparent_Cursor_Theme";
rev = "22cf8e6b6ccbd93a7f0ff36d98a5b454f18bed77";
sha256 = "sha256-wf5wnSiJsDqcHznbg6rRCZEq/pUneRkqFIJ+mNWb4Go=";
};
cage = "${pkgs.cage}/bin/cage";
tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet";
alacritty = "${pkgs.alacritty}/bin/alacritty";
greeting = "...";
in {
# ...
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${cage} -- ${alacritty} --command ${tuigreet} --time --greeting \"${greeting}\"";
};
};
};
systemd.services.greetd.serviceConfig = {
Environment = "XCURSOR_PATH=${transparent-cursor}/Transparent";
};
} Resulting # /etc/systemd/system/greetd.service
[Unit]
After=systemd-user-sessions.service
After[email protected]
After=plymouth-quit-wait.service
Conflicts[email protected]
Wants=systemd-user-sessions.service
[Service]
Environment="LOCALE_ARCHIVE=/nix/store/wkb8skirx4zmrnsw6dcxz07p926kz32p-glibc-locales-2.39-52/lib/locale/locale-archive"
Environment="PATH=[…Lots of nix store paths…]"
Environment="TZDIR=/nix/store/fn1y6zydm7mgxrm7b08h1w1c9qkrzk8r-tzdata-2024a/share/zoneinfo"
X-RestartIfChanged=false
# ! This path is from the `fetchFromGitHub` as seen in the nix expression.
Environment=XCURSOR_PATH=/nix/store/6q45r4mg9xm1pf7wiiyb3dl0p1a53h5n-source/Transparent
ExecStart=/nix/store/6dr06lxs8x9cgs62h83ms48f1srahxjs-greetd-0.10.3/bin/greetd --config /nix/store/gcr1i2wrr3djlhar7q5jivi8isxm79ji-greetd.toml
IgnoreSIGPIPE=false
KeyringMode=shared
Restart=on-success
SendSIGHUP=true
TimeoutStopSec=30s
Type=idle
[Install]
WantedBy=graphical.target |
I'm sharing this in case it helps anyone else who tries to hack the code to get rid of the cursor. I tried commenting out lines in seat.c to make it remove the cursor even if it detects a pointing device. I made this line run: Line 131 in df508d6
The cursor still showed up. I had to comment out this line get rid of it: Something is setting the cursor and that brings it back even if it was removed. I'm using cage to run Electron. |
Is there really no way to auto-hide the cursor after it hasn't moved for a while? This seems pretty critical for a kiosk. |
@traverseda |
Clients cannot change the cursor if they don't have pointer focus. Maybe as a workaround it's possible to create a fullscreen transparent layer-shell surface after the idle timeout expires, and destroy it on activity. Anyways, patches welcome if you want to implement this in cage. |
Some efforts are currently made by @OctopusET on layer-shell protocol support, see issue #95 and PR #345. |
The application executed in cage will have pointer focus. However, I assumed the use-case here is to launch an off-the-shelf application such as a web browser and hide the cursor when inactive. It would be annoying to have a patch and compile Firefox just to be able to hide the cursor :P |
Still thinking of this hide cursor at idle, the transparent application may not have to use layer shell. Just launch this application when receiving idle notification and stop it when receiving resume one. It should do the job. |
Regular fullscreen applications can't be fully transparent (because of security concerns). |
This really does just need to be a feature of Cage. This is a feature of KDE running under wayland, where it will hide the cursor is you touch the touch screen anywhere. Sure, there might be some way to hack it up, but if Cage's goal is to be good application kiosk software, this feature needs to exist. Making the cursor invisible is not a good solutions, as a technician might need to hook a mouse up in order to debug problems. |
@BBaoVanC, what is your use-case? Why do you want to hide the cursor? |
For what it's worth I also have a use-case where I never want the cursor to show up. In my scenario the devices are used for scoreboards and information boards during events and if a cursor shows up it looks silly. Arbitrarily hiding it is fine but for some reason I can't get the transparent cursors to work with nixos to having a flag/env var I can set would be great. |
Do you have a pointer device plugged in? If you do, are you never using it, or only in some cases? |
My use case is running on the Spotify Car Thing. It has a dial which acts as a pointer. If I'm understanding right (I don't have one yet physically), removing the pointer role from the dial via libinput/udev removes its ability to be used as a scroll wheel. But, it looks weird to have a cursor on the tiny little device because the touch screen is being used instead for actually moving and clicking things. |
@emersion I don't have much control over that as I hand the device out to users (it's effectively an IoT-like device). One struggle with that logic however is sometimes (rpi) things show up as input that aren't actually input devices..or they are entirely unusable input devices in this context. |
Usually, when there is a pointer input device, the position of the cursor is important, because what's under the cursor gets scrolled. For instance, if an app displays two lists, which one do you expect to scroll if the cursor is hidden?
Sounds like it would make more sense for you to set up an udev rule to disable all pointer devices, rather than hide the cursor. |
I want input devices usable for debugging scenarios etc, I just don't want it visible on the cage terminal. |
Alright apparently scrolling actually wasn't even working, and that might be the issue. But, on the Car Thing, we do want to control what field is scrolled, instead of the user choosing (it wouldn't make any sense). What's the best way to do that? Regardless, the cursor has to be hidden, though. |
In that case, sounds like you'd want to disable pointer devices specifically in case? But just hiding the cursor would be confusing, because cage would still process and relay pointer events.
I don't know. |
So how this works in most other window managers, like KDE of Gnome, is that after a period of inactivity the mouse cursor disappears. If you move the mouse it appears again. On KDE/wayland the cursor will also disappear if it receives a touch event, which is a nice feature bit not critical.
|
Yup, that sounds useful (and that behavior is implemented by Sway already). |
The above mentioned behavior seems sane enough for me. |
I have searched and can't seem to find much beyond the 'hidden cursor when touchscreen present' PR. I'm using an rpi3 trying to create a view-only display (launching chromium with debug port allowing for remote control of the browser). In principle everything seems to be working correctly but I cannot figure out how to make the cursor disappear from dead center of the screen. I have no keyboard/mouse connected and would prefer to make the cursor disappear disappear initially and/or after a period of inactivity.
Is this possible currently?
The text was updated successfully, but these errors were encountered: