various small changes

This commit is contained in:
Kevin Alberts 2023-05-15 11:41:58 +02:00
parent cdf5996c40
commit 9976e7f144
3 changed files with 15 additions and 10 deletions

View file

@ -17,11 +17,12 @@ class Config(BaseConfig):
# Default Applications # Default Applications
app_terminal = "terminator" app_terminal = "terminator"
app_launcher = "/home/kevin/bin/dmenu_wal.sh" app_launcher = "/home/kevin/bin/dmenu_wal.sh"
web_browser = "firefox-developer-edition" web_browser = "firefox"
file_manager = "thunar" file_manager = "thunar"
app_chat = "/usr/bin/rambox" app_chat = "/usr/bin/rambox"
app_irc = "quasselclient" app_irc = "quasselclient"
app_mail = "thunderbird" app_mail = "thunderbird"
app_music = "spotify"
cmd_brightness_up = "sudo /usr/bin/xbacklight -inc 10" cmd_brightness_up = "sudo /usr/bin/xbacklight -inc 10"
cmd_brightness_down = "sudo /usr/bin/xbacklight -dec 10" cmd_brightness_down = "sudo /usr/bin/xbacklight -dec 10"
lock_command = "bash /home/kevin/bin/lock.sh" lock_command = "bash /home/kevin/bin/lock.sh"
@ -150,7 +151,7 @@ class Config(BaseConfig):
do_keyboard_updates = False do_keyboard_updates = False
# Show audio visualizer # Show audio visualizer
show_audio_visualizer = True show_audio_visualizer = False
kill_unnecessary_glava_processes = True kill_unnecessary_glava_processes = True
# Show thermal widget # Show thermal widget
@ -165,3 +166,6 @@ class Config(BaseConfig):
# Audio control applications # Audio control applications
# apps_audio = ["pavucontrol"] # apps_audio = ["pavucontrol"]
apps_audio_afterstart = [] apps_audio_afterstart = []
# Comma-separated list of ignored players in the media widget
media_ignore_players = "kdeconnect"

View file

@ -238,7 +238,7 @@ class Kuro(BaseTheme):
groups.append(Group("", spawn=Config.get('file_manager', "true"))) groups.append(Group("", spawn=Config.get('file_manager', "true")))
groups.append(Group("", spawn=Config.get('app_mail', "true"))) groups.append(Group("", spawn=Config.get('app_mail', "true")))
groups.append(Group("")) groups.append(Group(""))
groups.append(Group("")) groups.append(Group("", spawn=Config.get('app_music', "true")))
groups.append(Group("")) groups.append(Group(""))
groups.append(Group("", spawn=Config.get('apps_audio', "true"))) groups.append(Group("", spawn=Config.get('apps_audio', "true")))
groups.append(Group("", layout='floating', layouts=[ groups.append(Group("", layout='floating', layouts=[
@ -325,7 +325,7 @@ class Kuro(BaseTheme):
widgets.append(kuro.utils.widgets.AudioVisualizerWidget(margin_x=0, margin_y=0)) widgets.append(kuro.utils.widgets.AudioVisualizerWidget(margin_x=0, margin_y=0))
widgets.extend([ widgets.extend([
kuro.utils.widgets.MediaWidget(), kuro.utils.widgets.MediaWidget(ignore_players=Config.get('media_ignore_players', '')),
kuro.utils.widgets.TextSpacerWidget(fontsize=14), kuro.utils.widgets.TextSpacerWidget(fontsize=14),
]) ])

View file

@ -262,6 +262,7 @@ class MediaWidget(base.InLoopPollText):
('on_text_stop', '{}', 'The pattern for the text if music is stopped.'), ('on_text_stop', '{}', 'The pattern for the text if music is stopped.'),
('update_interval', 1, 'The update interval.'), ('update_interval', 1, 'The update interval.'),
('max_chars_per_player', 50, 'Maximum characters of text per player.'), ('max_chars_per_player', 50, 'Maximum characters of text per player.'),
('ignore_players', '', 'Comma-separated list of players to ignore.')
] ]
player_icons = { player_icons = {
@ -319,13 +320,13 @@ class MediaWidget(base.InLoopPollText):
if button == BUTTON_LEFT: if button == BUTTON_LEFT:
player = self._player_to_control() player = self._player_to_control()
if player is not None: 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) _ = self.call_process(command)
notify("MediaWidget", "Toggled {}".format(player)) notify("MediaWidget", "Toggled {}".format(player))
if button == BUTTON_RIGHT: if button == BUTTON_RIGHT:
player = self._player_to_control() player = self._player_to_control()
if player is not None: if player is not None:
command = ["playerctl", "-p", player, "next"] command = ["playerctl", "-i", self.ignore_players, "-p", player, "next"]
_ = self.call_process(command) _ = self.call_process(command)
if button == BUTTON_MIDDLE: if button == BUTTON_MIDDLE:
# Jump to the screen that the player is on # Jump to the screen that the player is on
@ -358,7 +359,7 @@ class MediaWidget(base.InLoopPollText):
# Playerctl players # Playerctl players
try: try:
result = self.call_process(["playerctl", "-l"]) result = self.call_process(["playerctl", "-i", self.ignore_players, "-l"])
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
result = None result = None
@ -398,17 +399,17 @@ class MediaWidget(base.InLoopPollText):
else: else:
# PlayerCtl player # PlayerCtl player
command = ["playerctl", "-p", player, "status"] command = ["playerctl", "-i", self.ignore_players, "-p", player, "status"]
cmd_result = self.call_process(command).strip() cmd_result = self.call_process(command).strip()
text = "Unknown" text = "Unknown"
if cmd_result in ["Playing", "Paused"]: if cmd_result in ["Playing", "Paused"]:
try: 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: except subprocess.CalledProcessError:
artist = None artist = None
try: 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: except subprocess.CalledProcessError:
title = None title = None