Spotify support for polybar
This commit is contained in:
@@ -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
1
i3/.scripts/playstate
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
24
i3/.scripts/spotify-play.py
Executable file
24
i3/.scripts/spotify-play.py
Executable 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()
|
||||
Reference in New Issue
Block a user