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

Possibility of refreshing terminfo cache? #2749

Open
zhiayang opened this issue Jan 31, 2024 · 4 comments
Open

Possibility of refreshing terminfo cache? #2749

zhiayang opened this issue Jan 31, 2024 · 4 comments
Assignees
Labels
userquestion not quite bugs--inquiries from users

Comments

@zhiayang
Copy link

Is it possible to ask notcurses to refresh its internal terminfo cache during runtime? From what I can tell, it's only done by interrogate_terminfo during initialisation, and never again.

It's definitely slow, and I don't intend on doing it every frame, but the usecase for me is that sometimes the default background/foreground colour can change due to the terminal theme changing, and I'd like the program to respond to the changes without a restart --- even if it's not instantaneous (eg. if I restrict myself to reloading terminfo every second or something).

@zhiayang zhiayang added the userquestion not quite bugs--inquiries from users label Jan 31, 2024
@dankamongmen dankamongmen self-assigned this Jan 31, 2024
@dankamongmen
Copy link
Owner

so this has been a definite consideration for some time. i thought that several terminals generate a sequence to notify the application of this, but maybe that's just something i imagined, or asked for? i'd need to go look.

if there's no sequence generated, ideally such a change would result in a SIGWINCH. upon receipt of a SIGWINCH, we query the screen dimensions, and could theoretically query the back/foreground then, eliminating the need to poll (i'm definitely not adding notcurses-level support for polling). i suppose i could expose the initial queries to the app for it to run in a loop, but i really, really dislike that idea.

let me look around see whether i'm just hallucinating about a sequence sent by the terminal. if i am, i'll consider adding this to SIGWINCH handling, but i'd probably hide it behind a non-default notcurses_init() option. the big problem is that if we're going to blindly query these, we logically ought query the palette as well, which is a big nasty operation (O(n) on the size of the palette).

@zhiayang
Copy link
Author

fwiw i'm using wezterm -- after a quick glance at the code, it doesn't seem like there's any special event being sent to the running program. I'm using window:set_config_overrides to change the colour_scheme via the lua api.

@dankamongmen
Copy link
Owner

the idea of the app polling this really makes me want to vomit. let me look back over my emails; i know i wanted a solution to this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
userquestion not quite bugs--inquiries from users
Projects
None yet
Development

No branches or pull requests

3 participants