Spotify support for polybar

This commit is contained in:
TuDatTr
2018-03-08 01:13:52 +01:00
parent e6575b94c2
commit 709020c441
8 changed files with 96 additions and 61 deletions

View File

@@ -114,6 +114,7 @@ exec --no-startup-id emacs --daemon
exec --no-startup-id udiskie
exec --no-startup-id polybar beep -r
exec --no-startup-id polybar boop -r
exec --no-startup-id setxkbmap -option "ctrl:swapcaps"
###############################################################################
################################# Keybindings #################################
###############################################################################

1
i3/.scripts/playstate Normal file
View File

@@ -0,0 +1 @@
1

24
i3/.scripts/spotify-play.py Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/python
import subprocess
import time
def main():
state = -1
while 1:
with open('/home/tuan/.scripts/playstate', 'r') as f:
try:
file_state = int(f.readline().strip('\n'))
except ValueError:
pass
if state != file_state:
state = file_state
if state == 0:
print("")
subprocess.run(["playerctl","pause"])
elif state == 1:
print("")
subprocess.run(["playerctl","play"])
time.sleep(0.5)
if __name__ == '__main__':
main()