You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable OS dark mode (System Settings > Appearance > Dark)
Verify: defaults read -g AppleInterfaceStyle # => Dark
Check MacVim value mvim --clean +'echo v:os_appearance' # => 0
Can be replicated by opening the app outside of the terminal and typing :echo v:os_appearance
Expected behaviour
MacVim echoes 1
Version of Vim and architecture
MacVim r179 (Vim 9.1.0), arm64
Environment
macOS Sonoma 14.3.1 (23D60) arm64
iTerm2 3.5.0beta20
zsh 5.9 (x86_64-apple-darwin23.0)
How MacVim was installed
Homebrew
Logs and stack traces
No response
Vim configuration where issue is reproducable
No response
Issue has been tested with given configuration
by running MacVim.app from GUI macOS interface
by running vim/gvim/etc installed by MacVim
by running other versions of vim (e.g. /usr/bin/vim)
Issue has been tested with no configuration
by running mvim --clean (or gvim, supplied by MacVim distribution)
by running vim --clean (in terminal, supplied by MacVim distribution)
by running vim --clean (in terminal, other suppliers, e.g. /usr/bin/vim)
Other conditions
The both Homebrew packages "vim" and "macvim" are installed
Hi @halilim , after looking more into it, I think the API is working as designed. MacVim is reading the appearance mode of its own window, which will be the OS appearance mode if you have "Dark mode selection" set to "Automatic" in Settings->Appearance. If you have manually overridden it to "Light mode"/"Dark mode"/"Use 'background' option" then MacVim will always report the mode that is being set there instead of the OS one.
Since I think the current behavior mostly makes sense, and that this has been how it works for a while, I'm not too inclined to change the behavior. Can you describe what you are trying to use it for? Meanwhile I can update the documentation to make it clearer exactly what v:os_appearance is reporting.
I can definitely see some edge cases where you may want to rely on "Use 'background' option" in the setting, but still be able to query the OS appearance mode, so I could see some ways the current behavior is problematic.
Hi @ychin, thank you for your response. I was using the macOS dark mode setting. I completely forgot about the dark mode setting of the app itself, which was set to Use 'background' option. I now set it to Automatic, and it works perfectly fine. I'm sorry for taking your time, thank you again. (FWIW, I use this for mode change automation via OSAppearanceChanged).
Activity
ychin commentedon Feb 13, 2024
That's weird. Seems like it got broken somehow. May need to bisect this and add a test for it. Thanks for reporting.
ychin commentedon Feb 19, 2024
Hi @halilim , after looking more into it, I think the API is working as designed. MacVim is reading the appearance mode of its own window, which will be the OS appearance mode if you have "Dark mode selection" set to "Automatic" in Settings->Appearance. If you have manually overridden it to "Light mode"/"Dark mode"/"Use 'background' option" then MacVim will always report the mode that is being set there instead of the OS one.
Since I think the current behavior mostly makes sense, and that this has been how it works for a while, I'm not too inclined to change the behavior. Can you describe what you are trying to use it for? Meanwhile I can update the documentation to make it clearer exactly what
v:os_appearanceis reporting.I can definitely see some edge cases where you may want to rely on "Use 'background' option" in the setting, but still be able to query the OS appearance mode, so I could see some ways the current behavior is problematic.
halilim commentedon Feb 19, 2024
Hi @ychin, thank you for your response. I was using the macOS dark mode setting. I completely forgot about the dark mode setting of the app itself, which was set to
Use 'background' option. I now set it toAutomatic, and it works perfectly fine. I'm sorry for taking your time, thank you again. (FWIW, I use this for mode change automation viaOSAppearanceChanged).Dark mode improve docs for v:os_appearance and add tests