cursormgr: attempt using - instead of _ for failed cursors before fallback

web uses -, and thus some themes might use - too. Attempt replacing _ with - before assuming a shape is missing.
This commit is contained in:
Vaxry 2024-05-02 14:47:05 +01:00
parent d0229d6e1e
commit 8427824719
1 changed files with 8 additions and 0 deletions

View File

@ -116,6 +116,14 @@ void CCursorManager::setCursorFromName(const std::string& name) {
m_sCurrentCursorShapeData = m_pHyprcursor->getShape(name.c_str(), m_sCurrentStyleInfo);
if (m_sCurrentCursorShapeData.images.size() < 1) {
// try with '-' first (xcursor, web, etc)
std::string newName = name;
std::replace(newName.begin(), newName.end(), '_', '-');
m_sCurrentCursorShapeData = m_pHyprcursor->getShape(newName.c_str(), m_sCurrentStyleInfo);
}
if (m_sCurrentCursorShapeData.images.size() < 1) {
// fallback to a default if available
constexpr const std::array<const char*, 2> fallbackShapes = {"default", "left_ptr"};