ui: add environment variable to switch to symbolic battery icons in tray
This commit is contained in:
parent
f28da6e7c4
commit
88a0dfff6f
|
@ -110,7 +110,14 @@ your GTK icon theme.
|
|||
Solaar is not using the symbolic versions of these icons because of a bug
|
||||
external to Solaar that results in these icons not changing to the
|
||||
foreground colour in the system tray. This can leave these icons nearly
|
||||
invisible in dark themes.
|
||||
invisible in dark themes. It would be useful to be able to switch to
|
||||
symbolic icons via GTK styling (using something like
|
||||
`.solaar * { -gtk-icon-style: symbolic; }` in the user's gtk.css)
|
||||
but most or all current system tray implementations do not allow for this.
|
||||
|
||||
As a temporary hack setting the SOLAAR_TRAY_BATTERY_ICON_SYBOLIC environment
|
||||
variable will cause Solaar to use symbolic icons for battery levels in the
|
||||
system tray.
|
||||
|
||||
|
||||
[solaar]: https://github.com/pwr-Solaar/Solaar
|
||||
|
|
|
@ -203,6 +203,9 @@ try:
|
|||
battery_charging = device_status.get(_K.BATTERY_CHARGING)
|
||||
tray_icon_name = _icons.battery(battery_level, battery_charging)
|
||||
|
||||
# get around system tray icons not having styling and not having css class
|
||||
tray_icon_name = tray_icon_name + ( "-symbolic" if "SOLAAR_TRAY_BATTERY_ICON_SYBOLIC" in os.environ else "" )
|
||||
|
||||
description = '%s: %s' % (name, device_status.to_string())
|
||||
else:
|
||||
# there may be a receiver, but no peripherals
|
||||
|
@ -260,6 +263,9 @@ except ImportError:
|
|||
battery_level = device_status.get(_K.BATTERY_LEVEL)
|
||||
battery_charging = device_status.get(_K.BATTERY_CHARGING)
|
||||
tray_icon_name = _icons.battery(battery_level, battery_charging)
|
||||
|
||||
# get around system tray icons not having styling and not having css class
|
||||
tray_icon_name = tray_icon_name + ( "-symbolic" if "SOLAAR_TRAY_BATTERY_ICON_SYBOLIC" in os.environ else "" )
|
||||
else:
|
||||
# there may be a receiver, but no peripherals
|
||||
tray_icon_name = _icons.TRAY_OKAY if _devices_info else _icons.TRAY_ATTENTION
|
||||
|
|
Loading…
Reference in New Issue