From 711c9a31f9f1bbac0a0015938caeeaf9f81458d2 Mon Sep 17 00:00:00 2001 From: Konstantin Koslowski Date: Fri, 14 May 2021 12:03:16 +0200 Subject: [PATCH] waybar: update configs - waybar: rename to start_waybar.sh - waybar_card: minor formatting in tooltip - waybar_mediaplayer: add icons to tooltip --- bin/{waybar => start_waybar.sh} | 9 ++++----- bin/waybar_card.sh | 2 +- bin/waybar_mediaplayer.py | 2 +- config | 2 +- waybar.d/config | 21 ++++++++++++++++----- waybar.d/config_annoyance | 21 ++++++++++++++++----- 6 files changed, 39 insertions(+), 18 deletions(-) rename bin/{waybar => start_waybar.sh} (72%) diff --git a/bin/waybar b/bin/start_waybar.sh similarity index 72% rename from bin/waybar rename to bin/start_waybar.sh index 550a0ee..822b084 100755 --- a/bin/waybar +++ b/bin/start_waybar.sh @@ -9,9 +9,8 @@ fi STYLE=$CONFIG_DIR/style.css # Terminate already running bar instances -pkill -SIGUSR2 -x waybar - -if [ $? -ne 0 ]; then - waybar -c $CONFIG -s $STYLE -fi +# pkill -SIGUSR2 -x waybar +pkill -x waybar +# execute new instance +waybar -c $CONFIG -s $STYLE diff --git a/bin/waybar_card.sh b/bin/waybar_card.sh index 62ab7f4..8be4c23 100755 --- a/bin/waybar_card.sh +++ b/bin/waybar_card.sh @@ -8,7 +8,7 @@ tooltip="" alt="missing" ret=$($CMD 2> /dev/null) if [ $? -eq 0 ]; then - tooltip="S/N: $(echo $ret | grep -oE 'Serial number[.:0-9 ]*' | grep -oE '[0-9]*')" + tooltip="S/N $(echo $ret | grep -oE 'Serial number[.:0-9 ]*' | grep -oE '[0-9]*')" alt="available" fi diff --git a/bin/waybar_mediaplayer.py b/bin/waybar_mediaplayer.py index 42b51e4..a7266ce 100755 --- a/bin/waybar_mediaplayer.py +++ b/bin/waybar_mediaplayer.py @@ -18,7 +18,7 @@ def write_output(text, player): title = m.get("xesam:title", "unknown") artist = ",".join(x for x in m.get("xesam:artist")) album = m.get("xesam:album") - tooltip = f"{artist}\n{title}\n{album}" + tooltip = f" {artist}\n {title}\n {album}" output = {'text': text, 'tooltip': tooltip, 'class': 'custom-' + player.props.player_name, diff --git a/config b/config index 7ccd555..18fa1f7 100644 --- a/config +++ b/config @@ -301,7 +301,7 @@ for_window [class="Signal" window_type="normal"] exec sh -c "sleep 1"; mark c; f # # Status Bar: # -exec_always $HOME/.config/sway/bin/waybar +exec_always $HOME/.config/sway/bin/start_waybar.sh # # Autostart # diff --git a/waybar.d/config b/waybar.d/config index 3f90e8a..a698daf 100644 --- a/waybar.d/config +++ b/waybar.d/config @@ -11,6 +11,11 @@ "custom/separator#left" ], "modules-center": [ + "custom/separator#right", + "custom/media", + "custom/separator#center", + "pulseaudio", + "custom/separator#left" ], "modules-right": [ "custom/separator#right", @@ -18,10 +23,6 @@ "custom/separator#right", "custom/mail", "custom/separator#right", - "pulseaudio", - "custom/separator#right", - "custom/media", - "custom/separator#right", "network#wl0", "network#en0", "network#vpn0", @@ -38,6 +39,10 @@ "custom/separator#left": { "format": " " }, + "custom/separator#center": { + // "format": " " + "format": " | " + }, "custom/separator#right": { "format": " " }, @@ -189,7 +194,13 @@ "car": "", "default": ["", "", ""] }, - "on-click": "pkill -x pavucontrol || pavucontrol" + "min-length": 14, + "max-length": 20, + "on-click": "$HOME/.config/sway/bin/sway_volume mute", + "on-click-middle": "$HOME/.config/sway/bin/sway_volume gui", + "on-click-right": "$HOME/.config/sway/bin/sway_volume source-mute", + "on-scroll-up": "$HOME/.config/sway/bin/sway_volume increase", + "on-scroll-down": "$HOME/.config/sway/bin/sway_volume decrease-mute" }, "tray": { "padding": 10, diff --git a/waybar.d/config_annoyance b/waybar.d/config_annoyance index 4161e72..a9ee1ca 100644 --- a/waybar.d/config_annoyance +++ b/waybar.d/config_annoyance @@ -11,6 +11,11 @@ "custom/separator#left" ], "modules-center": [ + "custom/separator#right", + "custom/media", + "custom/separator#center", + "pulseaudio", + "custom/separator#left" ], "modules-right": [ "custom/separator#right", @@ -18,10 +23,6 @@ "custom/separator#right", "custom/mail", "custom/separator#right", - "pulseaudio", - "custom/separator#right", - "custom/media", - "custom/separator#right", "network#en0", "network#vpn0", "custom/separator#right", @@ -35,6 +36,10 @@ "custom/separator#left": { "format": " " }, + "custom/separator#center": { + // "format": " " + "format": " | " + }, "custom/separator#right": { "format": " " }, @@ -186,7 +191,13 @@ "car": "", "default": ["", "", ""] }, - "on-click": "pkill -x pavucontrol || pavucontrol" + "min-length": 14, + "max-length": 20, + "on-click": "$HOME/.config/sway/bin/sway_volume mute", + "on-click-middle": "$HOME/.config/sway/bin/sway_volume gui", + "on-click-right": "$HOME/.config/sway/bin/sway_volume source-mute", + "on-scroll-up": "$HOME/.config/sway/bin/sway_volume increase", + "on-scroll-down": "$HOME/.config/sway/bin/sway_volume decrease-mute" }, "tray": { "padding": 10,