Dotfiles for my tiling window manager + terminal workflow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
556 B

6 years ago
  1. #!/usr/bin/python
  2. import dbus
  3. import os
  4. try:
  5. bus = dbus.SessionBus()
  6. spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
  7. spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties')
  8. props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
  9. song_str = str(props['xesam:artist'][0]) + " - " + str(props['xesam:title'])
  10. print("{}\n\n{}\n".format(song_str, os.environ['COLOR7']))
  11. # print('COLOR7' in os.environ)
  12. exit
  13. except dbus.exceptions.DBusException:
  14. exit