(Positioner) Allow for Screen constrained positioning when using tray-icon feature #2076
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
positioner plugin related:
This PR implements a new trait fn on the
Window
calledmove_window_constrained
, which is only available with the already existent ´tray-iconfeature. It allows to position a window based on the tray icon position, as well as the given
Tray*variants from the
Position` enum, while constraining the window to the screen, where the tray icon lives. This provides a way of positioning, which ensures the window is not clipped by the borders of the screen, when being positioned relative to the tray icon.Introducing the new method, allows the user to explicitly choose the new behavior over the old one, while maintaining BC without cluttering the
Position
enum with further options.I refactored the code a little to ensure minimal duplication and to ease the maintenance in the future of both features.
Please let me know if you want anything changed with regards to general realization or coding style.