cleanup octopus

Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
This commit is contained in:
Frank Villaro-Dixon 2022-05-31 22:46:13 +02:00
parent c513d10fc3
commit bd2251025d

View file

@ -14,80 +14,18 @@ case $1 in
"vol"|"volume") "vol"|"volume")
case $2 in case $2 in
"up") "up")
amixer -q set Master 5%+ unmute pactl set-sink-volume @DEFAULT_SINK@ +5%
;; ;;
"down") "down")
amixer -q set Master 5%- unmute pactl set-sink-volume @DEFAULT_SINK@ -5%
;; ;;
"mute") "mute")
amixer -q set Headphone toggle pactl set-sink-mute @DEFAULT_SINK@ toggle
amixer -q set Master toggle
;;
"max")
amixer -q set Master 100% unmute
;; ;;
esac esac
$0 refresh $0 refresh
;; ;;
"audio")
#so that '$0 refresh' will be up2date (song didn't change after)
mpc_cmd='mpc --wait'
case $2 in
"toggle")
$mpc_cmd toggle
;;
"pause")
$mpc_cmd pause
;;
"next")
$mpc_cmd next
;;
"prev")
$mpc_cmd prev
;;
esac
$0 refresh
;;
"play")
case $2 in
"inception")
$0 audio pause
$0 vol max
NN=`dirname $0`
mplayer $NN/audio/inception.mp3
;;
esac
;;
"leds")
case $2 in
"power")
case $3 in
"off")
echo 0 | sudo tee /sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/brightness
;;
"on")
echo 1 | sudo tee /sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/brightness
;;
esac
;;
"thinklight")
case $3 in
"off")
echo 0 | sudo tee /sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/brightness
;;
"on")
echo 1 | sudo tee /sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/brightness
;;
esac
;;
esac
;;
"monitor") "monitor")
#SNU=`xrandr | grep VGA | cut -d' ' -f1 | cut -c4` #SNU=`xrandr | grep VGA | cut -d' ' -f1 | cut -c4`
@ -150,21 +88,11 @@ case $1 in
"refresh") "refresh")
DATE=`date +"%a %e %Hh%M"` DATE=`date +"%a %e %Hh%M"`
BATT_PCT=$(acpi -b | cut -d, -f2 | cut -d" " -f2) BATT_PCT=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep 'percentage' | cut -d':' -f2 | xargs)
BATT_TIME=$(acpi -b | cut -d, -f3 | cut -d" " -f2)
VOLUME=`/usr/bin/amixer get Master | grep "%" | cut -d' ' -f7 | head -n1` VOLUME=`pactl get-sink-volume @DEFAULT_SINK@ | cut -d'/' -f4 | head -n1 | xargs`
## VOLUME=`amixer get Master | grep '\[' | cut -d' ' -f6`
xsetroot -name "Vol $VOLUME :: Bat $BATT_PCT $BATT_TIME :: $DATE" || true
MEMFREE=`awk '/MemFree/ {printf( "%.0f", $2 / 1024 )}' /proc/meminfo`
MEMCACHED=`awk '/Cached/ {printf( "%.0f", $2 / 10240 )}' /proc/meminfo`
MEMFT=`echo "$MEMFREE + $MEMCACHED" | bc`
xsetroot -name "$VOLUME :: Bat $BATT_PCT $BATT_TIME :: $DATE" || true
# $0 conf-ifaces
# $0 leds power off
$0 checkbatt
;; ;;
"checkbatt") "checkbatt")
@ -182,49 +110,14 @@ case $1 in
#fi; #fi;
#;; #;;
"wallpaper")
~/Pictures/wallpapers/chooseWP.sh || true &
;;
"conf-ifaces")
if lsusb | grep -q 'M105 Optical Mouse'; then
sudo ifconfig eth0 up
sudo ifconfig wlan0 down
else
sudo ifconfig wlan0 up
fi
;;
"reset-screen") "reset-screen")
$0 init-all $0 init-all
;; ;;
"init-all") "init-all")
sudo killall dhcpcd
$0 init-wifi &
$0 init-ethernet &
$0 init-mouse
$0 wallpaper
$0 monitor dual $0 monitor dual
;; ;;
"init-mouse")
sudo tpkbdctl -s255 || true
;;
"init-wifi")
sudo killall wpa_supplicant
sudo wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf &
sleep 1
sudo ifconfig wlan0 up
sudo dhcpcd wlan0 -b -m 1000 -p -t 0 &
;;
"init-ethernet")
sudo ifconfig eth0 up &
sudo dhcpcd eth0 -b -m 10 -p -t 0 &
;;
"suspend") "suspend")
slock & slock &
systemctl suspend -i systemctl suspend -i
@ -236,10 +129,6 @@ case $1 in
#$0 monitor off #$0 monitor off
;; ;;
"print")
sudo systemctl start org.cups.cupsd #fucking name changes…
;;
esac esac
# vim: ts=4 # vim: ts=4