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 on-redraw hook command #1479

Merged
merged 2 commits into from
Oct 29, 2023
Merged

Add on-redraw hook command #1479

merged 2 commits into from
Oct 29, 2023

Conversation

joelim-work
Copy link
Collaborator

@joelim-work joelim-work commented Oct 23, 2023

This seems like a nice feature to have, I guess nobody got around to actually implementing this.

tcell.EventResize events will eventually call the redraw command, and I think it might be useful to apply the hook on redraws as opposed to resizes, for instance if the user wants to trigger the hook manually using <c-l>.

Below is an example, which even triggers upon startup:

cmd on-redraw %{{
    if [ $lf_width -le 80 ]; then
        lf -remote "send $id set ratios 1:2"
    elif [ $lf_width -le 160 ]; then
        lf -remote "send $id set ratios 1:2:3"
    else
        lf -remote "send $id set ratios 1:2:3:5"
    fi
}}

@joelim-work joelim-work merged commit b3cb2dc into gokcehan:master Oct 29, 2023
@joelim-work joelim-work deleted the on-redraw branch October 29, 2023 22:40
@gokcehan gokcehan mentioned this pull request Mar 31, 2024
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.

Keep leftmost columns at constant width/execute script on window resize?
2 participants