From 100e4cd9417b3fe49b51762115718d6f49673540 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 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/package/swayscript/script/NetworkWidget.nix b/package/swayscript/script/NetworkWidget.nix index 89783e61..e6e004e3 100644 --- a/package/swayscript/script/NetworkWidget.nix +++ b/package/swayscript/script/NetworkWidget.nix @@ -26,26 +26,23 @@ 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 - printf "{\"text\": \"''${icon}\", \"tooltip\": \"''${networks[@]}\", \"class\": \"''${class}\"}\n" + networks=''${networks%\\\n} + printf "{\"text\": \"''${icon}\", \"tooltip\": \"''${networks}\", \"class\": \"''${class}\"}\n" } # Toggle network.