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

Add auto-hide options and other fixes #1

Merged

Conversation

stefanhaller
Copy link
Contributor

  • Add config options to auto-hide the panel and the side bar when activating lazygit
    • Useful if you have a small screen and prefer lazygit to take up all the available space
    • Ideally it would remember the visibility of the side bar and panel and restore it when lazygit is hidden, but I couldn't figure out how to do that...
  • Make the lazygitPath config show up in the settings view
  • Make showing/hiding the lazygit tab a little more reliable (hopefully)

I like this because it lets me press Command-S in VS Code and have it
auto-format the code nicely. It might be controversial though when other people
prefer different auto-formatters.
This solves the problem that the variable could run out of sync when hiding the
lazygit window by manually activating a different editor tab; in this case the
extension would still believe that lazygit was active. We could solve this by
implementing onDidChangeActiveTextEditor() to catch this, but why: if we can
determine our visible state without having to remember it, that's better.
import * as vscode from "vscode";
import * as fs from "fs";
import * as os from "os";
import { exec } from "child_process";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I realize that formatting is always a matter of taste; I'm happy to drop this commit if you don't like it.

@tom-pollak tom-pollak merged commit 1083b9e into tom-pollak:main Jul 9, 2024
@tom-pollak
Copy link
Owner

lgtm, thanks!

@stefanhaller stefanhaller deleted the add-auto-hide-options-and-other-fixes branch July 9, 2024 18:48
@tom-pollak
Copy link
Owner

I was a bit hasty -- without the isLazyGitVisible toggling isn't working for me correctly. I'll have a look at this more and clean up my code tomorrow

@tom-pollak
Copy link
Owner

tom-pollak commented Jul 9, 2024

in the 0.0.6 version is the side panels still being hidden? I think I might of messed up versioning but it doesn't happen on my machine anymore

toggling-lg.mp4

@stefanhaller
Copy link
Contributor Author

I was a bit hasty -- without the isLazyGitVisible toggling isn't working for me correctly. I'll have a look at this more and clean up my code tomorrow

I would be curious under what conditions it doesn't work for you, can you describe a scenario? I'm not sure if the video that you posted is supposed to demonstrate this, but I can't quite see what you mean.

in the 0.0.6 version is the side panels still being hidden?

I feel there must be a misunderstanding here. I wasn't trying to report or fix a bug here, I was trying to implement a feature that I want to have. I can open a new PR for that once we sorted out the isLazyGitVisible thing.

@tom-pollak
Copy link
Owner

ah I misread here. there was a bug in a previous version where toggling lazygit would also toggle the terminal and side bar.

you can disregard my previous comment, I'll have a better look at the PR tomorrow.

@stefanhaller
Copy link
Contributor Author

Just to explain again what bug I was trying to fix with the removal of the isLazyGitVisible variable:

  • press Cmd-Shift-L to show lazygit
  • within lazygit, press e on a file to edit it; this opens the file in another VS Code tab, but the isLazyGitVisible variable is still true
  • pressing Cmd-Shift-L now switches to whatever tab is left of the one you just switched to with e, you need to press Cmd-Shift-L a second time to show lazygit again.

This is just one example of where things run out of sync (but a very common one for me), there are many others.

My hope was that we could fix this whole class of problems by not keeping track of whether lazygit is visible, but instead determine it dynamically at the moment we need to know. Again, I'd be interested in scenarios where this didn't work correctly for you.

@tom-pollak
Copy link
Owner

done, isLazyGitVisible is removed (and untoggling capability, turns out to be more effort than its worth). 0.0.7 should have the changes

@stefanhaller
Copy link
Contributor Author

Nice, this is a big improvement. I opened a new PR for the auto-hide feature: #2

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.

2 participants