hyprland-community / hyprland-rs

An unofficial rust wrapper for hyprland's IPC [maintainers=@yavko,@cyrinux]
Other
235 stars 52 forks source link

Expanded examples #237

Closed joshurtree closed 3 months ago

joshurtree commented 3 months ago

I have created a number of example binaries expanding on the existing example code. They are now using the build in cargo example framework so are run using

cargo run --example example_name <arguments>

Asynchronous versions end with _async. Usage instuctions and example usage is given in comments at the top of each source file. I've tried where possible to make them interactive so that the user can add arguments to test out different scenarios as needed. Otherwise I have put in several different examples utilizing different flags/features.

A couple of issues cropped up during the creation of the examples. The first was due to a change in the way I invoked Tokio. In order to continue to pass hyperland::Result<()> out without extra coding I had to use the main decorator. This requires the "full" feature to be implemented in the Tokio dependency.

The second issue appears to be a bug in the library. I couldn't get the hyprland::bind macro to work. No key binding is made. Upon invesigation I found that a forward slash is added (by CommandContent) before the dispatch part of the bind which breaks it. I put in a fix which appears in the final commit but if you want to solve it a different way then I can just roll that commit back.

yavko commented 3 months ago

Omg thx so much, this was one of the things I needed to do, but really didn't want to lol