Skip to content
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 size with HiDPi #2448

Open
Adu-3 opened this issue Jun 5, 2023 · 13 comments
Open

Cursor size with HiDPi #2448

Adu-3 opened this issue Jun 5, 2023 · 13 comments
Labels
bug Something isn't working

Comments

@Adu-3
Copy link

Adu-3 commented Jun 5, 2023

The Issue:

I came form Plasma KDE to Hyprland and I saw that cursor size with fractional scaling to 1.5 is too problematic , I did append the typical cursor adjustment with other environment variables form the wiki in my config:

env = GDK_BACKEND,wayland,x11
env= QT_QPA_PLATFORM,wayland;xcb
env = SDL_VIDEODRIVER,wayland
env = CLUTTER_BACKEND,wayland
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_TYPE,wayland
env = XDG_SESSION_DESKTOP,Hyprland
env = QT_AUTO_SCREEN_SCALE_FACTOR,1
env = GTK_THEME,Breeze-Dark
env = QT_STYLE_OVERRIDE,Breeze-Dark
env = XCURSOR_THEME,Future-Cursors
env = XCURSOR_SIZE,24
env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1
exec-once=gsettings set org.gnome.desktop.interface cursor-theme 'Future-cursors'
exec-once=hyprctl setcursor Future-cursors 24
monitor=eDP-1,highres,auto,1.5

How reproduce

Just change the scale size

Details

Also i did set cursor size using nwg-look to 24 also

