aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-11-02 14:47:35 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-11-02 16:23:05 +0400
commit6a81d8f2a63a8b18aafbe1f6b12bcdcd39cbd83e (patch)
treec9aa186e9b7b4fb98b320e18d2c760ec8d954139 /src
parent889d062df7d89bf8084414c6f8fd87075c3cf85a (diff)
downloadniri-6a81d8f2a63a8b18aafbe1f6b12bcdcd39cbd83e.tar.gz
niri-6a81d8f2a63a8b18aafbe1f6b12bcdcd39cbd83e.tar.bz2
niri-6a81d8f2a63a8b18aafbe1f6b12bcdcd39cbd83e.zip
Check alternative cursor names when loading cursor
Some themes don't have all the cursors specified as in w3c specification, thus try to check for alternative names as well.
Diffstat (limited to 'src')
-rw-r--r--src/cursor.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cursor.rs b/src/cursor.rs
index bef62b51..6bf92cd1 100644
--- a/src/cursor.rs
+++ b/src/cursor.rs
@@ -111,6 +111,17 @@ impl CursorManager {
.or_insert_with_key(|(icon, scale)| {
let size = self.size as i32 * scale;
let mut cursor = Self::load_xcursor(&self.theme, icon.name(), size);
+
+ // Check alternative names to account for non-compliant themes.
+ if cursor.is_err() {
+ for name in icon.alt_names() {
+ cursor = Self::load_xcursor(&self.theme, name, size);
+ if cursor.is_ok() {
+ break;
+ }
+ }
+ }
+
if let Err(err) = &cursor {
warn!("error loading xcursor {}@{size}: {err:?}", icon.name());
}