Polybar: Remove Spotify module

Took up space and I didn't need it
This commit is contained in:
Salt 2018-08-11 14:57:24 -05:00
parent 05f01a7d4e
commit 78345b4a1f
2 changed files with 1 additions and 79 deletions

View File

@ -19,7 +19,6 @@ icon-date = ${res/colors.primary}
icon-dropbox = ${res/colors.primary}
icon-fs = ${xrdb:color11}
icon-memory = ${xrdb:color13}
icon-spotify = ${xrdb:color2}
icon-tor = ${xrdb:color13}
icon-volume = ${res/colors.primary}
icon-network = ${xrdb:color14}
@ -91,7 +90,7 @@ tray-position = center
modules-left = ${env:PB_BAR_PRIMARY_MODULES_LEFT:battery cpu memory}
modules-center = ${env:PB_BAR_PRIMARY_MODULES_CENTER: }
modules-right = ${env:PB_BAR_PRIMARY_MODULES_RIGHT:xbacklight volume | spotify dropbox date}
modules-right = ${env:PB_BAR_PRIMARY_MODULES_RIGHT:xbacklight volume | dropbox date}
[bar/primary-2]
monitor = ${env:PB_MONITOR:eDP-1}
@ -298,16 +297,6 @@ type = custom/text
content = ${env:PB_MONITOR:eDP-1}
content-foreground = ${res/colors.background-alt}
[module/spotify]
type = custom/script
format = <label>
format-prefix = "Spotify: "
format-prefix-foreground = ${res/colors.icon-spotify}
interval = 3
exec = python $HOME/.config/polybar/scripts/spotify.py -t 35 -f "{song} by {artist}"
exec-if = pgrep spotify
[module/swap]
type = internal/memory
format = <label>

View File

@ -1,67 +0,0 @@
#!/bin/python
import sys
import dbus
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'-t',
'--trunclen',
type=int,
metavar='trunclen'
)
parser.add_argument(
'-f',
'--format',
type=str,
metavar='custom format',
dest='custom_format'
)
args = parser.parse_args()
# Default parameters
output = '{artist}: {song}'
trunclen = 25
# parameters can be overwritten by args
if args.trunclen is not None:
trunclen = args.trunclen
if args.custom_format is not None:
output = args.custom_format
try:
session_bus = dbus.SessionBus()
spotify_bus = session_bus.get_object(
'org.mpris.MediaPlayer2.spotify',
'/org/mpris/MediaPlayer2'
)
spotify_properties = dbus.Interface(
spotify_bus,
'org.freedesktop.DBus.Properties'
)
metadata = spotify_properties.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
artist = metadata['xesam:artist'][0]
song = metadata['xesam:title']
if len(song) > trunclen:
song = song[0:trunclen]
song += '...'
if ('(' in song) and (')' not in song):
song += ')'
# Python3 uses UTF-8 by default.
if sys.version_info.major == 3:
print(output.format(artist=artist, song=song).encode('UTF-32'))
else:
print(output.format(artist=artist, song=song).encode('UTF-8'))
except Exception as e:
if isinstance(e, dbus.exceptions.DBusException):
print('')
else:
print(e)