diff --git a/.local/bin/scripts/dbar b/.local/bin/scripts/dbar new file mode 100755 index 0000000..f286dcc --- /dev/null +++ b/.local/bin/scripts/dbar @@ -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 diff --git a/.local/bin/scripts/dwmbar b/.local/bin/scripts/dwmbar deleted file mode 100755 index e14e5d2..0000000 --- a/.local/bin/scripts/dwmbar +++ /dev/null @@ -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 diff --git a/.local/bin/scripts/dwmbar/alsa b/.local/bin/scripts/dwmbar/alsa new file mode 100755 index 0000000..340d397 --- /dev/null +++ b/.local/bin/scripts/dwmbar/alsa @@ -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" diff --git a/.local/bin/scripts/dwmbar/clock b/.local/bin/scripts/dwmbar/clock new file mode 100755 index 0000000..ba2c4c1 --- /dev/null +++ b/.local/bin/scripts/dwmbar/clock @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +echo "" +date "+%H:%M" diff --git a/.local/bin/scripts/dwmbar/date b/.local/bin/scripts/dwmbar/date new file mode 100755 index 0000000..1e801f3 --- /dev/null +++ b/.local/bin/scripts/dwmbar/date @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "" +date "+%a, %d-%m" diff --git a/.local/bin/scripts/dwmbar/internet b/.local/bin/scripts/dwmbar/internet new file mode 100755 index 0000000..05f358c --- /dev/null +++ b/.local/bin/scripts/dwmbar/internet @@ -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" diff --git a/.local/bin/scripts/dwmbar/lamp b/.local/bin/scripts/dwmbar/lamp new file mode 100755 index 0000000..b0ec7dc --- /dev/null +++ b/.local/bin/scripts/dwmbar/lamp @@ -0,0 +1,6 @@ +#!/bin/sh + +status=$(curl -s 192.168.1.201/status.php) + +echo "" +[ "$status" = 1 ] && echo "on" || echo "off" diff --git a/.local/bin/scripts/dwmbar/music b/.local/bin/scripts/dwmbar/music new file mode 100755 index 0000000..fc99166 --- /dev/null +++ b/.local/bin/scripts/dwmbar/music @@ -0,0 +1,11 @@ +#!/bin/sh + +echo "" +if mpc status | grep -q "playing"; then + mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[playing\\].*//g" +elif mpc status | grep -q "paused"; then + echo "" +else + echo "" +fi + diff --git a/.local/bin/scripts/dwmbar/packages b/.local/bin/scripts/dwmbar/packages new file mode 100755 index 0000000..c3368b4 --- /dev/null +++ b/.local/bin/scripts/dwmbar/packages @@ -0,0 +1,3 @@ +#!/bin/sh + +echo " $(pacman -Qu | wc -l)" diff --git a/.local/bin/scripts/eth-ip b/.local/bin/scripts/eth-ip new file mode 100755 index 0000000..841db28 --- /dev/null +++ b/.local/bin/scripts/eth-ip @@ -0,0 +1,3 @@ +#!/bin/sh + +ip a show enp3s0 | grep -Eo '(inet)?*([0-9]*\.){3}[0-9]*' | grep -v '**\.255' diff --git a/.local/bin/scripts/wifi-ip b/.local/bin/scripts/wifi-ip index 4fd3755..7f82461 100755 --- a/.local/bin/scripts/wifi-ip +++ b/.local/bin/scripts/wifi-ip @@ -1 +1,3 @@ +#!/bin/sh + ip a show wlp8s0 | grep -Eo '(inet)?*([0-9]*\.){3}[0-9]*' | grep -v '**\.255'