macvim-dev / macvim

Vim - the text editor - for macOS
https://macvim.org
Vim License
7.47k stars 680 forks source link

Option for disabling window shadows #1301

Closed VonbatenBach closed 1 year ago

VonbatenBach commented 1 year ago

Hi, I've been wondering if it would be possible to add an option in Preferences tab to additionally tweak appearance of the macvim windows. We already have options for transparent titlebars and removing them. It would be nice to have an option to disable default macOS shadows around edges of an active window. I don't know whether it is even possible, but these shadows are often irritating when we place a macvim window near a pdf viewer for instance. Sometimes it would be much better to have a "cleaner", more minimalistic appearance.

eirnym commented 1 year ago

StackOverflow recommends WinBuddy macforge plugin for removing shadows from windows

Also, it's notable to cite a comment under the answer I found

BTW some tools like iTerm2 tries to disable this, " /! Disables shadows on all windows. / kCGSDebugOptionNoShadows = 0x4000, " but apple decided at some point, no, everyone likes shadows. All the tools seem to try the same approach and hence they are all bust

VonbatenBach commented 1 year ago

Yeah, the problem is that these projects (basically relying on MacForge) seem to be not developed anymore and they rely on changing parameters "externally". I've been wondering whether it is possible to change such properties of windows from the level of source code of a given app.

eirnym commented 1 year ago

The mentioned comment shows, that it set in iTerm2, but doesn't work

eirnym commented 1 year ago

Tested the latest iTerm2 on Monterey (12.6) and I see shadows having any option set.

eirnym commented 1 year ago

I'm not against the option, just I prefer not to have this option if it won't work.

ychin commented 1 year ago

Wow I have to say eventually for every single flag on an NSWindow there will be someone filing an issue requesting for it to be configurable haha.

Tested the latest iTerm2 on Monterey (12.6) and I see shadows having any option set. I'm not against the option, just I prefer not to have this option if it won't work.

There is clearly a supported option to do this (https://developer.apple.com/documentation/appkit/nswindow/1419234-hasshadow?language=objc).

Those threads talking about using MacForge etc are talking about how to do this globally and disabling other apps' shadows. If the app voluntarily do this there shouldn't be an issue.

Let me think more about this but I don't see any reason why I wouldn't add it, as its impact is small. If nothing goes wrong this will probably go into the next release.

VonbatenBach commented 1 year ago

This would be great! :)

eirnym commented 1 year ago

@ychin Nevertheless, I was unable do disable shadows on my macOS instance

ychin commented 1 year ago

Nevertheless, I was unable do disable shadows on my macOS instance

Sure, but I think that's because you are trying to change another app's shadows, not an app voluntarily doing so. The OS is blocking the ability to modify another app's behavior, for bitter or worse. In this case we are voluntarily saying we don't want drop shadows which is fine and supported by the API. I just committed the option to do this, feel free to try it out.