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

FR: I'd like the prompt redrawn when the terminal with fish gains focus #77

Open
ilyagr opened this issue May 27, 2024 · 2 comments
Open

Comments

@ilyagr
Copy link

ilyagr commented May 27, 2024

I'd love the time and the current commit to be updated when I switch to a different shell.

This could be doable with the https://github.com/fish-shell/fish-shell/blob/8880fa8dd7f868f2c098b7b845caab2affc2e4f9/doc_src/language.rst?plain=1#L2095 event.

(Separately, an option to redraw the prompt every minute would also be nice. I can file a separate FR for this. #78 )

@ilyagr
Copy link
Author

ilyagr commented May 27, 2024

As far as I can tell, the following is "supposed" to work (see fish-shell/fish-shell#6394 (comment)), but doesn't with fish_async_prompt.

function fish_focus_in --on-event fish_focus_in
    commandline -f repaint
end

See also https://fishshell.com/docs/current/cmds/bind.html#special-input-functions for repaint and https://fishshell.com/docs/current/cmds/commandline.html

@ilyagr
Copy link
Author

ilyagr commented May 27, 2024

This seems to work (maybe?):

function fish_focus_in --on-event fish_focus_in
    __async_prompt_fire
    # commandline -f paint  # Not sure whether this helps or hurts.
end

Is this the correct way? I think it'd be nice if this was "officially" supported with a non-__ function.

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

No branches or pull requests

1 participant