feat: add detector for whether connected to warp cli or not

This commit is contained in:
Krzysztof kuhy Rudnicki 2025-04-28 10:35:49 +02:00
parent b4da680d61
commit ea2f44e161
3 changed files with 33 additions and 0 deletions

7
i3-configuration/i3blocks/config Normal file → Executable file
View File

@ -28,11 +28,13 @@ color=#50FA7B
[volume]
command=~/.config/i3blocks/volume.sh
interval=1
[bluetooth]
command=~/.config/i3blocks/bluetooth.sh
interval=5
@ -62,6 +64,11 @@ color=#FFFFFF
#color=#FFFFFF
[warp]
command=~/.config/i3blocks/warp_status.sh
interval=60
[time]
command=echo " $(date '+%Y-%m-%d %H:%M')" #  for time (Font Awesome icon)
interval=1

View File

@ -0,0 +1,24 @@
#!/bin/bash
# Check if warp-cli is installed
if ! command -v warp-cli &> /dev/null; then
echo " N/A"
exit 0
fi
# Get the status from warp-cli
status=$(warp-cli status 2>/dev/null | grep "Status update:" | awk '{print $3}')
# Display the status with an icon
if [ "$status" = "Connected" ]; then
echo "!!! WARP CONNECTED !!!"
echo
echo "#FFFF00" # Yellow
elif [ "$status" = "Disconnected" ]; then
echo "warp disconnected"
else
echo "! WARP unknown !"
echo
echo "#FF0000" # Yellow
exit 0
fi

View File

@ -41,6 +41,8 @@ fi
# Set font size based on screen resolution
font_size=$(set_font_size)
# Make all scripts in i3blocks executable
find i3blocks -type f -exec chmod +x {} \;
cp -r i3blocks ~/.config/
cp -r i3 ~/.config/
sed -i "s/font pango:System San Francisco Display, FontAwesome [0-9]*/font pango:System San Francisco Display, FontAwesome $font_size/" ~/.config/i3/config