Add polybar mpris script
This commit is contained in:
		
							parent
							
								
									c8008bc611
								
							
						
					
					
						commit
						b804c8b447
					
				
					 3 changed files with 25 additions and 1 deletions
				
			
		|  | @ -51,7 +51,7 @@ | |||
|     inherit = bar/base | ||||
| 
 | ||||
|     modules-left = bspwm | ||||
|     modules-center = mpd | ||||
|     modules-center = mpd player-mpris-simple | ||||
|     modules-right = openweather memory cpu temperature eth check-arch-updates date | ||||
| 
 | ||||
|     eth-interface = enp0s31f6 | ||||
|  |  | |||
|  | @ -53,3 +53,14 @@ | |||
| 
 | ||||
|     format-prefix-foreground = ${colors.foreground} | ||||
|     format-underline = ${colors.green} | ||||
| 
 | ||||
| [module/player-mpris-simple] | ||||
|     type = custom/script | ||||
|     exec = $HOME/.config/polybar/scripts/player-mpris-simple.sh | ||||
|     interval = 3 | ||||
|     click-left = playerctl previous & | ||||
|     click-right = playerctl next & | ||||
|     click-middle = playerctl play-pause & | ||||
| 
 | ||||
|     format-prefix-foreground = ${colors.foreground} | ||||
|     format-underline = ${colors.green} | ||||
|  |  | |||
							
								
								
									
										13
									
								
								.config/polybar/scripts/player-mpris-simple.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										13
									
								
								.config/polybar/scripts/player-mpris-simple.sh
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| #!/bin/sh | ||||
| 
 | ||||
| alias playerctl="playerctl -p spotifyd" | ||||
| 
 | ||||
| player_status=$(playerctl status 2> /dev/null) | ||||
| 
 | ||||
| if [ "$player_status" = "Playing" ]; then | ||||
|     echo " $(playerctl metadata -f '{{title}} - {{artist}} | {{duration(position)}}/{{duration(mpris:length)}}')" | ||||
| elif [ "$player_status" = "Paused" ]; then | ||||
|     echo " $(playerctl metadata -f '{{title}} - {{artist}} | {{duration(position)}}/{{duration(mpris:length)}}')" | ||||
| else | ||||
|     echo "" | ||||
| fi | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue