diff --git a/config b/config index b6176fd..d0df4d5 100644 --- a/config +++ b/config @@ -13,7 +13,7 @@ exec --no-startup-id xrandr --output DSI-1 --rotate right -exec_always --no-startup-id feh --bg-scale ~/Pictures/uconsole.jpg +exec_always --no-startup-id feh --bg-scale ~/.config/i3/wallp/mur1.png set $mod Mod1 diff --git a/i3blocks.conf b/i3blocks.conf index 9572dff..c3bf21e 100644 --- a/i3blocks.conf +++ b/i3blocks.conf @@ -139,7 +139,7 @@ separator=true # [wireguard] -command=~/.config/i3/scripts/wg_check.sh +command=~/.config/i3/scripts/wghand.sh interval=10 diff --git a/scripts/wghand.sh b/scripts/wghand.sh new file mode 100755 index 0000000..b2503e8 --- /dev/null +++ b/scripts/wghand.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# Run the command and capture the output + +ICON_UP="" +ICON_DOWN="" + + + + +# Run the command and capture the output +output=$(sudo wg show wg0) + +# Extract the last handshake time in the format "X seconds/minutes/hours ago" +last_handshake_string=$(echo "$output" | grep "latest handshake" | awk '{print $3, $4}') + +# Function to extract seconds from the time string +extract_seconds() { + local time_string="$1" + local seconds=0 + + if [[ $time_string == *"seconds"* ]]; then + seconds=$(echo "$time_string" | awk '{print $1}') + elif [[ $time_string == *"minutes"* ]]; then + minutes=$(echo "$time_string" | awk '{print $1}') + seconds=$((minutes * 60)) + elif [[ $time_string == *"hours"* ]]; then + hours=$(echo "$time_string" | awk '{print $1}') + seconds=$((hours * 3600)) + fi + + echo "$seconds" +} + +# Get the number of seconds from the time string +last_handshake_seconds=$(extract_seconds "$last_handshake_string") + +# Check if the last handshake is smaller than 1 minute (60 seconds) +if [ "$last_handshake_seconds" -lt 50 ]; then + + echo $ICON_UP + echo + echo \#008000 + + +fi + diff --git a/wallp/aple.jpg b/wallp/aple.jpg new file mode 100644 index 0000000..e23c54b Binary files /dev/null and b/wallp/aple.jpg differ diff --git a/wallp/mur1.png b/wallp/mur1.png new file mode 100644 index 0000000..78dc8ff Binary files /dev/null and b/wallp/mur1.png differ diff --git a/wallp/mur2.png b/wallp/mur2.png new file mode 100644 index 0000000..be93869 Binary files /dev/null and b/wallp/mur2.png differ