Check alternative cursor names when loading cursor
Browse files at this commit6a81d8f2a63a8b18aafbe1f6b12bcdcd39cbd83eParent: 889d0622 changed files +13 -2
- Cargo.lock +2 -2
- src/cursor.rs +11 -0
Cargo.lockmodified+2 -2
| @@ -698,9 +698,9 @@ dependencies = [ | |||
| 698 | 698 | ||
| 699 | [[package]] | 699 | [[package]] |
| 700 | name = "cursor-icon" | 700 | name = "cursor-icon" |
| 701 | -version = "1.0.0" | 701 | +version = "1.1.0" |
| 702 | source = "registry+https://github.com/rust-lang/crates.io-index" | 702 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 703 | -checksum = "740bb192a8e2d1350119916954f4409ee7f62f149b536911eeb78ba5a20526bf" | 703 | +checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" |
| 704 | 704 | ||
| 705 | [[package]] | 705 | [[package]] |
| 706 | name = "deranged" | 706 | name = "deranged" |
src/cursor.rsmodified+11 -0
| @@ -111,6 +111,17 @@ impl CursorManager { | |||
| 111 | .or_insert_with_key(|(icon, scale)| { | 111 | .or_insert_with_key(|(icon, scale)| { |
| 112 | let size = self.size as i32 * scale; | 112 | let size = self.size as i32 * scale; |
| 113 | let mut cursor = Self::load_xcursor(&self.theme, icon.name(), size); | 113 | let mut cursor = Self::load_xcursor(&self.theme, icon.name(), size); |
| 114 | + | ||
| 115 | + // Check alternative names to account for non-compliant themes. | ||
| 116 | + if cursor.is_err() { | ||
| 117 | + for name in icon.alt_names() { | ||
| 118 | + cursor = Self::load_xcursor(&self.theme, name, size); | ||
| 119 | + if cursor.is_ok() { | ||
| 120 | + break; | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + | ||
| 114 | if let Err(err) = &cursor { | 125 | if let Err(err) = &cursor { |
| 115 | warn!("error loading xcursor {}@{size}: {err:?}", icon.name()); | 126 | warn!("error loading xcursor {}@{size}: {err:?}", icon.name()); |
| 116 | } | 127 | } |