Skip to content

Switch monochrome systray icon color depending on systray brightness#2393

Merged
dragotin merged 1 commit intoowncloud:masterfrom
svkurowski:issue-2215
Oct 29, 2014
Merged

Switch monochrome systray icon color depending on systray brightness#2393
dragotin merged 1 commit intoowncloud:masterfrom
svkurowski:issue-2215

Conversation

@svkurowski
Copy link
Copy Markdown
Contributor

I am working on issue #2215 in this branch.

As of version 10.10 Yosemite, Mac OS X offers the user the option to use a dark version of the dock and menu bar. The systray icon was black even on the dark menu bar black-on-dark, thus rendering it nearly impossible to spot.

This patch checks the NSUserDefaults to check whether the user has chosen the black dock and if so, will use the white monochrome versions for the systray icons.
White icon on dark menu bar: white-on-dark

Right now, the systray icon will not change "live", that is it will stay in the old color when the user changes the dock/menu bar brightness during execution of the app until either the icon image changes (because of state change) or the app is restarted.

The patch needs to be tested on Unix and Windows systems, unfortunately I don't have a development machine setup for those operating systems at the moment. The systray icon behaviour should be unchanged for those operating systems and for earlier versions of OS X.

#2215

As of version 10.10 Yosemite, Mac OS X offers the user the option to use
a dark version of the dock and menu bar. The systray icon was black even
on the dark menu bar, thus rendering it nearly impossible to spot.
@dragotin
Copy link
Copy Markdown
Contributor

I like the patch, thanks for caring!
Questions:

  • Do we have the black icons already?
  • The implementations of hasDarkSystray_private() for Linux and Windows are never really used, right?

Overall 👍

@svkurowski
Copy link
Copy Markdown
Contributor Author

Previous Behaviour:

  • Mac Systems always used the black icons, because the menu bar was always in a light color (usually a light gray). So yes, the black icons were already included
  • Windows and Unix Systems always used the white icons

New Behaviour:

  • Mac Systems will use black icons, unless the user is on OS X 10.10 Yosemite and has selected the dark dock / menu bar in general settings (System Preferences.app, not in owncloud.app), in which case the white icons will be used
    screen-shot
  • Windows and Unix Systems will use the white icons

Regarding the use of hasDarkSystray_private():
Obviously those functions will also get called on windows and unix respectively, however because they always return true; any decent compiler will optimize them (and probably also the calling of the ternary conditional operator) away when compiling for production. However, this implementation allows for easy switching of monochrome colors on other systems too. Imagine Gnome implementing an option to have a white menu bar - it will be very easy to adjust to that (as long as we're able to differ a systems running Gnome from one running, say, KDE).

@karlitschek
Copy link
Copy Markdown

@dragotin Got the contributor agreement

dragotin added a commit that referenced this pull request Oct 29, 2014
Switch monochrome systray icon color depending on systray brightness
@dragotin dragotin merged commit ef16c40 into owncloud:master Oct 29, 2014
@wagnerand
Copy link
Copy Markdown

Would you mind backporting this to the 1.7 branch, please?

@svkurowski
Copy link
Copy Markdown
Contributor Author

Sorry for the delay. I cherry-picked the commit into the 1.7 branch in 01a7212

@danimo
Copy link
Copy Markdown
Contributor

danimo commented Feb 5, 2015

Why? there will be no 1.7 release, and 1.8 is pending.

@svkurowski
Copy link
Copy Markdown
Contributor Author

I was not aware of that. It doesn't hurt though I guess. If you want me to, however, I can revert it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants