mirror of
https://github.com/kuhyx/scripts.git
synced 2026-07-06 14:13:01 +02:00
feat: add detector for whether connected to warp cli or not
This commit is contained in:
parent
b4da680d61
commit
ea2f44e161
7
i3-configuration/i3blocks/config
Normal file → Executable file
7
i3-configuration/i3blocks/config
Normal file → Executable file
@ -28,11 +28,13 @@ color=#50FA7B
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[volume]
|
[volume]
|
||||||
command=~/.config/i3blocks/volume.sh
|
command=~/.config/i3blocks/volume.sh
|
||||||
interval=1
|
interval=1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[bluetooth]
|
[bluetooth]
|
||||||
command=~/.config/i3blocks/bluetooth.sh
|
command=~/.config/i3blocks/bluetooth.sh
|
||||||
interval=5
|
interval=5
|
||||||
@ -62,6 +64,11 @@ color=#FFFFFF
|
|||||||
#color=#FFFFFF
|
#color=#FFFFFF
|
||||||
|
|
||||||
|
|
||||||
|
[warp]
|
||||||
|
command=~/.config/i3blocks/warp_status.sh
|
||||||
|
interval=60
|
||||||
|
|
||||||
|
|
||||||
[time]
|
[time]
|
||||||
command=echo " $(date '+%Y-%m-%d %H:%M')" # for time (Font Awesome icon)
|
command=echo " $(date '+%Y-%m-%d %H:%M')" # for time (Font Awesome icon)
|
||||||
interval=1
|
interval=1
|
||||||
|
|||||||
24
i3-configuration/i3blocks/warp_status.sh
Executable file
24
i3-configuration/i3blocks/warp_status.sh
Executable 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
|
||||||
@ -41,6 +41,8 @@ fi
|
|||||||
# Set font size based on screen resolution
|
# Set font size based on screen resolution
|
||||||
font_size=$(set_font_size)
|
font_size=$(set_font_size)
|
||||||
|
|
||||||
|
# Make all scripts in i3blocks executable
|
||||||
|
find i3blocks -type f -exec chmod +x {} \;
|
||||||
cp -r i3blocks ~/.config/
|
cp -r i3blocks ~/.config/
|
||||||
cp -r i3 ~/.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
|
sed -i "s/font pango:System San Francisco Display, FontAwesome [0-9]*/font pango:System San Francisco Display, FontAwesome $font_size/" ~/.config/i3/config
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user