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:
12
.local/bin/tools/statusbar/battery
Executable file
12
.local/bin/tools/statusbar/battery
Executable 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/$/%/' ) "
|
3
.local/bin/tools/statusbar/clock
Executable file
3
.local/bin/tools/statusbar/clock
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
date +"%d %b %H:%M"
|
3
.local/bin/tools/statusbar/cpu
Executable file
3
.local/bin/tools/statusbar/cpu
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
sensors | awk '/Core 0/ {print $3}'
|
12
.local/bin/tools/statusbar/disk
Executable file
12
.local/bin/tools/statusbar/disk
Executable 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}')"
|
10
.local/bin/tools/statusbar/dwmbar
Executable file
10
.local/bin/tools/statusbar/dwmbar
Executable 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
|
||||
|
7
.local/bin/tools/statusbar/internet
Executable file
7
.local/bin/tools/statusbar/internet
Executable 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/🌐/")"
|
3
.local/bin/tools/statusbar/memory
Executable file
3
.local/bin/tools/statusbar/memory
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
free -h | awk '/^Mem:/ {print $3 "/" $2}'
|
5
.local/bin/tools/statusbar/refbar
Executable file
5
.local/bin/tools/statusbar/refbar
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Refresh the dwmbar.
|
||||
|
||||
kill "$(pstree -lp | grep -- -dwmbar\([0-9] | sed "s/.*sleep(\([0-9]\+\)).*/\1/")"
|
15
.local/bin/tools/statusbar/volume
Executable file
15
.local/bin/tools/statusbar/volume
Executable 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"
|
Reference in New Issue
Block a user