-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change tray icon color based on system tray color #1694
Conversation
@real-yfprojects Could you please cross check and review these changes once. |
No need to notify individual people. Someone will see it in time and review it. |
Ok, Thanks! |
src/vorta/tray_menu.py
Outdated
@@ -73,10 +73,19 @@ def build_menu(self): | |||
exit_action = menu.addAction(self.tr('Quit')) | |||
exit_action.triggered.connect(self.app.quit) | |||
|
|||
def is_taskbar_dark(self): | |||
app = QApplication.instance() | |||
system_tray_color = int(QScreen.grabWindow(app.primaryScreen()).toImage().pixel(0, 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's possible to create the task bar icon and then record it's color only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only works if the task bar is on top. So it's true for Mac and Gnome, but not everywhere.
I can check which os it's using and check for tray color on either top or bottom based on it.
It also triggers a privacy warning on Mac.
It didn't on mine for some reason.
Maybe it's possible to create the task bar icon and then record it's color only?
Any ideas on how can I create the initial icon to have a contrasting color to the tray color?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can check which os it's using and check for tray color on either top or bottom based on it.
KDE Plasma allows the task bar to be on any edge of the screen and it can be shorter than the edge it sits on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KDE Plasma allows the task bar to be on any edge of the screen and it can be shorter than the edge it sits on.
Oh, Then I think I might have to find another way to locate and scan the tray color.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But there's a slight issue, they only work as black and white so the coloured dots which represented the backing up of data in progress don't render in colours and instead just render as white or black.
Can we somehow determine how a template tray icon was rendered and extract information about the tray through that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively we could add a setting and let the user pick the tray colour manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose template images do not work in Linux. Let's first add the code for MacOs and think about linux later.
Are linux system tray's theme also based on the desktop wallpaper or they follow the system's theme?
Can we somehow determine how a template tray icon was rendered and extract information about the tray through that?
I tried that but the colour change is based on the system os as the template is a transparent image only having information about the dimensions and the shape and when trying to extract its colour by converting the current qicon to a pixmap and checking the colour of a pixel on there returns same for both light and dark icons.
Alternatively we could add a setting and let the user pick the tray colour manually.
Yes we can do that as well, but that too will require some logic to check if the selected colour is in range of the dots indicating the working of vorta while backing and converting them to some different colour.
I'll check further into these and let you know if I find any alternatives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are linux system tray's theme also based on the desktop wallpaper or they follow the system's theme?
Usually they follow the system theme, but on KDE you can use custom themes that can customize every single bit of the appearance.
Yes we can do that as well, but that too will require some logic to check if the selected colour is in range of the dots indicating the working of vorta while backing and converting them to some different colour.
This might actually be the best solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might actually be the best solution.
I think so. I'll work on that after I get home in a few days.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Are you still working on this @i1sm3ky? |
Hey there! Sorry for the delay. Actually I was a little confused as per which solution to implement, also I was on a vacation and I'll be heading to my university in the first week of august then I can start implementing the solution. Could you please confirm which solution will be better to implement? |
I think this is were we left of:
That would be neat. However if you find that this is too complicated you can simply add a setting for toggling the icon between dark and light mode. |
I think I can do that, I'll start working on it as soon as possible. |
@real-yfprojects I've a few questions.
|
Settings are defined in vorta/src/vorta/store/settings.py Line 7 in f27c653
vorta/src/vorta/store/models.py Line 204 in f27c653
vorta/src/vorta/store/connection.py Lines 90 to 102 in f27c653
The widgets are generated in vorta/src/vorta/views/misc_tab.py Line 56 in f27c653
|
Thanks for the help. Should the option to change the icon color be added in the misc tab? |
That would be great! |
Description
This PR changes tray icon color based on the system tray color which increases the contrast between the tray icon and the system tray.
Related Issue
Issue: #1220 requesting for white icons for menu bar on MacOS
Motivation and Context
This change provides white icons for dark themed Gnome based linux and MacOS which look better as solid white icons instead of the dark black ones.
How Has This Been Tested?
I've run and tested these icons and they look more native than the previous one.
This change doesn't affect any other part of the code.
Screenshots:
Types of changes
Checklist:
I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.