power menu, redshift, polybar
This commit is contained in:
17
.config/polybar/scripts/info-pingrtt/README.md
Normal file
17
.config/polybar/scripts/info-pingrtt/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Script: info-pingrtt
|
||||
|
||||
A script that displays a ping result. It also shows a colored icon.
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
|
||||
## Module
|
||||
|
||||
```ini
|
||||
[module/info-pingrtt]
|
||||
type = custom/script
|
||||
exec = ~/polybar-scripts/info-pingrtt.sh
|
||||
interval = 10
|
||||
```
|
||||
19
.config/polybar/scripts/info-pingrtt/info-pingrtt.sh
Normal file
19
.config/polybar/scripts/info-pingrtt/info-pingrtt.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
HOST=127.43.12.64
|
||||
|
||||
if ! ping=$(ping -n -c 1 -W 1 $HOST); then
|
||||
echo "# ping failed"
|
||||
else
|
||||
rtt=$(echo "$ping" | sed -rn 's/.*time=([0-9]{1,})\.?[0-9]{0,} ms.*/\1/p')
|
||||
|
||||
if [ "$rtt" -lt 50 ]; then
|
||||
icon="%{F#3cb703}#%{F-}"
|
||||
elif [ "$rtt" -lt 150 ]; then
|
||||
icon="%{F#f9dd04}#%{F-}"
|
||||
else
|
||||
icon="%{F#d60606}#%{F-}"
|
||||
fi
|
||||
|
||||
echo "$icon $rtt ms"
|
||||
fi
|
||||
BIN
.config/polybar/scripts/info-pingrtt/screenshots/1.png
Normal file
BIN
.config/polybar/scripts/info-pingrtt/screenshots/1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 794 B |
BIN
.config/polybar/scripts/info-pingrtt/screenshots/2.png
Normal file
BIN
.config/polybar/scripts/info-pingrtt/screenshots/2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 878 B |
BIN
.config/polybar/scripts/info-pingrtt/screenshots/3.png
Normal file
BIN
.config/polybar/scripts/info-pingrtt/screenshots/3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 989 B |
Reference in New Issue
Block a user