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

Last active layout #759

Merged
merged 10 commits into from
Jan 10, 2024
Merged

Last active layout #759

merged 10 commits into from
Jan 10, 2024

Conversation

urob
Copy link
Contributor

@urob urob commented Jan 9, 2024

  • refactor Workspace to use SetLayoutEngine for setting the active layout engine
  • keep track of prevLayoutEngineIndex
  • new method to activate previously active layout
  • rename UpdateLayoutEngine to CycleLayoutEngine -- this made more sense to me, but happy to revert if this isn't consensus
  • rename TrySetLayoutEngine to SetLayoutEngineFromName -- this made more sense to me, but happy to revert if this isn't consensus

@urob
Copy link
Contributor Author

urob commented Jan 9, 2024

Motivation:

    context.CommandManager.Add(
            identifier: "toggle_focus_layout",
            title: "Toggle focus layout",
            callback: () =>
            {
                if (context.WorkspaceManager.ActiveWorkspace.ActiveLayoutEngine.Name == "Focus")
                {
                    context.WorkspaceManager.ActiveWorkspace.LastActiveLayoutEngine();
                }
                else
                {
                    context.WorkspaceManager.ActiveWorkspace.SetLayoutEngineFromName("Focus");
                }
            }
    );

Copy link

codecov bot commented Jan 9, 2024

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (87b0a82) 81.21% compared to head (69b43f2) 81.12%.

Files Patch % Lines
src/Whim/Workspace/Workspace.cs 60.00% 8 Missing and 2 partials ⚠️
...c/Whim.Bar/ActiveLayout/NextLayoutEngineCommand.cs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #759      +/-   ##
==========================================
- Coverage   81.21%   81.12%   -0.10%     
==========================================
  Files         191      191              
  Lines       10009    10011       +2     
  Branches     1123     1126       +3     
==========================================
- Hits         8129     8121       -8     
- Misses       1757     1765       +8     
- Partials      123      125       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/Whim/Workspace/Workspace.cs Outdated Show resolved Hide resolved
src/Whim/Workspace/Workspace.cs Outdated Show resolved Hide resolved
src/Whim/Workspace/Workspace.cs Outdated Show resolved Hide resolved
src/Whim/Workspace/Workspace.cs Outdated Show resolved Hide resolved
src/Whim/Workspace/Workspace.cs Outdated Show resolved Hide resolved
@dalyIsaac dalyIsaac added enhancement New feature or request core Whim labels Jan 9, 2024
Copy link
Contributor Author

@urob urob left a comment

Choose a reason for hiding this comment

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

I wasn't fully sure when we need to lock access to the properties. When you do your final review, can you double check for all the refactored methods whether we have all locks needed and/or can omit some of them?

src/Whim/Workspace/Workspace.cs Show resolved Hide resolved
@urob
Copy link
Contributor Author

urob commented Jan 9, 2024

I addressed most of the comments. Open issues:

  • Should we omit [Previous|Next]LayoutEngine? See Last active layout #759 (comment)
  • Naming of LastActiveLayoutEngine and (if not omitted) of [Previous|Next]LayoutEngine. See same comment for suggestions
  • Double check whether locks are as needed

@urob urob force-pushed the last-active-layout branch from 75b5b71 to 69b43f2 Compare January 10, 2024 16:37
@urob
Copy link
Contributor Author

urob commented Jan 10, 2024

Rebased on current main. Only the one question left about depreciating the remaining occurrence of NextLayoutEngine in WorkspacaeManagerTests.cs

@dalyIsaac dalyIsaac merged commit 83917cb into dalyIsaac:main Jan 10, 2024
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Whim enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants