1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-10-09 19:11:15 +02:00

bin structure and vifm preview

This commit is contained in:
TiynGER
2020-03-31 20:32:16 +02:00
parent 148aaee349
commit 3ca4ecaaa1
27 changed files with 316 additions and 59 deletions

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env sh
# Give a battery name (e.g. BAT0) as an argument.
capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit
time=$(acpi | awk '{ print $5 }')
status=$(cat /sys/class/power_supply/"$1"/status)
[ -z $warn ] && warn=" "
[ "$status" = "Charging" ] && color="#ffffff"
printf "%s%s\n" "$(echo "$status" | sed -e "s/,//;s/Discharging/🔋/;s/Not Charging/🛑/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/' ) "

View File

@@ -0,0 +1,3 @@
#!/bin/sh
date +"%d %b %H:%M"

3
.local/bin/tools/statusbar/cpu Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
sensors | awk '/Core 0/ {print $3}'

12
.local/bin/tools/statusbar/disk Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env sh
# Status bar module for disk space
# $1 should be drive mountpoint
# $2 is optional icon, otherwise mountpoint will displayed
[ -z "$1" ] && exit
icon="$2"
[ -z "$2" ] && icon="$1"
printf "%s: %s\n" "$icon" "$(df -h "$1" | awk ' /[0-9]/ {print $3 "/" $2}')"

View File

@@ -0,0 +1,10 @@
#!/bin/sh
status() { \
echo "$(memory)|$(cpu)|$(disk /)|$(volume)|$(battery BAT0)|$(internet)|$(clock)"
}
while :; do
xsetroot -name "$(status | tr '\n' ' ')"
sleep 1m
done

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env sh
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡"
[ ! -n "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }')
printf "%s %s\n" "$wifiicon" "$(cat /sys/class/net/e*/operstate | sed "s/down/❎/;s/up/🌐/")"

View File

@@ -0,0 +1,3 @@
#!/bin/sh
free -h | awk '/^Mem:/ {print $3 "/" $2}'

View File

@@ -0,0 +1,5 @@
#!/bin/sh
# Refresh the dwmbar.
kill "$(pstree -lp | grep -- -dwmbar\([0-9] | sed "s/.*sleep(\([0-9]\+\)).*/\1/")"

View File

@@ -0,0 +1,15 @@
#!/bin/sh
[ "$(pulsemixer --get-mute)" = "1" ] && printf "🔇\\n" && exit
vol=$(pulsemixer --get-volume | awk '{print $1}')
if [ "$vol" -gt "70" ]; then
icon="🔊"
elif [ "$vol" -lt "30" ]; then
icon="🔈"
else
icon="🔉"
fi
printf "%s %s\\n" "$vol" "$icon"