Merge remote-tracking branch 'origin/celestia'
This commit is contained in:
commit
9dce0df0bc
5 changed files with 124 additions and 32 deletions
|
@ -105,7 +105,7 @@ def notify(title, content, urgency=URGENCY_NORMAL, timeout=5000, image=None):
|
|||
return notification.show()
|
||||
except notify2.UninittedError:
|
||||
logger.warning("Notify2 was uninitialized, initializing...")
|
||||
notify2.init("qtile")
|
||||
notify2.init("qtile")
|
||||
return notification.show()
|
||||
except DBusException as e:
|
||||
logger.warning("Showing notification failed: {}".format(e))
|
||||
|
@ -204,22 +204,24 @@ class KuroTopBar(Bar):
|
|||
self.window.update_name()
|
||||
|
||||
def draw(self):
|
||||
if self.queued_draws == 0:
|
||||
self.qtile.call_soon(self._actual_draw)
|
||||
self.queued_draws += 1
|
||||
if not self.widgets:
|
||||
return
|
||||
if not self._draw_queued:
|
||||
self.future = self.qtile.call_soon(self._actual_draw)
|
||||
self._draw_queued = True
|
||||
|
||||
def _actual_draw(self):
|
||||
self.queued_draws = 0
|
||||
self._resize(self.length, self.widgets)
|
||||
self._draw_queued = False
|
||||
self._resize(self._length, self.widgets)
|
||||
for i in self.widgets:
|
||||
i.draw()
|
||||
if self.widgets:
|
||||
end = i.offset + i.length
|
||||
if end < self.length:
|
||||
if end < self._length:
|
||||
if self.horizontal:
|
||||
self.drawer.draw(offsetx=end, width=self.length - end)
|
||||
self.drawer.draw(offsetx=end, width=self._length - end)
|
||||
else:
|
||||
self.drawer.draw(offsety=end, height=self.length - end)
|
||||
self.drawer.draw(offsety=end, height=self._length - end)
|
||||
|
||||
self.theme.update_visualizers()
|
||||
|
||||
|
|
|
@ -139,6 +139,26 @@ class DualPaneTextboxBase(base._Widget):
|
|||
if self.layout_right:
|
||||
self.layout_right.font = value
|
||||
|
||||
@property
|
||||
def font_left(self):
|
||||
return self._font_left
|
||||
|
||||
@font_left.setter
|
||||
def font_left(self, value):
|
||||
self._font_left = value
|
||||
if self.layout_left:
|
||||
self.layout_left.font = value
|
||||
|
||||
@property
|
||||
def font_right(self):
|
||||
return self._font_right
|
||||
|
||||
@font_right.setter
|
||||
def font_right(self, value):
|
||||
self._font_right = value
|
||||
if self.layout_right:
|
||||
self.layout_right.font = value
|
||||
|
||||
@property
|
||||
def fontshadow(self):
|
||||
return self._fontshadow
|
||||
|
@ -262,6 +282,7 @@ class MediaWidget(base.InLoopPollText):
|
|||
('on_text_stop', ' {}', 'The pattern for the text if music is stopped.'),
|
||||
('update_interval', 1, 'The update interval.'),
|
||||
('max_chars_per_player', 50, 'Maximum characters of text per player.'),
|
||||
('ignore_players', '', 'Comma-separated list of players to ignore.')
|
||||
]
|
||||
|
||||
player_icons = {
|
||||
|
@ -319,13 +340,13 @@ class MediaWidget(base.InLoopPollText):
|
|||
if button == BUTTON_LEFT:
|
||||
player = self._player_to_control()
|
||||
if player is not None:
|
||||
command = ["playerctl", "-p", player, "play-pause"]
|
||||
command = ["playerctl", "-i", self.ignore_players, "-p", player, "play-pause"]
|
||||
_ = self.call_process(command)
|
||||
notify("MediaWidget", "Toggled {}".format(player))
|
||||
if button == BUTTON_RIGHT:
|
||||
player = self._player_to_control()
|
||||
if player is not None:
|
||||
command = ["playerctl", "-p", player, "next"]
|
||||
command = ["playerctl", "-i", self.ignore_players, "-p", player, "next"]
|
||||
_ = self.call_process(command)
|
||||
if button == BUTTON_MIDDLE:
|
||||
# Jump to the screen that the player is on
|
||||
|
@ -358,7 +379,7 @@ class MediaWidget(base.InLoopPollText):
|
|||
|
||||
# Playerctl players
|
||||
try:
|
||||
result = self.call_process(["playerctl", "-l"])
|
||||
result = self.call_process(["playerctl", "-i", self.ignore_players, "-l"])
|
||||
except subprocess.CalledProcessError:
|
||||
result = None
|
||||
|
||||
|
@ -398,17 +419,17 @@ class MediaWidget(base.InLoopPollText):
|
|||
|
||||
else:
|
||||
# PlayerCtl player
|
||||
command = ["playerctl", "-p", player, "status"]
|
||||
command = ["playerctl", "-i", self.ignore_players, "-p", player, "status"]
|
||||
cmd_result = self.call_process(command).strip()
|
||||
|
||||
text = "Unknown"
|
||||
if cmd_result in ["Playing", "Paused"]:
|
||||
try:
|
||||
artist = self.call_process(['playerctl', '-p', player, 'metadata', 'artist']).strip()
|
||||
artist = self.call_process(['playerctl', "-i", self.ignore_players, '-p', player, 'metadata', 'artist']).strip()
|
||||
except subprocess.CalledProcessError:
|
||||
artist = None
|
||||
try:
|
||||
title = self.call_process(['playerctl', '-p', player, 'metadata', 'title']).strip()
|
||||
title = self.call_process(['playerctl', "-i", self.ignore_players, '-p', player, 'metadata', 'title']).strip()
|
||||
except subprocess.CalledProcessError:
|
||||
title = None
|
||||
|
||||
|
@ -438,7 +459,7 @@ class MediaWidget(base.InLoopPollText):
|
|||
else:
|
||||
res = "Unknown"
|
||||
res = pangocffi.markup_escape_text(res)
|
||||
res = unicodedata.normalize("NFKD", res)
|
||||
res = unicodedata.normalize('NFKD', res)
|
||||
if len(res) > self.max_chars_per_player:
|
||||
res = res[:self.max_chars_per_player] + "..."
|
||||
return res
|
||||
|
@ -1196,7 +1217,7 @@ class VolumeInfoWidget(DualPaneTextboxBase):
|
|||
"""Displays information about the volume"""
|
||||
orientations = base.ORIENTATION_HORIZONTAL
|
||||
defaults = [
|
||||
('update_interval', 10, 'The update interval in seconds.'),
|
||||
('update_interval', 5, 'The update interval in seconds.'),
|
||||
('text_pattern', "{percentage}%", 'The pattern for the text that is displayed.'),
|
||||
('charging_color', "#ffffff", "Color when battery is charging"),
|
||||
('normal_color', "#ffffff", "Color when value is normal"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue