[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:
parent
fa9ad10549
commit
8e80923f14
4 changed files with 153 additions and 4 deletions
|
@ -34,7 +34,7 @@ def main():
|
||||||
filename=config.logfile()
|
filename=config.logfile()
|
||||||
)
|
)
|
||||||
|
|
||||||
theme = bumblebee.theme.Theme(config.theme())
|
theme = bumblebee.theme.Theme(config.theme(), config.iconset())
|
||||||
output = bumblebee.output.I3BarOutput(theme=theme)
|
output = bumblebee.output.I3BarOutput(theme=theme)
|
||||||
inp = bumblebee.input.I3BarInput()
|
inp = bumblebee.input.I3BarInput()
|
||||||
engine = None
|
engine = None
|
||||||
|
|
|
@ -59,6 +59,8 @@ def create_parser():
|
||||||
help=DEBUG_HELP)
|
help=DEBUG_HELP)
|
||||||
parser.add_argument("-f", "--logfile", default="~/bumblebee-status-debug.log",
|
parser.add_argument("-f", "--logfile", default="~/bumblebee-status-debug.log",
|
||||||
help="Location of the debug log file")
|
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
|
return parser
|
||||||
|
|
||||||
|
@ -91,6 +93,10 @@ class Config(bumblebee.store.Store):
|
||||||
"""Return the name of the selected theme"""
|
"""Return the name of the selected theme"""
|
||||||
return self._args.theme
|
return self._args.theme
|
||||||
|
|
||||||
|
def iconset(self):
|
||||||
|
"""Return the name of a user-specified icon-set"""
|
||||||
|
return self._args.iconset
|
||||||
|
|
||||||
def debug(self):
|
def debug(self):
|
||||||
return self._args.debug
|
return self._args.debug
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,13 @@ def themes():
|
||||||
|
|
||||||
class Theme(object):
|
class Theme(object):
|
||||||
"""Represents a collection of icons and colors"""
|
"""Represents a collection of icons and colors"""
|
||||||
def __init__(self, name):
|
def __init__(self, name, iconset):
|
||||||
self._widget = None
|
self._widget = None
|
||||||
self._cycle_idx = 0
|
self._cycle_idx = 0
|
||||||
self._cycle = {}
|
self._cycle = {}
|
||||||
self._prevbg = None
|
self._prevbg = None
|
||||||
self._colorset = {}
|
self._colorset = {}
|
||||||
|
self._iconset = iconset
|
||||||
|
|
||||||
self.load_symbols()
|
self.load_symbols()
|
||||||
|
|
||||||
|
@ -77,8 +78,11 @@ class Theme(object):
|
||||||
def _init(self, data):
|
def _init(self, data):
|
||||||
"""Initialize theme from data structure"""
|
"""Initialize theme from data structure"""
|
||||||
self._theme = data
|
self._theme = data
|
||||||
for iconset in data.get("icons", []):
|
if self._iconset != "auto":
|
||||||
self._merge(data, self._load_icons(iconset))
|
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", []):
|
for colorset in data.get("colors", []):
|
||||||
self._merge(self._colorset, self._load_colors(colorset))
|
self._merge(self._colorset, self._load_colors(colorset))
|
||||||
self._defaults = data.get("defaults", {})
|
self._defaults = data.get("defaults", {})
|
||||||
|
|
139
themes/icons/ionicons.json
Normal file
139
themes/icons/ionicons.json
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
{
|
||||||
|
"defaults": {
|
||||||
|
"separator": "\ue0b2", "padding": "\u3000",
|
||||||
|
"unknown": { "prefix": "\uf100" }
|
||||||
|
},
|
||||||
|
"date": { "prefix": "\uf2d1" },
|
||||||
|
"time": { "prefix": "\uf3b3" },
|
||||||
|
"datetime": { "prefix": "\uf3b3" },
|
||||||
|
"memory": { "prefix": "\uf389" },
|
||||||
|
"cpu": { "prefix": "\uf4b0" },
|
||||||
|
"disk": { "prefix": "\u26c1" },
|
||||||
|
"dnf": { "prefix": "\uf2be" },
|
||||||
|
"pacman": { "prefix": "\uf2be" },
|
||||||
|
"brightness": { "prefix": "\u263c" },
|
||||||
|
"load": { "prefix": "\uf13d" },
|
||||||
|
"layout": { "prefix": "\uf38c" },
|
||||||
|
"layout-xkb": { "prefix": "\uf38c" },
|
||||||
|
"todo": { "empty": {"prefix": "\uf453" },
|
||||||
|
"items": {"prefix": "\uf454" },
|
||||||
|
"uptime": {"prefix": "\uf4c1" }
|
||||||
|
},
|
||||||
|
"zpool": {
|
||||||
|
"poolread": {"prefix": "\u26c1\uf3d6"},
|
||||||
|
"poolwrite": {"prefix": "\u26c1\uf3d5"},
|
||||||
|
"ONLINE": {"prefix": "\u26c1"},
|
||||||
|
"FAULTED": {"prefix": "\u26c1\uf3bc"},
|
||||||
|
"DEGRADED": {"prefix": "\u26c1\uf3bc"}
|
||||||
|
},
|
||||||
|
"cmus": {
|
||||||
|
"playing": { "prefix": "\uf488" },
|
||||||
|
"paused": { "prefix": "\uf210" },
|
||||||
|
"stopped": { "prefix": "\uf24f" },
|
||||||
|
"prev": { "prefix": "\uf4ab" },
|
||||||
|
"next": { "prefix": "\uf4ad" },
|
||||||
|
"shuffle-on": { "prefix": "\uf4a8" },
|
||||||
|
"shuffle-off": { "prefix": "\uf453" },
|
||||||
|
"repeat-on": { "prefix": "\uf459" },
|
||||||
|
"repeat-off": { "prefix": "\uf30f" }
|
||||||
|
},
|
||||||
|
"gpmdp": {
|
||||||
|
"playing": { "prefix": "\uf488" },
|
||||||
|
"paused": { "prefix": "\uf210" },
|
||||||
|
"stopped": { "prefix": "\uf24f" },
|
||||||
|
"prev": { "prefix": "\uf4ab" },
|
||||||
|
"next": { "prefix": "\uf4ad" }
|
||||||
|
},
|
||||||
|
"pasink": {
|
||||||
|
"muted": { "prefix": "\uf3b9" },
|
||||||
|
"unmuted": { "prefix": "\uf3ba" }
|
||||||
|
},
|
||||||
|
"amixer": {
|
||||||
|
"muted": { "prefix": "\uf3b9" },
|
||||||
|
"unmuted": { "prefix": "\uf3ba" }
|
||||||
|
},
|
||||||
|
"pasource": {
|
||||||
|
"muted": { "prefix": "\uf3b9" },
|
||||||
|
"unmuted": { "prefix": "\uf3ba" }
|
||||||
|
},
|
||||||
|
"kernel": {
|
||||||
|
"prefix": "\uf17c"
|
||||||
|
},
|
||||||
|
"nic": {
|
||||||
|
"wireless-up": { "prefix": "\uf25c" },
|
||||||
|
"wireless-down": { "prefix": "\uf3d0" },
|
||||||
|
"wired-up": { "prefix": "\u26fc" },
|
||||||
|
"wired-down": { "prefix": "\uf270" },
|
||||||
|
"tunnel-up": { "prefix": "\uf133" },
|
||||||
|
"tunnel-down": { "prefix": "\uf306" }
|
||||||
|
},
|
||||||
|
"bluetooth": {
|
||||||
|
"ON": { "prefix": "\uf116" },
|
||||||
|
"OFF": { "prefix": "\uf116" },
|
||||||
|
"?": { "prefix": "\uf116" }
|
||||||
|
},
|
||||||
|
"battery": {
|
||||||
|
"charged": { "prefix": "\uf113", "suffix": "\u26b1" },
|
||||||
|
"AC": { "suffix": "\u26b1" },
|
||||||
|
"charging": {
|
||||||
|
"prefix": [ "\uf112", "\uf115", "\uf114", "", "\uf113" ],
|
||||||
|
"suffix": "\u26b1"
|
||||||
|
},
|
||||||
|
"discharging-10": { "prefix": "\uf112", "suffix": "\uf3bc" },
|
||||||
|
"discharging-25": { "prefix": "\uf115", "suffix": "\uf3e6" },
|
||||||
|
"discharging-50": { "prefix": "\uf115", "suffix": "\uf3e6" },
|
||||||
|
"discharging-80": { "prefix": "\uf114", "suffix": "\uf3e6" },
|
||||||
|
"discharging-100": { "prefix": "\uf113", "suffix": "\uf3e6" },
|
||||||
|
"unlimited": { "prefix": "\uf402", "suffix": "\u26b1" },
|
||||||
|
"estimate": { "prefix": "\uf402" }
|
||||||
|
},
|
||||||
|
"caffeine": {
|
||||||
|
"activated": {"prefix": "\uf272\uf354" }, "deactivated": { "prefix": "\uf272\uf355" }
|
||||||
|
},
|
||||||
|
"xrandr": {
|
||||||
|
"on": { "prefix": "\uf465\uf354"}, "off": { "prefix": "\uf465\uf355" }
|
||||||
|
},
|
||||||
|
"redshift": {
|
||||||
|
"day": { "prefix": "\uf4b6" }, "night": { "prefix": "\uf467" }, "transition": { "prefix": "\uf475" }
|
||||||
|
},
|
||||||
|
"sensors": {
|
||||||
|
"prefix": "\uf3b6"
|
||||||
|
},
|
||||||
|
"traffic":{
|
||||||
|
"rx": { "prefix": "\uf365" },
|
||||||
|
"tx": { "prefix": "\uf35f" }
|
||||||
|
},
|
||||||
|
"mpd": {
|
||||||
|
"playing": { "prefix": "\uf488" },
|
||||||
|
"paused": { "prefix": "\uf210" },
|
||||||
|
"stopped": { "prefix": "\uf24f" },
|
||||||
|
"prev": { "prefix": "\uf4ab" },
|
||||||
|
"next": { "prefix": "\uf4ad" },
|
||||||
|
"shuffle-on": { "prefix": "\uf4a8" },
|
||||||
|
"shuffle-off": { "prefix": "\uf453" },
|
||||||
|
"repeat-on": { "prefix": "\uf459" },
|
||||||
|
"repeat-off": { "prefix": "\uf30f" }
|
||||||
|
},
|
||||||
|
"github": {
|
||||||
|
"prefix": "\uf233"
|
||||||
|
},
|
||||||
|
"hipchat": {
|
||||||
|
"prefix": "\uf11c"
|
||||||
|
},
|
||||||
|
"spotify": {
|
||||||
|
"prefix": "\uf305"
|
||||||
|
},
|
||||||
|
"publicip": {
|
||||||
|
"prefix": "\uf268"
|
||||||
|
},
|
||||||
|
"weather": {
|
||||||
|
"clouds": { "prefix": "\uf12b" },
|
||||||
|
"rain": { "prefix": "\uf495" },
|
||||||
|
"snow": { "prefix": "\uf4ae" },
|
||||||
|
"clear": { "prefix": "\uf3b0" },
|
||||||
|
"thunder": { "prefix": "\uf4bd" }
|
||||||
|
},
|
||||||
|
"taskwarrior": {
|
||||||
|
"prefix": "\uf454"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue