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

Dispatchers #11

Open
mbpowers opened this issue Nov 18, 2023 · 3 comments
Open

Dispatchers #11

mbpowers opened this issue Nov 18, 2023 · 3 comments
Labels
feature A new feature help wanted Extra attention is needed

Comments

@mbpowers
Copy link
Contributor

I'm here to show interest in dispatchers being added.

I was thinking a good start might be adding a instance.dispatch() that takes in a string using the same syntax as hyprctl. This would allow users to access all dispatchers whether or not hyprpy has them implemented yet.

If this plan sounds good and I have time I may shoot over a PR.

@ulinja
Copy link
Owner

ulinja commented Dec 16, 2023

Hey @mbpowers, apologies for the late reply, life got in the way.
That sounds like a great start, feel free to implement and shoot it over if you are still interested in this! Would be much appreciated.

@mbpowers
Copy link
Contributor Author

no worries at all, just got some free time myself :]
#12

@ulinja
Copy link
Owner

ulinja commented May 11, 2024

The proposed instance.dispatch() method was merged as of 82acd79, which allows sending generic disptachers to the hyprland instance:

from hyprpy import Hyprland

instance = Hyprland()
most_recent_window = instance.get_windows()[-1]
instance.dispatch(["closewindow", f"address:{most_recent_window.address}"]) # Closes the window

I'd love to flesh out dispatchers more in the future, such that the above example becomes:

from hyprpy import Hyprland

instance = Hyprland()
most_recent_window = instance.get_windows()[-1]
most_recent_window.close() # Closes the window

I currently don't have much time to implement this myself, so any help would be greatly appreciated if anyone's interested!

@ulinja ulinja added help wanted Extra attention is needed feature A new feature labels May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants