Closed kRHYME7 closed 1 week ago
I think these effects would certainly be cool to have, but I think they are out of scope for this plugin.
The current plugin only applies transformations to the mouse cursor (rotation, zoom, etc.) and does not render extra stuff (like these effects would). Things, like this zoom lens around the cursor, or the white overlay, would best be implemented as a separate layer surface, and not as a hyprland plugin.
That being said, I think your first suggestion, showing a lens like hyprpicker could easily be made scriptable. I could add IPC events to this plugin that fire when the zoom/shaking is activated and deactivated. Based on that one could start and kill a hyprpicker instance (I also think there is a hyprpicker fork which only does the zooming). Or one could then also increase the cursor_zoom
for the whole monitor to zoom in onto the cursor.
Let me know what you think and whether that would be useful to you.
Thanks! I saw now the implications and how this plugin works.
Given that, maybe we can have command_when_shake =
, timeout_before_commad =
and timeout_after_commad =
(sorry for the long naming just to be clear)
So users can just build on top of these. I really hope this plugin functionality be merged to main. 😁
Okay, I've now implemented IPC events for shake on main. I think these are more extensible and practical than the config options you described, as they can easily be used from any programming language.
The IPC events need to be enabled explicitly, because they sometimes spam the socket quite a bit. You can set plugin:dynamic-cursors:shake:ipc = true
to enable them.
There are now the following events on the event socket:
shakestart
: fired when a shake startedshakeupdate
: fired on mouse move during a shake, also has four arguments: x,y,trail,diagonal
x
, y
: current mouse positiontrail
is the distance mouse has moved in the last second, and diagonal
the diagonal of the boundingbox that movement was within. These are the values that are used to detect the shake and their quotient (trail / diagonal
) indicates how "hard" the shake is. This plugin uses these values to calculate the cursor size.shakeend
: fired when a shake endedFor an example how you could use this in bash, you can copy the snippet from the wiki page, and exchange the events and commands. In this case, hyprpicker is opened when the mouse is shaken, like in your first example:
#!/bin/sh
handle() {
case $1 in
shakestart*) hyprpicker & ;;
shakeend*) pkill hyprpicker ;;
esac
}
socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done
You can also set the shake factor to 0
to disable the cursor changing size while shaking, so it doesn't interfere with your effect: plugin:dynamic-cursors:shake:factor = 0
I hope you can use these events for your stuff
Thank you this will suffice too!
@VirtCode thank you for this feature. For some reason I'm often losing track of my cursor - especially in hyprland. Your work is appreciated!
Can we also have a shake to find and don't make the cursor bigger but adding a zoom in the area (like hyprpicker )
Or atleast like adding effect like slurp
in short like windows 👉👈 as an afterthought. 😁