diff --git a/src/backend/render/cursor.rs b/src/backend/render/cursor.rs index a1aef27b..745955bd 100644 --- a/src/backend/render/cursor.rs +++ b/src/backend/render/cursor.rs @@ -219,7 +219,7 @@ impl CursorStateInner { } } -pub fn load_cursor_theme() -> (CursorTheme, u32) { +pub fn load_cursor_env() -> (String, u32) { let name = std::env::var("XCURSOR_THEME") .ok() .unwrap_or_else(|| "default".into()); @@ -227,6 +227,11 @@ pub fn load_cursor_theme() -> (CursorTheme, u32) { .ok() .and_then(|s| s.parse().ok()) .unwrap_or(24); + (name, size) +} + +pub fn load_cursor_theme() -> (CursorTheme, u32) { + let (name, size) = load_cursor_env(); (CursorTheme::load(&name), size) } diff --git a/src/xwayland.rs b/src/xwayland.rs index 6539b7d9..cb2e74ec 100644 --- a/src/xwayland.rs +++ b/src/xwayland.rs @@ -1,7 +1,7 @@ use std::{ffi::OsString, os::unix::io::OwnedFd, process::Stdio}; use crate::{ - backend::render::cursor::{load_cursor_theme, Cursor}, + backend::render::cursor::{load_cursor_env, load_cursor_theme, Cursor}, shell::{ focus::target::KeyboardFocusTarget, grabs::ReleaseMode, CosmicSurface, PendingWindow, Shell, }, @@ -595,12 +595,18 @@ impl Common { .filter_map(|s| s.0.x11_surface().map(|x| (x.clone(), x.geometry()))) .collect::>(); + let (_, cursor_size) = load_cursor_env(); + // update xorg dpi if let Some(xwm) = xwayland.xwm.as_mut() { let dpi = new_scale * 96. * 1024.; if let Err(err) = xwm.set_xsettings( [ ("Xft/DPI".into(), (dpi.round() as i32).into()), + ( + "Xcursor/size".into(), + ((new_scale * cursor_size as f64).round() as i32).into(), + ), ( "Gdk/UnscaledDPI".into(), ((dpi / new_scale).round() as i32).into(), @@ -609,6 +615,10 @@ impl Common { "Gdk/WindowScalingFactor".into(), (new_scale.round() as i32).into(), ), + ( + "Gtk/CursorThemeSize".into(), + ((new_scale * cursor_size as f64).round() as i32).into(), + ), ] .into_iter(), ) {