[core/theme] Add option to override iconset + add experimental icons

Add an option to load a user-specified icon theme (which will override
the theme's icons).

Also, commit a first version of a set of icons from the ionicons set
(see http://ionicons.com/).

see #252
This commit is contained in:
Tobias Witek 2018-04-29 16:12:39 +02:00
parent fa9ad10549
commit 8e80923f14
4 changed files with 153 additions and 4 deletions

View file

@ -59,6 +59,8 @@ def create_parser():
help=DEBUG_HELP)
parser.add_argument("-f", "--logfile", default="~/bumblebee-status-debug.log",
help="Location of the debug log file")
parser.add_argument("-i", "--iconset", default="auto",
help="Specify the name of an iconset to use (overrides theme default)")
return parser
@ -91,6 +93,10 @@ class Config(bumblebee.store.Store):
"""Return the name of the selected theme"""
return self._args.theme
def iconset(self):
"""Return the name of a user-specified icon-set"""
return self._args.iconset
def debug(self):
return self._args.debug

View file

@ -38,12 +38,13 @@ def themes():
class Theme(object):
"""Represents a collection of icons and colors"""
def __init__(self, name):
def __init__(self, name, iconset):
self._widget = None
self._cycle_idx = 0
self._cycle = {}
self._prevbg = None
self._colorset = {}
self._iconset = iconset
self.load_symbols()
@ -77,8 +78,11 @@ class Theme(object):
def _init(self, data):
"""Initialize theme from data structure"""
self._theme = data
for iconset in data.get("icons", []):
self._merge(data, self._load_icons(iconset))
if self._iconset != "auto":
self._merge(data, self._load_icons(self._iconset))
else:
for iconset in data.get("icons", []):
self._merge(data, self._load_icons(iconset))
for colorset in data.get("colors", []):
self._merge(self._colorset, self._load_colors(colorset))
self._defaults = data.get("defaults", {})