auto-dark-mode.nvim icon indicating copy to clipboard operation
auto-dark-mode.nvim copied to clipboard

More theme detection methods?

Open goulf-3m opened this issue 1 year ago • 6 comments

I guess the current code won't work, if I connect from a light-bg terminal in Windows to a dark-bg Linux machine and launch nvim.

How about more dark/light theme detection methods? Allow users to config, or choose the best suitable one (e.g., do not use local command to detect in a ssh session).

goulf-3m avatar Nov 30 '24 09:11 goulf-3m

:+1: to this. One of the annoyances I've had is using a root shell with nvim and it not detecting the WMs theme settings.

alexandradeas avatar Dec 13 '24 11:12 alexandradeas

light-bg terminal in Windows to a dark-bg Linux machine

I am not able to understand. How does the Linux machine background matter here?

adityamwagh avatar Jan 24 '25 04:01 adityamwagh

hi! are u suggesting adding more implementations or adding a way for u to provide your own callback to detect the theme?

f-person avatar Jan 25 '25 21:01 f-person

@alexandradeas

👍 to this. One of the annoyances I've had is using a root shell with nvim and it not detecting the WMs theme settings.

We have some logic that should handle this: https://github.com/f-person/auto-dark-mode.nvim/blob/02ef9553e2a1d6e861bc6955d58ce5883d28a6ad/lua/auto-dark-mode/init.lua#L131-L145

This should use your non-elevated user id to query the current desktop environment's dark mode.

In general, I'd advise not running neovim as root, especially with plugins, since you're handing root control over to unaudited code, prefer sudo -e when you can.

nekowinston avatar Mar 08 '25 11:03 nekowinston

#46 somewhat addresses this, by allowing the user to override how the system appearance is queried. I'll tackle that PR next after hopefully finally finishing #35 this weekend.

nekowinston avatar Mar 08 '25 11:03 nekowinston

Update regarding the running neovim as root situation, I forgot that #35 also fixed an issue there - running nvim as root via sudo, and still having it sync with your system should work now, but I still don't recommend it.

nekowinston avatar Mar 09 '25 14:03 nekowinston

hi! are u suggesting adding more implementations or adding a way for u to provide your own callback to detect the theme?

Exactly!

By the way, the only correct way of automatic bg setting is to infer the background of the active terminal emulator (even a remote one). That might be different from the current OS theme.

goulf-3m avatar May 04 '25 05:05 goulf-3m

I am happy to take some feedback on #46 if this is something that people would like :)

nickhendo avatar Aug 08 '25 04:08 nickhendo