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

Dim unfocused or preview cursor + extras. #941

Closed
wants to merge 9 commits into from

Conversation

ilyagr
Copy link
Collaborator

@ilyagr ilyagr commented Sep 20, 2022

This builds upon #924 and @laktak's
#861 to make lf
dim the cursor in the preview column and also dim all the cursors when lf loses focus.

This also includes #918 as well as
and some unrelated minor corrections (currently ilyagr@dd5dc59), because why not.

This is a work in progress since there is no option to disable lf requesting focus events.
Also, @laktak mentioned a preference for making cursors invisible when losing focus
(as implemented in #924). At the moment, there is no
option for that either. It's not entirely clear if there should be an option for every
conceivable preference or a smaller number of options.

In any case, I use this and like it, so I thought I would share.

ilyagr and others added 9 commits August 30, 2022 00:05
Simplify logic in ui.go. In that diff, `st` would already have the
Reversed flag set; there's no need to set it again.

Also, minor changes to remove all 3 statickcheck errors VS code's
Go extension complains about.
When preview is on and consists of a directory listing, make the
cursor in there dimmer to emphasize it's not active. This makes it
visually obvious which cursor is active at all times, without
having to read the path. The active cursor is now always  the
rightmost bright one, regardless of whether the `preview` option
is on or off.

See screenshots in the pull request at
gokcehan#924.

Before this, I noticed that I often open a file by accident because
I got confused which of the three cursors on the screen is the active
one.

In the future, I also hope this dimming could be used to show when an lf
window loses focus, based on @laktak's implementation of focus tracking
in gokcehan#861.
Reduce number of arguments to printDir and list non-configurable colors
This outputs the result of [`listBinds`] to a temporary file
and then pass it to `$PAGER`. A bit of care is taken to remove
the temporary file and refresh lf (just in case it's showing
`/tmp`).

I haven't tested it on Windows, since `lf` doesn't seem to work
on `wine`, but I think it should work there too.

It would be a bit more elegant to pipe the output directly to
`$PAGER` without a temporary file, but that would require larger
code changes, which doesn't seem worth it at the moment.

[`listBinds`]: https://github.com/gokcehan/lf/blob/e03143299d4596bbc9bb8a2d8a1b0931e3183410/ui.go#L940
This mainly merges gokcehan#924 with @laktak's
gokcehan#861. This also merges in the `:keys`
command (gokcehan#918) as well as 
and some unrelated minor corrections (currently
dd5dc59).
@ilyagr
Copy link
Collaborator Author

ilyagr commented Oct 9, 2022

FYI, I stopped using focus functionality and this code in favor of making the background of the active tmux pane slightly darker than the background color of inactive panes.

I'll keep this here in case anyone wants it for now, but I won't develop this further. (I can also close this if people prefer).

(I do very much still use the other 2 pull requests included here).

@p-ouellette
Copy link
Contributor

Could you open a separate PR for the 'Minor corrections' commit? The staticcheck errors have been bugging me too.

@ilyagr
Copy link
Collaborator Author

ilyagr commented Oct 16, 2022

@p-ouellette Done, see #967.

@gokcehan
Copy link
Owner

@ilyagr So then I'm closing this PR to keep the list clean if that's ok. Feel free to reopen or submit again if/when you are interested.

@gokcehan gokcehan closed this Oct 16, 2022
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.

4 participants