VirtCode / hypr-dynamic-cursors

a plugin to make your hyprland cursor more realistic, also adds shake to find
MIT License
72 stars 1 forks source link

[feature req] some shake to find enhancement #3

Closed kRHYME7 closed 1 week ago

kRHYME7 commented 1 week ago

Can we also have a shake to find and don't make the cursor bigger but adding a zoom in the area (like hyprpicker )
image Or atleast like adding effect like slurp image

in short like windows 👉👈 as an afterthought. 😁

VirtCode commented 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.

kRHYME7 commented 1 week ago

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. 😁

VirtCode commented 1 week ago

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:

For 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

kRHYME7 commented 1 week ago

Thank you this will suffice too!

trailjeep commented 1 week ago

@VirtCode thank you for this feature. For some reason I'm often losing track of my cursor - especially in hyprland. Your work is appreciated!