From 1106ae4dd62f0092b6f5afebb319840dac3296b4 Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Wed, 20 Mar 2024 12:29:05 -0500 Subject: [PATCH] configure module layout --- waybar/config.jsonc | 81 ++++++----------------------------- waybar/modules/mediaplayer.py | 4 +- 2 files changed, 15 insertions(+), 70 deletions(-) diff --git a/waybar/config.jsonc b/waybar/config.jsonc index daef1a9..876e4fb 100644 --- a/waybar/config.jsonc +++ b/waybar/config.jsonc @@ -7,74 +7,21 @@ "spacing": 4, // Gaps between modules (4px) // Choose the order of the modules "modules-left": [ - "hyprland/workspaces" - //"sway/scratchpad" - //"custom/media" - //"hyprland/window" + "hyprland/workspaces", + "tray" ], "modules-center": [ - "clock" + "custom/spotify" ], "modules-right": [ - //"mpd", - "tray", "wireplumber", "network", "cpu", "memory", "temperature", - "idle_inhibitor" + "idle_inhibitor", + "clock" ], - // Modules configuration - // "sway/workspaces": { - // "disable-scroll": true, - // "all-outputs": true, - // "warp-on-scroll": false, - // "format": "{name}: {icon}", - // "format-icons": { - // "1": "", - // "2": "", - // "3": "", - // "4": "", - // "5": "", - // "urgent": "", - // "focused": "", - // "default": "" - // } - // }, - "sway/scratchpad": { - "format": "{icon} {count}", - "show-empty": false, - "format-icons": ["", ""], - "tooltip": true, - "tooltip-format": "{app}: {title}" - }, - "mpd": { - "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ", - "format-disconnected": "Disconnected ", - "format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ", - "unknown-tag": "N/A", - "interval": 2, - "consume-icons": { - "on": " " - }, - "random-icons": { - "off": " ", - "on": " " - }, - "repeat-icons": { - "on": " " - }, - "single-icons": { - "on": "1 " - }, - "state-icons": { - "paused": "", - "playing": "" - }, - "tooltip-format": "MPD (connected)", - "tooltip-format-disconnected": "MPD (disconnected)" - }, "idle_inhibitor": { "format": "{icon}", "format-icons": { @@ -87,12 +34,12 @@ "spacing": 10 }, "clock": { - // "timezone": "America/New_York", + "timezone": "America/New_York", "tooltip-format": "{:%Y %B}\n{calendar}", "format-alt": "{:%Y-%m-%d}" }, "cpu": { - "format": "{usage}% 󰻠", + "format": "󰻠 {usage}%", "tooltip": true }, "memory": { @@ -103,7 +50,7 @@ // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", "critical-threshold": 80, // "format-critical": "{temperatureC}°C {icon}", - "format": "{temperatureC}°C {icon}", + "format": "{icon} {temperatureC}°C", "format-icons": ["", "", ""] }, "wireplumber": { @@ -112,24 +59,22 @@ }, "network": { // "interface": "wlp2*", // (Optional) To force the use of this interface - "tooltip-format": "{essid} ({signalStrength}%)", - "format-wifi": "", + "tooltip-format": "{essid}", + "format-wifi": " {signalStrength}%", "format-ethernet": "󰈀", "format-linked": "{ifname} (No IP) ", "format-disconnected": "󰖪" //"format-alt": "{ifname}: {ipaddr}/{cidr}" }, - "custom/media": { - "format": "{icon} {}", + "custom/spotify": { + "format": "{}", "return-type": "json", "max-length": 40, "format-icons": { "spotify": "", "default": "🎜" }, - "escape": true, - "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder - // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name + "exec": "/usr/bin/python3 $HOME/.config/waybar/modules/mediaplayer.py --player spotify" // Filter player based on name } } diff --git a/waybar/modules/mediaplayer.py b/waybar/modules/mediaplayer.py index 4aea417..e473697 100644 --- a/waybar/modules/mediaplayer.py +++ b/waybar/modules/mediaplayer.py @@ -124,9 +124,9 @@ class PlayerManager: if track_info: if player.props.status == "Playing": - track_info = " " + track_info + track_info = " " + track_info else: - track_info = " " + track_info + track_info = " " + track_info # only print output if no other player is playing current_playing = self.get_first_playing_player() if current_playing is None or current_playing.props.player_name == player.props.player_name: