cursor-shape: use - instead of _ in shapes

ref #5824
This commit is contained in:
Vaxry 2024-05-02 16:20:51 +01:00
parent eeb78ef965
commit a3ca016d42
2 changed files with 24 additions and 24 deletions

View File

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

View File

@ -7,7 +7,7 @@
constexpr const char* SHAPE_NAMES[] = { constexpr const char* SHAPE_NAMES[] = {
"invalid", "invalid",
"default", "default",
"context_menu", "context-menu",
"help", "help",
"pointer", "pointer",
"progress", "progress",
@ -15,31 +15,31 @@ constexpr const char* SHAPE_NAMES[] = {
"cell", "cell",
"crosshair", "crosshair",
"text", "text",
"vertical_text", "vertical-text",
"alias", "alias",
"copy", "copy",
"move", "move",
"no_drop", "no-drop",
"not_allowed", "not-allowed",
"grab", "grab",
"grabbing", "grabbing",
"e_resize", "e-resize",
"n_resize", "n-resize",
"ne_resize", "ne-resize",
"nw_resize", "nw-resize",
"s_resize", "s-resize",
"se_resize", "se-resize",
"sw_resize", "sw-resize",
"w_resize", "w-resize",
"ew_resize", "ew-resize",
"ns_resize", "ns-resize",
"nesw_resize", "nesw-resize",
"nwse_resize", "nwse-resize",
"col_resize", "col-resize",
"row_resize", "row-resize",
"all_scroll", "all-scroll",
"zoom_in", "zoom-in",
"zoom_out", "zoom-out",
}; };
// clang-format on // clang-format on