Configure dwm bar

This commit is contained in:
Wiktor Zykubek 2020-05-09 21:26:23 +02:00
parent f7f052dd87
commit 4b69ad7dd4
11 changed files with 84 additions and 6 deletions

15
.local/bin/scripts/dbar Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
sym="|"
cd "$HOME/.local/bin/scripts/dwmbar/" || exit 1
status() {
echo "$(./internet) $sym $(./lamp) $sym $(./music) $sym $(./alsa) $sym $(./packages) $sym $(./date) $sym $(./clock)"
}
while :; do
xsetroot -name " $(status | tr '\n' ' ')"
sleep 1m
done

View File

@ -1,6 +0,0 @@
#!/usr/bin/env bash
while true; do
xsetroot -name "  $(awk -F"[][]" '/dB/ { print $2 }' <(amixer sget Master)) |  $(date "+%H:%M:%S %p") |  $(pacman -Qu | wc -l) "
sleep 1
done

23
.local/bin/scripts/dwmbar/alsa Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
[ "$(amixer sget Master | awk 'NR==5 { print $6 }')" = "[off]" ] && {
echo " mut" && exit 1
}
level=$(amixer sget Master | awk -F"[][]" '/dB/ { print $2 }')
revel="${level%?}"
v1=""
v2=""
v3=""
if [ "$revel" -lt 20 ]; then
echo "$v1"
elif [ "$revel" -lt 50 ]; then
echo "$v2"
elif [ "$revel" -lt 75 ]; then
echo "$v3"
fi
echo "$level"

View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
echo ""
date "+%H:%M"

4
.local/bin/scripts/dwmbar/date Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
echo ""
date "+%a, %d-%m"

View File

@ -0,0 +1,13 @@
#!/bin/sh
if [ "$(cat /etc/hostname)" = "pc" ]; then
ip="$(eth-ip)"
echo ""
elif [ "$(cat /etc/hostname)" = "laptop" ]; then
ip="$(wifi-ip)"
echo ""
fi
ping -q -c 1 1.1.1.1 >/dev/null || { echo "dis" && exit 1; }
echo "$ip"

6
.local/bin/scripts/dwmbar/lamp Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
status=$(curl -s 192.168.1.201/status.php)
echo ""
[ "$status" = 1 ] && echo "on" || echo "off"

11
.local/bin/scripts/dwmbar/music Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
echo ""
if mpc status | grep -q "playing"; then
mpc | sed "/^volume:/d;s/\\&/&amp;/g;s/\\[playing\\].*//g"
elif mpc status | grep -q "paused"; then
echo ""
else
echo ""
fi

View File

@ -0,0 +1,3 @@
#!/bin/sh
echo " $(pacman -Qu | wc -l)"

3
.local/bin/scripts/eth-ip Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
ip a show enp3s0 | grep -Eo '(inet)?*([0-9]*\.){3}[0-9]*' | grep -v '**\.255'

View File

@ -1 +1,3 @@
#!/bin/sh
ip a show wlp8s0 | grep -Eo '(inet)?*([0-9]*\.){3}[0-9]*' | grep -v '**\.255'