make POSIX sh compliant

This commit is contained in:
2025-12-18 14:12:29 -08:00
parent 1f48d9808c
commit cdae221acf
11 changed files with 63 additions and 20 deletions

View File

@ -1,7 +1,8 @@
#!/bin/sh #!/bin/sh
CARD=$(pactl list cards short | grep '1f.3' | awk '{print $2}') CARD=$(pactl list cards short | grep '1f.3' | awk '{print $2}')
CURRENT_SINK=$(pactl info | grep "Default Sink:") CURRENT_SINK=$(pactl info | grep "Default Sink:")
if [[ "$CURRENT_SINK" == *"iec958"* ]]; then dunstctl close-all
if [ "$CURRENT_SINK" = *"iec958"* ]; then
pactl set-card-profile $CARD output:analog-stereo pactl set-card-profile $CARD output:analog-stereo
notify-send "analog out active" -i : notify-send "analog out active" -i :
else else

8
bin/displayctl Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
DISPLAY_STATUS=$(xrandr | grep DP-2)
if [ "$DISPLAY_STATUS" = *"1440x3440"* ]; then
xrandr --output DP-2 --off
else
init_displays
fi

27
bin/espdev Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
if [ $1 = "source" ]; then
echo "sourcing and exiting..."
. $HOME/esp/esp-idf/export.sh
exit
fi
. $HOME/esp/esp-idf/export.sh
echo "cleaning up..."
idf.py fullclean
echo "done cleaning."
echo "building..."
idf.py build
echo "done building."
echo "flashing..."
idf.py -p /dev/ttyACM0 flash
echo "done flashing."
read -n 1 input -p "monitor serial output? [y/n]"
if [ $input = y ]; then
echo "monitoring..."
idf.py -p /dev/ttyACM0 monitor
else if [ $input = n ]; then
exit
else
echo "yes or no dude..."
fi

View File

@ -2,20 +2,20 @@
GSRPID=$(pidof gpu-screen-recorder) GSRPID=$(pidof gpu-screen-recorder)
DWMBLOCKSPID=$(pidof dwmblocks) DWMBLOCKSPID=$(pidof dwmblocks)
if [[ -n $GSRPID ]]; then if [ -n $GSRPID ]; then
kill -n 2 $GSRPID kill -n 2 $GSRPID
kill -n 36 $DWMBLOCKSPID kill -n 36 $DWMBLOCKSPID
notify-send "recording saved" -i : notify-send "recording saved" -i :
exit exit
fi fi
if [[ $1 == 1 ]]; then if [ $1 = 1 ]; then
gpu-screen-recorder -w DP-0 -k hevc -c mkv -f 60 -bm cbr -q 12000 -ac opus -a "default_output" \ gpu-screen-recorder -w DP-4 -k hevc -c mkv -f 60 -bm cbr -q 12000 -ac opus -a "default_output" \
-o "$HOME/wdraidz/media/game-videos/$(date +%m-%d-%Y_%R:%S).mkv"& -o "$HOME/wdraidz/media/game-videos/$(date +%m-%d-%Y_%R:%S).mkv"&
kill -n 36 $DWMBLOCKSPID kill -n 36 $DWMBLOCKSPID
notify-send "recording started with no mic" -i : notify-send "recording started with no mic" -i :
else else
gpu-screen-recorder -w DP-0 -k hevc -c mkv -f 60 -bm cbr -q 12000 -ac opus -a "default_output|default_input" \ gpu-screen-recorder -w DP-4 -k hevc -c mkv -f 60 -bm cbr -q 12000 -ac opus -a "default_output|default_input" \
-o "$HOME/wdraidz/media/game-videos/$(date +%m-%d-%Y_%R:%S).mkv"& -o "$HOME/wdraidz/media/game-videos/$(date +%m-%d-%Y_%R:%S).mkv"&
kill -n 36 $DWMBLOCKSPID kill -n 36 $DWMBLOCKSPID
notify-send "recording started" -i : notify-send "recording started" -i :

View File

