Skip to content

v:os_appearance doesn't match system #1479

Closed as not planned
Closed as not planned

Description

@halilim

Steps to reproduce

  1. Enable OS dark mode (System Settings > Appearance > Dark)
  2. Verify: defaults read -g AppleInterfaceStyle # => Dark
  3. 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

Activity

  1. ychin commented on Feb 13, 2024

    @ychin
    Member

    That's weird. Seems like it got broken somehow. May need to bisect this and add a test for it. Thanks for reporting.

  2. added this to the Release 180 milestone on Feb 13, 2024
  3. ychin commented on Feb 19, 2024

    @ychin
    Member

    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.

  4. halilim commented on Feb 19, 2024

    @halilim
    Author

    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).

  5. removed this from the Release 180 milestone on Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions