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

Improves-snap-ergonomics #1578

Draft
wants to merge 65 commits into
base: main
Choose a base branch
from

Conversation

jaresty
Copy link
Contributor

@jaresty jaresty commented Oct 20, 2024

This implements a few changes:

  1. The window with focus will be the first one spoken with all layouts now
  2. Speaking the layout alone ('snap clock' or similar) will rotate the focused windows in focus the top number in the spoken layout name
  3. Unusable layouts cannot be spoken. There are now two lists: one for layouts that are valid in pairs, one that is a list for layouts that are valid in trios.
  4. Added a grammar for snapping application windows or windows by stack order to specific places in a layout. You can say "snap clock app1 app2 third" to snap into a clock arrangement with windows one and two from apps 1 and 2 and the third window being the third from the top from when you spoke the command.
  5. Added a "gap" layout item which can be used to insert spaces in a layout. Say "snap clock gap app1" to place app1 in the top right.

jaresty and others added 6 commits October 19, 2024 19:25
There are two kinds of valid layouts:
- layouts that are pairs
- layout that are trios

While there maybe layout arrangements that are greater than twos and threes, it's difficult to say the number of applications required to trigger those layouts.
- now if you say 'snap clock' twice in a row it will rotate the focused window
jaresty and others added 22 commits October 19, 2024 21:26
- If you say 'snap first split' it will split without changing the order
- If you say 'snap third clock' will swap the third window with the first, so you can repeat to swap them back
- This requires a little bit more manual finesse than the previous version but it does allow you to snap specific applications and leave others alone. If you say, 'snap clock code', for example, it won't affect anything but the code windows. You can say, 'snap clock code all' to effect windows after code by appending all other windows after the code windows. If you say, 'snap clock' alone it will continue to rotate the windows as before.
- There might be a better approach, but this will at least try to snap all windows specified.  (ran into an unresizable window in zoom)
- If a snap error happens, it will continue trying to snap
- Struggled to maintain rotate behavior, but it seems to be working presently
- Next need to reset this variable when focus is done by other means
- Calling focus has a delay so, we have to wait until the function is done before we can be sure that we can start listening for events again
Copy link
Collaborator

@nriley nriley left a comment

Choose a reason for hiding this comment

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

From the community backlog session: we had a few specific comments on your implementation but are not sure the complexity of this implementation it's something we want to have in community.

core/windows_and_tabs/window_snap.py Outdated Show resolved Hide resolved
core/windows_and_tabs/window_snap.py Outdated Show resolved Hide resolved
core/windows_and_tabs/window_snap.py Outdated Show resolved Hide resolved
core/windows_and_tabs/window_snap.py Outdated Show resolved Hide resolved
core/windows_and_tabs/window_snap.py Outdated Show resolved Hide resolved
core/windows_and_tabs/window_management.talon Outdated Show resolved Hide resolved
@jaresty jaresty requested a review from phillco November 2, 2024 21:50
@jaresty
Copy link
Contributor Author

jaresty commented Nov 6, 2024

@nriley I see that you marked this as a draft - I'm not planning to change any more unless I get feedback to do so. Is it ok to mark it ready for review now?

@nriley
Copy link
Collaborator

nriley commented Nov 6, 2024

@nriley I see that you marked this as a draft - I'm not planning to change any more unless I get feedback to do so. Is it ok to mark it ready for review now?

Sure! We just wanted to separate it out during our review session as it was still being worked on.

@jaresty
Copy link
Contributor Author

jaresty commented Nov 6, 2024

Thanks! I heard from @phillco that I do still have some feedback coming so I'll wait until we meet to discuss.

- There was a concern that some people might want to rename these position names
- This allows for renaming them in one location without breaking the other functionality

ctx = Context()

ctx.lists["user.window_split_positions"] = SPLIT_POSITIONS.keys()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Move this to the top right after defining it on the module

else:
target_length = len(filter_nonviable_windows(ui.windows()))
if number_small is not None:
return SPLIT_POSITIONS[window_split_positions][number_small]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's copy this here

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.

3 participants