and I still have issues with firefox ( native not flatpak ) and other apps where I see my cursor in the desktop pretty normal sized and when I hover the mouse around the waybar or when opening and moveing my cursor in it it get resized and become bigger. Furthermore, when I use rofi menu the mouse become tiny even if i try passing --dpi argument :(. In addition, using when using any screen recoreding software using Pipewire (Like OBS and wf-recoreder was tested also ) the mouse become dramatically oversized and here like that and affect every other program until I close it:
https://github.com/hyprwm/Hyprland/assets/88736671/b68b00e6-97f8-4e03-9bee-9c1c6d1c1e38
It might be related to scaling because when I get selecting resolution I got 1280 X 720 while my screen is Full HD:
image
for now OBS and rofi problems are unsolvable while cursor size on the bar and other applications could be fixed with changing the cursor size using nwg-look to match desktop cursor size.

Setup

  • (AMD + Nvidia) Laptop but using AMD Primarily
  • Hyprland on latest version (0.26.0) with nvidia patch
  • Arch Linux

If you need any further information or configuration to try just let me know

Edit : After some further investigations I have found that with Fractional scaling some apps and games also are recognizing my monitor as 1280 X 720 and not 1920 X 1080 , and I think it might be the problem for this weird mouse changing

@Adu-3 Adu-3 added the bug Something isn't working label Jun 5, 2023
@Zeioth
Copy link

Zeioth commented Jun 10, 2023

Add this to your ~/.profile to set any cursor size you want.

export QT_SCALE_FACTOR=2.6
export ELM_SCALE=2.6
export GDK_SCALE=2.6
export XCURSOR_SIZE=108

It's applyed when the session starts. But you can also:

source ~/.profile

To make the changes inmediate.

@Adu-3
Copy link
Author

Adu-3 commented Jun 16, 2023

Thanks for reply , those variables are making some apps more bigger with fractional scaling as it was set in the config and XCURSOR_SIZE was already set in my config and sadly it does not affect any app. However , I tried to scale back to 1 and scale everything font to match the desired goal using nwg-look and other apps settings and using them make apps scaled to 1.5 and I could say it is the best result that it have got so far but on the other hand, cursor size seems to be matched using nwg-look and some environment variables like:

but it is inaccurate by a character or two and when reducing its size using 'hyprctl setcursor Future-cursors 24' (BTW i use 36 cursor size when using '1' scaling that means the command is scaling down) it become more accurate (not completely) but smaller in desktop . I'm not sure weather it is KDE that wrote old configs for QT or gtk or anything similar to that makes kind of conflict but i tried to edit with nwg-look but with no luck.

All I can say now under fractional scaling cursor and resolution are major issues even with hidpi patch from the AUR I'm not turning back to it.

but the mouse accuracy under normal scaling '1' is weird even if you get back to the original cursor or any theme cursor all of them are affected.while the issue is not present under KDE. Here is the top of my config

env = WLR_NO_HARDWARE_CURSORS,1
env = GDK_BACKEND,wayland,x11
env = QT_QPA_PLATFORM,wayland;xcb
env = SDL_VIDEODRIVER,wayland
env = CLUTTER_BACKEND,wayland
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_TYPE,wayland
env = XDG_SESSION_DESKTOP,Hyprland
env = GTK_THEME,Breeze-Dark
env = QT_STYLE_OVERRIDE,Breeze
env = QT_QPA_PLATFORMTHEME,qt5ct
env = XCURSOR_THEME,Future-cursors
env = XCURSOR_SIZE,24
env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1
env = QT_AUTO_SCREEN_SCALE_FACTOR,1
env = QT_SCALE_FACTOR,1.5
env = GDK_SCALE,1.5
env = ELM_SCALE,1.5
monitor=eDP-1,highres,auto,1
exec-once=gsettings set org.gnome.desktop.interface cursor-theme 'Future-cursors'
exec-once=hyprctl setcursor Future-cursors 24
exec-once=/usr/lib/polkit-kde-authentication-agent-1
exec-once=nm-applet --indicator
exec-once=waybar
exec-once=hyprpaper
exec-once=/usr/lib/kdeconnectd
exec-once=dunst
exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once=fcitx5 -D
exec-once=swayidle -w timeout 200 'swaylock-fancy'

@TLATER
Copy link
Contributor

TLATER commented Jun 26, 2023

So, getting wayland-native things to have correct cursor sizes works pretty well for me. I now run a little script with exec-once before anything else:

hyprctl setcursor 'Bibata-Original-Ice' 24
gsettings set org.gnome.desktop.interface cursor-theme 'Bibata-Original-Ice'
gsettings set org.gnome.desktop.interface cursor-size '24'

I use gsettings because it's more predictable and portable than some random imperative gui application.

This sets up my cursor theme and a basic size, which is automatically scaled for me on my hidpi display to look correct - without any additional settings - for wayland-native applications.

Since xorg obviously doesn't do scaling, that's where XCURSOR_SIZE needs to be set. Currently I set it to 48 because hyprctl monitors says my main monitor has a scale factor of 2.0, export-ing it into my profile before hyprland even starts. I also use XCURSOR_THEME to set the cursor theme. I also run

xsetroot -cursor_name left_ptr

during the above script, because without it xwayland will reset the cursor to the default x cursor when leaving an xorg application's window.

This works ok, except somehow for rofi, which seems to completely ignore the xcursor variables. I don't know why, emacs does fine and runs with the exact same environment.

@M1cha
Copy link

M1cha commented Jul 30, 2023

I think there's a conceptional issue with QT applications:

  • I'm using hidpi-patched wlroots and xwayland
  • I'm using a scale of 2
  • My native cursor size is 24
  • I did not set XCURSOR_SIZE
  • All wayland applications have the same, correct cursor size
  • In xwayland application the cursor is too small(half the size).

Now, when I set XCURSOR_SIZE to double the native size(48), then all xwayland applications use the correct size. But that also breaks wayland-native QT applications because they actually interpret the XCURSOR_SIZE environment variable - even when running under wayland. They now have a cursor double the expected size(probably 48).
It looks like for whatever reason they render the cursor as XCURSOR_SIZE * scale even when running under wayland. There's an old, unsolved issue about that: https://bugreports.qt.io/browse/QTBUG-87778.

So right now there's no way to have the cursor be the correct size in all applications. Either xwayland is too small or wayland-QT is too big. I'm not sure if the fault lies within hyprland or within QT. Are we setting set_buffer_scale on the cursor correctly as indicated by the QTBUG?

@andresilva
Copy link
Contributor

FWIW this seems to be related to fractional scaling. When I set the scale to either 1 or 2, then mouse cursor size is properly applied by GTK apps.

@AnhQuanTrl
Copy link

I have a somewhat similar problem. When I set scaling to fractional scaling, the cursor when hovered on waybar or my terminal (alacritty) is bigger than on hyperland.

@MariaSolOs
Copy link

I'm having a similar issue but it only happens when hovering over dunst notifications. I've set XCURSOR_SIZE to 16 and I'm using a scale of 2, but for some reason the cursor seems to grow to a size of 24 when hovering over dunst popups.

@vaxerski
Copy link
Member

is this still a thing?

@michaelhthomas
Copy link

Still a thing. With 1.5 fractional scaling I've noticed that my cursors are (slightly) larger in GTK-based apps than when hovering over the desktop or plain wayland clients like foot.

@andresilva
Copy link
Contributor

andresilva commented May 16, 2024

Have you tested latest master? It seems to have been solved for me with the recent hyprland re-implementation of cursor handling (which is not yet in any release).

@kaushiksahu18
Copy link

kaushiksahu18 commented Jun 27, 2024

i am also facing the same issue i guess

the above panal in the video is wayber, although its happning with every apps (on apps, cursor becomes big and on wallpaper it becomes small again)

video

i have set (decrise the size of my cusor) by dconf

20240627_17h45m16s_grim

its just night mode

@KaylaSolace
Copy link

I am getting this issue, notably with minecraft or steam's header (between the buttons and the notifications)

seems to ignore whatever theme or settings im using regardless of any envars and show the default cursor at size 98 while I have xcursor size to 24...

@krims0n32
Copy link

Same issue here. Steam, winecfg show this behaviour. Not happening in KDE for example.

I reported this earlier here: #5715

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests