diff --git a/i3blocks/battery_status.sh b/i3blocks/battery_status.sh index 7510289..bba1a05 100755 --- a/i3blocks/battery_status.sh +++ b/i3blocks/battery_status.sh @@ -6,7 +6,6 @@ acpi -b | awk -F', ' ' split($3, time, " ") printf " %d%%", percent[1] if (time[1] != "") printf ", %s", time[1] - if ($1 ~ /Charging/) printf ", Charging" + if ($1 ~ /Charging/) printf ", " printf "\n" - }' - + }' \ No newline at end of file diff --git a/i3blocks/config b/i3blocks/config index 56f21e5..8966980 100644 --- a/i3blocks/config +++ b/i3blocks/config @@ -43,6 +43,10 @@ color=#50FA7B command=ip -o -4 addr show enp6s0 | awk '{print " LAN: "$4}' || echo " LAN: down" #  for Ethernet interval=10 +[wifi] +command=~/.config/i3blocks/wifi_monitor.sh +interval=10 + [network_monitor] command=~/.config/i3blocks/network_monitor.sh interval=1 diff --git a/i3blocks/wifi_monitor.sh b/i3blocks/wifi_monitor.sh new file mode 100755 index 0000000..eb27370 --- /dev/null +++ b/i3blocks/wifi_monitor.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Detect the active WiFi interface +wifi_interface=$(iw dev | awk '$1=="Interface"{print $2}') + +# If no WiFi interface is found, exit +if [ -z "$wifi_interface" ]; then + echo " WiFi: down" + exit 1 +fi + +# Get the WiFi details +wifi_info=$(iwconfig $wifi_interface 2>/dev/null) + +# Extract the SSID and signal strength +ssid=$(echo "$wifi_info" | awk -F '"' '/ESSID/ {print $2}') +signal=$(echo "$wifi_info" | awk '/Signal level/ {print $4}' | tr -d 'level=') + +# Output the result +if [ -z "$ssid" ]; then + echo " down" +else + echo " $ssid ($signal dBm)" +fi \ No newline at end of file diff --git a/install.sh b/install.sh index 1ab80be..5ce83e2 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,5 @@ #!/bin/sh -yes | sudo pacman -S --needed ttf-dejavu noto-fonts ttf-font-awesome bc intel-gpu-tools jq +yes | sudo pacman -S --needed ttf-dejavu noto-fonts ttf-font-awesome bc intel-gpu-tools jq iw sudo setcap cap_perfmon+ep /usr/bin/intel_gpu_top cp -r i3blocks ~/.config/ cp -r i3 ~/.config/