@ -2,11 +2,11 @@
SCREEN="ffmpeg -s 3440x1440 -f x11grab -r 60 -i :0.0+0,0" SCREEN="ffmpeg -s 3440x1440 -f x11grab -r 60 -i :0.0+0,0"
SYSTEM_AUDIO="-f pulse -i alsa_output.pci-0000_00_1f.3.iec958-stereo.monitor" SYSTEM_AUDIO="-f pulse -i alsa_output.pci-0000_00_1f.3.iec958-stereo.monitor"
MICROPHONE="-f pulse -i default:monitor" MICROPHONE="-f pulse -i default:monitor"
COMPRESSION="-c:a flac -c:v hevc_nvenc -b:v 12M" COMPRESSION="-c:a flac -c:v hevc_nvenc -b:v 10M"
FILENAME="$HOME/wdraidz/media/game-videos/$(date +%m-%d-%Y_%R:%S).mkv" FILENAME="$HOME/wdraidz/media/game-videos/$(date +%m-%d-%Y_%R:%S).mkv"
SIGSEND="kill -n 36 $(pidof dwmblocks)" SIGSEND="kill -n 36 $(pidof dwmblocks)"
if [[ $1 == 1 ]]; then if [ $1 = 1 ]; then
$SCREEN $SYSTEM_AUDIO $MICROPHONE -filter_complex "[1:0][2:0]amerge=inputs=2[a]" -map 0:v -map "[a]" $COMPRESSION $FILENAME& $SCREEN $SYSTEM_AUDIO $MICROPHONE -filter_complex "[1:0][2:0]amerge=inputs=2[a]" -map 0:v -map "[a]" $COMPRESSION $FILENAME&
else else
$SCREEN $SYSTEM_AUDIO $COMPRESSION $FILENAME& $SCREEN $SYSTEM_AUDIO $COMPRESSION $FILENAME&

View File

@ -3,7 +3,7 @@ YEAR=$(date +%Y)
MONTH_DAY=$(date +%m-%d) MONTH_DAY=$(date +%m-%d)
FILENAME=$(date +%R:%S) FILENAME=$(date +%R:%S)
mkdir -p ~/pictures/$YEAR/$MONTH_DAY mkdir -p ~/pictures/$YEAR/$MONTH_DAY
if [[ $1 == 1 ]]; then if [ $1 = 1 ]; then
import clipboard: import clipboard:
notify-send "Screenshot taken" "copied to clipboard" -i : notify-send "Screenshot taken" "copied to clipboard" -i :
else else

View File

@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
# for UPS monitoring with pwrstatd # for UPS monitoring with NUT
# #
#POWER="$(pwrstat -status | grep "Load" | awk '{print $2}')W" #POWER="$(upsc titanium-power@localhost | grep ups.realpower: | awk '{print $2}')W"
#CHARGE=$(pwrstat -status | grep "Battery Capacity" | awk '{print $3$4}') #CHARGE="$(upsc titanium-power@localhost | grep battery.charge: | awk '{print $2}')%"
#if [[ "$CHARGE" == "100%" ]]; then #if [ "$CHARGE" = "100%" ]; then
# echo $POWER # echo $POWER
#else #else
# echo "$CHARGE $POWER" # echo "$CHARGE $POWER"

View File

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
sleep 1 sleep 0.5
PID=$(pidof ffmpeg) PID=$(pidof gpu-screen-recorder)
if [ -n "$PID" ]; then if [ -n "$PID" ]; then
echo " REC" echo " REC"
elif [ -z "$PID" ]; then #elif [ -z "$PID" ]; then
echo " IDLE" # echo " - "
fi fi

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
VOLUME=$(wpctl get-volume @DEFAULT_SINK@) VOLUME=$(wpctl get-volume @DEFAULT_SINK@)
if [[ $VOLUME =~ "MUTED" ]]; then if [ $VOLUME =~ "MUTED" ]; then
echo " MUTED" echo " MUTED"
fi fi
VOLUME=$(echo $VOLUME | sed s/"Volume: 0."//g) VOLUME=$(echo $VOLUME | sed s/"Volume: 0."//g)

7
bin/sync_music Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
rsync -aP $HOME/wdraidz/media/music/ $HOME/music/ > $HOME/.sync_log && SUCCESS=1
if [ $SUCCESS = 1 ]; then
notify-send "sync complete; logged to $HOME/.sync_log" -i :
else
notify-send "sync error..." -i :
fi

View File

@ -1,11 +1,11 @@
#!/bin/sh #!/bin/sh
INCREMENT="2" INCREMENT="2"
if [[ "$1" == "up" ]]; then if [ "$1" = "up" ]; then
wpctl set-volume @DEFAULT_SINK@ $INCREMENT%+ wpctl set-volume @DEFAULT_SINK@ $INCREMENT%+
elif [[ "$1" == "down" ]]; then elif [ "$1" = "down" ]; then
wpctl set-volume @DEFAULT_SINK@ $INCREMENT%- wpctl set-volume @DEFAULT_SINK@ $INCREMENT%-
elif [[ "$1" == "mute" ]]; then elif [ "$1" = "mute" ]; then
wpctl set-mute @DEFAULT_SINK@ toggle wpctl set-mute @DEFAULT_SINK@ toggle
fi fi