Add support for hyprland's new IPC event since v0.37.0 and change 'switch case' to map
This pr changes the 'switch case' code structure to a Map of events to callbacks, which will slightly improve performace and make it convenient for the following changes.
On top of that, it adds support for hyprland's new IPC event since v0.37.0.
If Hyprland's version is greater than v0.37.0 (if the commit date is after 2024-3-16), then
workspacev2, createworkspacev2, destoryworkspacev2, movewindowv2, moveworkspacev2
is listend instead of their non-v2 versions.
Note that under createworkspacev2 and destoryworkspacev2, workspace-added and
workspace-removed signal return workspace's id, not name.
the performance difference between a map and a switch statement should be insignificant, while the switch statement is a lot more readable
I think its fine to just update the events to v2 and the signals type to ['int', 'string'] without checking Hyprland versions
I've dropped backward compatibility support. Also, I've made another pr #367, which does not change the original switch case structure. You may choose one to merge :D