Skip to content

Commit

Permalink
fixing stripping of whitespace in tmux options and lack of wifi label…
Browse files Browse the repository at this point in the history
… on linux
  • Loading branch information
hugo committed Oct 9, 2024
1 parent 3c90f7e commit 1325b49
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions scripts/network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ get_ssid()
Linux)
SSID=$(iw dev | sed -nr 's/^\t\tssid (.*)/\1/p')
if [ -n "$SSID" ]; then
printf '%s' "$wifi_label$SSID"
echo "$wifi_label$SSID"
else
echo "$ethernet_label"
fi
Expand Down Expand Up @@ -45,7 +45,7 @@ main()
{
network="$(get_tmux_option "@dracula-network-offline-label" "Offline")"
for host in $HOSTS; do
if ping -q -c 1 -W 1 $host &>/dev/null; then
if ping -q -c 1 -W 1 "$host" &>/dev/null; then
network="$(get_ssid)"
break
fi
Expand Down
20 changes: 10 additions & 10 deletions scripts/utils.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#!/usr/bin/env bash

get_tmux_option() {
local option=$1
local default_value=$2
local option_value=$(tmux show-option -gqv "$option")
local option="$1"
local default_value="$2"
local option_value="$(tmux show-option -gqv "$option")"
if [ -z "$option_value" ]; then
echo $default_value
echo "$default_value"
else
echo $option_value
echo "$option_value"
fi
}

get_tmux_window_option() {
local option=$1
local default_value=$2
local option_value=$(tmux show-window-options -v "$option")
local option="$1"
local default_value="$2"
local option_value="$(tmux show-window-options -v "$option")"
if [ -z "$option_value" ]; then
echo $default_value
echo "$default_value"
else
echo $option_value
echo "$option_value"
fi
}

Expand Down

0 comments on commit 1325b49

Please sign in to comment.