From 28bb9393252483f64bdbcff9fdd2cf7299f18b96 Mon Sep 17 00:00:00 2001 From: Jika Date: Sun, 9 Feb 2025 18:05:56 +0100 Subject: [PATCH] Add media playerctl in waybar --- waybar/config | 15 ++++++++++++++- waybar/style.css | 4 +++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/waybar/config b/waybar/config index b6c3bde..a6bb27c 100755 --- a/waybar/config +++ b/waybar/config @@ -10,9 +10,22 @@ "margin-bottom": 2, "height": 32, "modules-left": ["custom/launcher","sway/workspaces","cpu","memory","disk","sway/window"], - "modules-center": [], + "modules-center": ["custom/media"], "modules-right": ["custom/update_audio","sway/mode","custom/kernel","custom/network","pulseaudio","tray","clock","custom/power"], +"custom/media": { + "format": " {} {icon}", + "return-type": "json", + "format-icons": { + "Playing": " ", + "Paused": " ", + "Stopped": " ", + }, + "max-length":70, + "exec": "playerctl -a metadata --format '{\"text\": \"{{artist}} - {{markup_escape(title)}}\", \"tooltip\": \"{{playerName}} : {{markup_escape(title)}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}'", + "on-click": "playerctl play-pause", + "interval": 1, +}, "keyboard-state": { "numlock": true, "capslock": true, diff --git a/waybar/style.css b/waybar/style.css index 58209c0..04f2061 100755 --- a/waybar/style.css +++ b/waybar/style.css @@ -51,6 +51,7 @@ tooltip { #custom-window, #custom-eix, #custom-update, +#custom-media, #disk, #tray { background-color: #1e222a; @@ -106,6 +107,7 @@ tooltip { color: #34bfd0; } +#custom-media, #disk { color: #34bfd0; } @@ -145,7 +147,7 @@ tooltip { } #mode { - color: #0fa4bf; + color: #34bfd0; } #window {