mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 16:25:59 +01:00
8b37e81374
cursor:sync_gsettings_theme is set to default true and if enabled it will now sync xcursor theme loading with gsettings if it can, meaning CSD clients will now also change to the appropiate theme upon start and hyprctl setcursor THEME SIZE .
48 lines
No EOL
1.5 KiB
C++
48 lines
No EOL
1.5 KiB
C++
#pragma once
|
|
#include <string>
|
|
#include <vector>
|
|
#include <unordered_set>
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <hyprutils/math/Vector2D.hpp>
|
|
#include "helpers/memory/Memory.hpp"
|
|
|
|
extern "C" {
|
|
#include <X11/Xcursor/Xcursor.h>
|
|
}
|
|
|
|
// gangsta bootleg XCursor impl. adidas balkanized
|
|
struct SXCursorImage {
|
|
Vector2D size;
|
|
Vector2D hotspot;
|
|
std::vector<uint32_t> pixels; // XPixel is a u32
|
|
uint32_t delay; // animation delay to next frame (ms)
|
|
};
|
|
|
|
struct SXCursors {
|
|
std::vector<SXCursorImage> images;
|
|
std::string shape;
|
|
};
|
|
|
|
class CXCursorManager {
|
|
public:
|
|
CXCursorManager();
|
|
~CXCursorManager() = default;
|
|
|
|
void loadTheme(const std::string& name, int size);
|
|
SP<SXCursors> getShape(std::string const& shape, int size);
|
|
|
|
private:
|
|
SP<SXCursors> createCursor(std::string const& shape, XcursorImages* xImages);
|
|
std::unordered_set<std::string> themePaths(std::string const& theme);
|
|
std::string getLegacyShapeName(std::string const& shape);
|
|
std::vector<SP<SXCursors>> loadStandardCursors(std::string const& name, int size);
|
|
std::vector<SP<SXCursors>> loadAllFromDir(std::string const& path, int size);
|
|
void syncGsettings();
|
|
|
|
int lastLoadSize = 0;
|
|
std::string themeName = "";
|
|
SP<SXCursors> defaultCursor;
|
|
SP<SXCursors> hyprCursor;
|
|
std::vector<SP<SXCursors>> cursors;
|
|
}; |