Replacing deprecated IPC hooks with IPC actions

This commit is contained in:
Noah L. Schrick 2022-08-19 15:59:25 -05:00
parent 083d014bd3
commit e8a3eb74d4
5 changed files with 11 additions and 11 deletions

View File

@ -9,12 +9,9 @@ killall -q polybar
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
for m in $(polybar --list-monitors | cut -d":" -f1); do for m in $(polybar --list-monitors | cut -d":" -f1); do
MONITOR=$m polybar top -c ~/.config/polybar/config-top.ini > top.log & MONITOR=$m polybar top -c ~/.config/polybar/config-top.ini > ~/.config/polybar/top.log &
MONITOR=$m polybar bottom -c ~/.config/polybar/config-bottom.ini > bottom.log & MONITOR=$m polybar bottom -c ~/.config/polybar/config-bottom.ini > ~/config/polybar/bottom.log &
done done
exit 0 exit 0
# Launch bar1 and bar2
#polybar top -c ~/.config/polybar/config-top.ini &
#polybar bottom -c ~/.config/polybar/config-bottom.ini &

0
polybar/scripts/mopidy.sh Normal file → Executable file
View File

View File

@ -58,18 +58,21 @@ def event_handler(*args, **kwargs):
"""arg[1] contains metadata""" """arg[1] contains metadata"""
"""arg[1][1] contains PlaybackStatus""" """arg[1][1] contains PlaybackStatus"""
data = unwrap(args) data = unwrap(args)
if 'spotify' in data[1]['Metadata']['mpris:trackid']: #if 'spotify' in data[1]['Metadata']['mpris:trackid']:
if 'PlaybackStatus' in data[1]:
if data[1]['PlaybackStatus'] == "Playing": if data[1]['PlaybackStatus'] == "Playing":
print("Music is playing") print("Music is playing")
system("polybar-msg hook playpause 2")
""" Send IPC hook 2 to all bars for module playpause """ """ Send IPC hook 2 to all bars for module playpause """
#system("polybar-msg hook playpause 2")
system("polybar-msg action '#playpause.hook.1'")
if data[1]['PlaybackStatus'] == "Paused": if data[1]['PlaybackStatus'] == "Paused":
print("Music is paused.") print("Music is paused.")
""" Send IPC hook 3 to all bars module playpause """ """ Send IPC hook 3 to all bars module playpause """
system("polybar-msg hook playpause 3") #system("polybar-msg hook playpause 3")
""" Send IPC hook 2 to all bars for module spotify """ system("polybar-msg action '#playpause.hook.2'")
system("polybar-msg hook spotify 2") """ Send IPC hook 2 to all bars for module spotify """
#system("polybar-msg action spotify 2") #system("polybar-msg hook spotify 2")
system("polybar-msg action '#spotify.hook.1'")
def unwrap(val): def unwrap(val):
if isinstance(val, dbus.ByteArray): if isinstance(val, dbus.ByteArray):

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB