ags icon indicating copy to clipboard operation
ags copied to clipboard

Add support for hyprland's new IPC event since v0.37.0 and change 'switch case' to map

Open A7R7 opened this issue 1 year ago • 2 comments

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.

A7R7 avatar Mar 27 '24 03:03 A7R7

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

Aylur avatar Mar 27 '24 14:03 Aylur

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

A7R7 avatar Mar 27 '24 16:03 A7R7