Welcome to Vifm Q&A, where you can ask questions about using Vifm. Registration is optional, anonymous posts are moderated. E-mail and GitHub logins are enabled.
0 votes
in vifm by

Probably via OSC 10/11 or similar.

Use case: user switches theme on the fly (well-supported in GTK3/4, QT5/6, vim/neovim, many terminal emulators, etc).

2 Answers

0 votes
by

OSC 10/11

It requires processing terminal's response. Vifm never does this right now, curses is handling all input and I don't think it distinguishes such responses from normal input. However, a sychronous request/response may be possible (needs to be tried).

0 votes
by

I’m not sure how you switch between light and dark themes, but if you are able to set an environment variable while doing so, you could add the following to your Vifm config:

if $IS_DARK_THEME == '1'
  colorscheme Default
else
  colorscheme dwmlight
endif
by

Ended up with:

let $theme_state = system('cat "' . $HOME.'/.cache/theme_state' . '" | tr -d "\n"')
if $theme_state == 'dark'
  colorscheme dark
else
  colorscheme dark
endif

Works like a charm!

If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here is acceptable, but this is not a perfect place for them.
...