# -*- coding: utf-8 -*- from libqtile import widget from lib.theme import theme class Battery(widget.Battery): def _get_text(self): result = super(Battery, self)._get_text() if result == 'Full': return u"⚡ 100%".encode('utf-8') else: return result battery = theme.r(Battery, discharge_char="", foreground="{{green}}", low_foreground="#FF0000}", padding=0, format=u"⚡ {percent:2.0%}".encode('utf-8'))
from libqtile.widget import Wlan from lib.theme import theme wlan = theme.r(Wlan, foreground="{{blue}}", interface="wlp2s0", format="{essid}", disconnected_message="")
from lib import widgets, consts from lib.theme import theme bar_height = 32 widget_defaults = dict(fontsize=consts.FONT_SIZE, font=consts.FONT_NAME, foreground=theme["foreground"]) top_bar = theme.r(bar.Bar, [ widgets.groupbox, widget.Spacer(), widgets.spotify, widget.Systray(), widgets.wlan, widgets.battery, widgets.volume, ], bar_height, background="{{background}}") bottom_bar = theme.r(bar.Bar, [ widgets.currentlayout, widgets.windowname, widgets.observers, widgets.clock, ], bar_height, background="{{background}}")
from libqtile.widget import WindowName from lib.theme import theme windowname = theme.r(WindowName, padding=8, margin_y=-4, foreground="{{foreground}}")
from libqtile.widget import Volume from lib.theme import theme volume = theme.r( Volume, emoji=True, padding=10, foreground="{{foreground}}")
from libqtile.widget import CurrentLayoutIcon from lib.theme import theme currentlayout = theme.r( CurrentLayoutIcon, scale=.85, foreground="{{foreground}}")
from libqtile.widget import Clock from lib.theme import theme clock = theme.r(Clock, format='%H:%M %d/%m/%y', padding=6, foreground="{{foreground}}")
from libqtile.widget import GroupBox from lib.theme import theme groupbox = theme.r(GroupBox, margin_y=-1, fontsize=20, highlight_method='text', active="{{foreground}}", inactive="{{light_gray}}", this_current_screen_border="{{red}}")
def copy_metadata(self): url = self.info("metadata xesam:url") copytext(url) def button_press(self, x, y, button): if button == 1: self.copy_metadata() def poll(self): try: status = self.info("status") title = self.info("metadata xesam:title") artist = self.info("metadata xesam:artist") if status.strip() == 'Playing': self.layout.colour = theme['light_green'] else: self.layout.colour = theme['green'] if self.layout.colour != self.old_colour: self.bar.draw() self.old_color = self.layout.colour return "🎶 {} by {}".format(title, artist) except CalledProcessError: return "" except Exception, e: return str(e) spotify = theme.r(Spotify, foreground="{{light_green}}")