From 3b61c3017179705944ba3b7468632c277b95ce3c Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Fri, 13 Dec 2024 13:29:10 +0300 Subject: [PATCH] Networkwidget: Simplify newline append. --- package/swayscript/script/NetworkWidget.nix | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/package/swayscript/script/NetworkWidget.nix b/package/swayscript/script/NetworkWidget.nix index 89783e61..234276d5 100644 --- a/package/swayscript/script/NetworkWidget.nix +++ b/package/swayscript/script/NetworkWidget.nix @@ -26,25 +26,22 @@ fi for net in ''${_vpns[@]}; do - [[ "''${networks}" = "" ]] || networks+="\\\n" - networks+=" ''${net}" + networks+=" ''${net}\\\n" done for net in ''${_ethernets[@]}; do - [[ "''${networks}" = "" ]] || networks+="\\\n" - networks+=" ''${net}" + networks+=" ''${net}\\\n" done for net in ''${_wifis[@]}; do - [[ "''${networks}" = "" ]] || networks+="\\\n" - networks+="󰖩 ''${net}" + networks+="󰖩 ''${net}\\\n" done for bt in ''${_bts[@]}; do - [[ "''${networks}" = "" ]] || networks+="\\\n" - networks+="󰂯 ''${bt}" + networks+="󰂯 ''${bt}\\\n" done + networks[-1]=''${networks[-1]%\\\n} printf "{\"text\": \"''${icon}\", \"tooltip\": \"''${networks[@]}\", \"class\": \"''${class}\"}\n" }