Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanded examples #237

Merged
merged 7 commits into from
Jun 4, 2024
Merged

Expanded examples #237

merged 7 commits into from
Jun 4, 2024

Conversation

joshurtree
Copy link
Contributor

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
Copy link
Member

yavko commented Jun 1, 2024

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

@yavko yavko linked an issue Jun 1, 2024 that may be closed by this pull request
Copy link
Member

@yavko yavko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes needed

Cargo.toml Outdated Show resolved Hide resolved
examples/bind.rs Outdated Show resolved Hide resolved
examples/bind.rs Outdated Show resolved Hide resolved
examples/data.rs Outdated Show resolved Hide resolved
examples/dispatch.rs Show resolved Hide resolved
examples/dispatch.rs Outdated Show resolved Hide resolved
examples/exec.rs Outdated Show resolved Hide resolved
examples/keyword.rs Outdated Show resolved Hide resolved
examples/keyword.rs Outdated Show resolved Hide resolved
* Merged exec.rs into dispatch.rs
* Removed return statements
* Cleaned up keyword.rs and panic when no arguments specified
* Change async examples to single threaded (Don't need the overhead)
* Used rt and macros features in tokio instead of full
examples/dispatch.rs Outdated Show resolved Hide resolved
examples/dispatch.rs Outdated Show resolved Hide resolved
examples/keyword.rs Outdated Show resolved Hide resolved
* Stopped using kitty as default program to open for dispatch example
* Panics if keyword example recieves over 2 arguments
@yavko yavko merged commit 3e74462 into hyprland-community:master Jun 4, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better and More Examples
2 participants