Browse Source

Added dwm_battery and SSID to dwm_network

patch-fontkeys
joestandring 5 years ago
parent
commit
c4aed956a6
3 changed files with 36 additions and 2 deletions
  1. +7
    -1
      README.md
  2. +24
    -0
      bar-functions/dwm_battery.sh
  3. +5
    -1
      bar-functions/dwm_network.sh

+ 7
- 1
README.md View File

@ -8,6 +8,7 @@ A modular statusbar for DWM
- [dwm_countdown](#dwm_countdown) - [dwm_countdown](#dwm_countdown)
- [dwm_keyboard](#dwm_keyboard) - [dwm_keyboard](#dwm_keyboard)
- [dwm_resources](#dwm_resources) - [dwm_resources](#dwm_resources)
- [dwm_battery](#dwm_battery)
- [dwm_cmus](#dwm_cmus) - [dwm_cmus](#dwm_cmus)
- [dwm_date](#dwm_date) - [dwm_date](#dwm_date)
- [dwm_mail](#dwm_mail) - [dwm_mail](#dwm_mail)
@ -53,6 +54,11 @@ Displays information regarding memory, CPU temperature, and storage
``` ```
[🖥 MEM 1.3Gi/15Gi CPU 45C STO 2.3G/200G: 2%] [🖥 MEM 1.3Gi/15Gi CPU 45C STO 2.3G/200G: 2%]
``` ```
### dwm_battery
Displays battery level and status
```
[🔌 55 Charging]
```
### dwm_cmus ### dwm_cmus
displays current cmus status, artist, track, position, duration, and shuffle displays current cmus status, artist, track, position, duration, and shuffle
``` ```
@ -75,7 +81,7 @@ Displays the current weather provided by [wttr.in](https://wttr.in)
[☀ +20°C] [☀ +20°C]
``` ```
### dwm_network ### dwm_network
Displays the current network connection, private IP, and public IP
Displays the current network connection/SSID, private IP, and public IP
``` ```
[🌐 enp7s0: 192.168.0.1/24 | 185.199.109.153] [🌐 enp7s0: 192.168.0.1/24 | 185.199.109.153]
``` ```


+ 24
- 0
bar-functions/dwm_battery.sh View File

@ -0,0 +1,24 @@
#!/bin/sh
# A dwm_bar function to read the battery level and status
# Joe Standring <git@joestandring.com>
# GNU GPLv3
dwm_battery () {
# Change BAT1 to whatever your battery is identified as. Typically BAT0 or BAT1
CHARGE=$(cat /sys/class/power_supply/BAT1/capacity)
STATUS=$(cat /sys/class/power_supply/BAT1/status)
if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$STATUS" = "Charging" ]; then
printf "[🔌 %s %s]\n" "$CHARGE" "$STATUS"
else
printf "[🔋 %s %s]\n" "$CHARGE" "$STATUS"
fi
else
printf "[BAT %s %s]\n" "$CHARGE" "$STATUS"
fi
}
dwm_battery

+ 5
- 1
bar-functions/dwm_network.sh View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# A dwm_bar function to show the current network connection, private IP, and public IP
# A dwm_bar function to show the current network connection/SSID, private IP, and public IP
# Joe Standring <git@joestandring.com> # Joe Standring <git@joestandring.com>
# GNU GPLv3 # GNU GPLv3
@ -8,6 +8,10 @@
dwm_network () { dwm_network () {
CONNAME=$(nmcli -a | grep 'Wired connection' | awk 'NR==1{print $1}') CONNAME=$(nmcli -a | grep 'Wired connection' | awk 'NR==1{print $1}')
if [ "$CONNAME" = "" ]; then
CONNAME=$(nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -c 5-)
fi
PRIVATE=$(nmcli -a | grep 'inet4 192' | awk '{print $2}') PRIVATE=$(nmcli -a | grep 'inet4 192' | awk '{print $2}')
PUBLIC=$(curl -s https://ipinfo.io/ip) PUBLIC=$(curl -s https://ipinfo.io/ip)


Loading…
Cancel
Save