mirror of
https://github.com/virtcode/hypr-dynamic-cursors
synced 2025-09-19 16:13:21 +02:00
parent
c13cbd5ed2
commit
94eaf75d09
8 changed files with 80 additions and 2 deletions
|
@ -110,6 +110,15 @@ double CShake::update(Vector2D pos) {
|
|||
return this->zoom->value();
|
||||
}
|
||||
|
||||
void CShake::force(std::optional<int> duration, std::optional<float> size) {
|
||||
static auto* const* PTIMEOUT = (Hyprlang::INT* const*) getConfig(CONFIG_SHAKE_TIMEOUT);
|
||||
static auto* const* PBASE = (Hyprlang::FLOAT* const*) getConfig(CONFIG_SHAKE_BASE);
|
||||
|
||||
started = true;
|
||||
*this->zoom = size.value_or(**PBASE);
|
||||
this->end = steady_clock::now() + milliseconds(duration.value_or(**PTIMEOUT));
|
||||
}
|
||||
|
||||
void CShake::warp(Vector2D old, Vector2D pos) {
|
||||
auto delta = pos - old;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "helpers/AnimatedVariable.hpp"
|
||||
#include <bits/getopt_ext.h>
|
||||
#include <hyprutils/animation/AnimatedVariable.hpp>
|
||||
#include <hyprutils/math/Vector2D.hpp>
|
||||
#include <vector>
|
||||
|
@ -20,6 +21,9 @@ class CShake {
|
|||
/* called when a cursor warp has happened (to avoid magnifying on warps) */
|
||||
void warp(Vector2D old, Vector2D pos);
|
||||
|
||||
/* force magnification regardless of speed now */
|
||||
void force(std::optional<int> duration, std::optional<float> size);
|
||||
|
||||
private:
|
||||
/* tracks whether the current shake has already been announced in the ipc */
|
||||
bool ipc = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue