-
Notifications
You must be signed in to change notification settings - Fork 13
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
Feature: introduce "Window Mode" for selecting windows under Hyprland #20
Feature: introduce "Window Mode" for selecting windows under Hyprland #20
Conversation
feat: add hyprland window mode support
I couldn't find a reference on the documentation for these imports existing, but apparently they stopped suddenly. Also I had to bump wgpu's and wgpu_text's versions
windows can be pre-selected by one the three options: - being focused - by cursor position - by (title, initial title, class, initial class)-matching regex
this requires a cli selection method to have been made
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general this is neat work, if you want I can address my comments myself or you can also tackle them by yourself if you wish.
Thanks for the review, @Kirottu! While I can handle most comments myself fairly quickly, I'd like to ask you for a general direction about the mouse coordinates you mentioned! |
feat: remove feature gates
…rectangle selection
I've made some commits addressing most suggestions, @Kirottu, but did leave one question about the mouse position one. Also, I didn't want to mark anything resolved because you may want to leave new comments on those ones, so feel free to "Mark resolved" whatever you feel has been correctly addressed! |
apparently hyprland tends to keep new windows at a higher position in the array, though that's not always the case
I believe I've managed to address all the review comments this time around, please double check though! Once again, thanks for all the suggestions, @Kirottu ! |
There seems to be a bit of a regression with the ability to move a rectangular selection from its center area being broken now. |
I'll take a look at it |
Should be fixed by 4190bdd |
Alright, I think this is in good enough shape to be merged now. Many thanks for the great work! |
About the PR
Resolves #4
This PR introduces two new feature flags:
window-selection
andhyprland-window-selection
. The former provides an API for compositor-specific implementations, while the latter is an implementation for Hyprland.The
window-selection
feature allows for a new mode to be used, "Window Mode", which no longer allows for the mouse to draw selections, but rather to have the selection be drawn around clicked windows (much similar to how "Monitor Mode" works).Tab's cycle order for mode is now Display → Window → Rectangle. Additionally, going from "Window Mode" to "Rectangle Mode" preserves the selection around the last selected window. It's worth noting that this is only true when the flag is enabled, otherwise all remains the same.
In addition to this mode, new command line options are introduced to allow for a non-interactive usage of the program. Although it was noted on #4 that one should use
grim
directly when interactiveness is not desired, now that the program is able to find windows I think this becomes relevant again. The command line options are mutually exclusive and listed below:--active-window
: Pre-selects the currently focused window;--window-under-cursor
: Pre-selects the window that's under the cursor. This may be different than focused window depending on the user's compositor and settings, but for Hyprland they yield the same results;--window-search
: Pre-selects the first window that matches a condition. The condition is made up of a search parameter and a search value. The search parameter can be the window's title, class, initial title or initial class. The search value is a regex which will be matched against the search paramenter;While these 3 mutually exclusive options work fine for interactive work (i.e. the program's default behavior), they can be used along with the new CLI argument
--auto-capture
to allow for non-interactive window capturing. For example, a simple command to capture the currently focused window can be achieved withwatershot --active-window --auto-capture directory ~/Pictures
.Extras
This PR also updates the
wgpu
andwgpu_text
dependencies. Rustc kept complaining thatwgpu_text::section
andwgpu_text::font
didn't exist and, while I couldn't find any PR mentioning this change, I could find that the re-exports for what was used in this project were available underwgpu_text::glyph_brush
.Closing Note
I've tried my best to abstract away the Hyprland-specific stuff under generic APIs so that others can implement the same functionalities for Sway, GNOME, etc. without having the re-invent the wheel. I hope that it achieves its goal!