These are two simple modules for waybar. It looks for all active players and when if sees something is playing it will show the proper metadata. If nothing was found it will hide itself.
Clone the repository into a scripts directory in the waybar config directory.
mkdir -p ~/.config/waybar/scripts/
git clone https://github.com/lighttigerXIV/waymedia.git ~/.config/waybar/scripts/
Add "custom/waymedia"
to your waybar configuration.
"modules-left": ["custom/waymedia"],
"custom/waymedia": {
"format": "{}",
"exec": "~/.config/waybar/scripts/waymedia/waymedia",
"interval": 1,
"limit": 60,
"on-click": "playerctl play-pause",
"on-scroll-up": "playerctl next",
"on-scroll-down": "playerctl previous"
},
You can customize the play icon, pause icon, the divider and the pattern of how things are displayed.
"custom/waymedia": {
"format": "{icon}{}",
"exec": "~/.config/waybar/scripts/waymedia/waymedia",
"interval": 1,
"limit": 60,
"on-click": "playerctl play-pause",
"on-scroll-up": "playerctl next",
"on-scroll-down": "playerctl previous",
"pause-icon": " ",
"play-icon": " ",
"divider": " - ",
"pattern": "{icon}{artist}{divider}{title}"
},
Add "custom/waymedia-buttons"
to your waybar configuration.
"modules-left": ["custom/waymedia-buttons"],
"custom/waymedia-buttons": {
"format": "{icon} {artist} - {title}",
"exec": "~/.config/waybar/scripts/waymedia/waymedia-buttons",
"interval": 1,
"on-click": "playerctl play-pause",
"on-scroll-up": "playerctl next",
"on-scroll-down": "playerctl previous"
},
You can customize the buttons too.
"custom/waymedia-buttons": {
"format": "{icon}{}",
"exec": "~/.config/waybar/scripts/waymedia/waymedia-buttons",
"interval": 1,
"on-click": "playerctl play-pause",
"on-scroll-up": "playerctl next",
"on-scroll-down": "playerctl previous",
"previous-icon": " ",
"skip-icon": " ",
"play-icon": " ",
"pause-icon": " "
},
To style the components use the following selectors
/* For the title/artist */
#custom-waymedia{}
/* For the buttons */
#custom-waymedia-buttons{}