diff --git a/README.md b/README.md index 4b2dc3b..d4bdced 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ This plugin is still very early in its development. There are also multiple thin - [ ] per-shape length and starting angle (if possible) - [X] cursor shake to find - [ ] overdue refactoring (wait for aquamarine merge) +- [ ] inverted cursor? +- [ ] hyprcursor magified shape If anything here sounds interesting to you, don't hesitate to contribute. @@ -110,6 +112,10 @@ plugin:dynamic-cursors { # length in px of the simulated stick used to rotate the cursor # most realistic if this is your actual cursor size length = 20 + + # clockwise offset applied to the angle in degrees + # this will apply to ALL shapes + offset = 0.0 } # for mode = tilt diff --git a/src/globals.hpp b/src/globals.hpp index 893475c..7b94a4d 100644 --- a/src/globals.hpp +++ b/src/globals.hpp @@ -12,6 +12,7 @@ #define CONFIG_SHAKE_EFFECTS "plugin:dynamic-cursors:shake:effects" #define CONFIG_SHAKE_IPC "plugin:dynamic-cursors:shake:ipc" #define CONFIG_LENGTH "plugin:dynamic-cursors:rotate:length" +#define CONFIG_ROTATE_OFFSET "plugin:dynamic-cursors:rotate:offset" #define CONFIG_MASS "plugin:dynamic-cursors:tilt:limit" #define CONFIG_FUNCTION "plugin:dynamic-cursors:tilt:function" diff --git a/src/main.cpp b/src/main.cpp index ecac121..1761726 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -120,6 +120,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { HyprlandAPI::addConfigValue(PHANDLE, CONFIG_MASS, Hyprlang::INT{5000}); HyprlandAPI::addConfigValue(PHANDLE, CONFIG_LENGTH, Hyprlang::INT{20}); + HyprlandAPI::addConfigValue(PHANDLE, CONFIG_ROTATE_OFFSET, Hyprlang::FLOAT{0}); HyprlandAPI::addConfigValue(PHANDLE, CONFIG_HW_DEBUG, Hyprlang::INT{0}); diff --git a/src/mode/ModeRotate.cpp b/src/mode/ModeRotate.cpp index 3b62f62..f4ee81a 100644 --- a/src/mode/ModeRotate.cpp +++ b/src/mode/ModeRotate.cpp @@ -7,6 +7,7 @@ EModeUpdate CModeRotate::strategy() { double CModeRotate::update(Vector2D pos) { static auto* const* PLENGTH = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, CONFIG_LENGTH)->getDataStaticPtr(); + static auto* const* POFFSET = (Hyprlang::FLOAT* const*)HyprlandAPI::getConfigValue(PHANDLE, CONFIG_ROTATE_OFFSET)->getDataStaticPtr(); // translate to origin end.x -= pos.x; @@ -25,6 +26,7 @@ double CModeRotate::update(Vector2D pos) { double angle = -std::atan(end.x / end.y); if (end.y > 0) angle += PI; angle += PI; + angle += **POFFSET * ((2 * PI) / 360); // convert to radiants // translate back end.x += pos.x;