diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/common/saf | 14 | ||||
| -rwxr-xr-x | bin/extra/202020 | 4 | ||||
| -rwxr-xr-x | bin/extra/gdbcore | 4 | ||||
| -rwxr-xr-x | bin/extra/muz-sync | 25 | ||||
| -rwxr-xr-x | bin/extra/rek | 16 | ||||
| -rwxr-xr-x | bin/guiscripts/vrec | 38 | ||||
| -rwxr-xr-x | bin/menuscripts/mpower | 9 | ||||
| -rwxr-xr-x | bin/menuscripts/pomo | 12 | 
8 files changed, 79 insertions, 43 deletions
diff --git a/bin/common/saf b/bin/common/saf index 2936346..7323339 100755 --- a/bin/common/saf +++ b/bin/common/saf @@ -2,7 +2,7 @@  # Simple Ass Fetch by futxlii -red="$(printf '\033[31m')" +cyan="$(printf '\033[36m')"  blue="$(printf '\033[34m')"  reset="$(printf '\033[0m')" @@ -24,10 +24,14 @@ done  KERNEL="$(uname -r)"  UPTIME="$(uptime -p)"; UPTIME="${UPTIME##up }"  SHELL="$(basename "$SHELL")" +MEMORY_USED="$(free --bytes | awk 'NR==2 {print $3}' | numfmt --to=iec-i --format '%.2f')" +MEMORY_TOTAL="$(free --bytes | awk 'NR==2 {print $2}' | numfmt --to=iec-i --format '%.2f')"  cat <<EOF -	${red}- ${blue}${ID:-"unknown"} -	${red}- ${blue}$KERNEL -	${red}- ${blue}$UPTIME ($(load)) -	${red}- ${blue}$SHELL${reset} +  ${blue}OS:      ${cyan}${NAME:-"unknown"} +  ${blue}Kernel:  ${cyan}$KERNEL +  ${blue}Desktop: ${cyan}$XDG_CURRENT_DESKTOP${reset} +  ${blue}Shell:   ${cyan}$SHELL${reset} +  ${blue}Memory:  ${cyan}$MEMORY_USED / $MEMORY_TOTAL +  ${blue}Uptime:  ${cyan}$UPTIME ($(load))  EOF diff --git a/bin/extra/202020 b/bin/extra/202020 index 35ce1c9..9833e48 100755 --- a/bin/extra/202020 +++ b/bin/extra/202020 @@ -5,10 +5,10 @@ sounds="$HOME/sync/share/sounds"  if [ "$1" ]; then      $mpvCommand "$sounds"/avert1.ogg & -    herbe '202020' 'avert!' & +    notify-send '_202020' '*avert!' &      sleep 20s      $mpvCommand "$sounds"/avert2.ogg & -    herbe '202020' 'stop averting' & +    notify-send '_202020' '*stop averting' &      exit  fi diff --git a/bin/extra/gdbcore b/bin/extra/gdbcore index 6daafa8..f44a020 100755 --- a/bin/extra/gdbcore +++ b/bin/extra/gdbcore @@ -11,8 +11,9 @@  cache="$HOME/.cache/gdbcore_prog" -if [ "$#" -lt 1 ]; then +if [ "$1" = "-h" ]; then      >&2 printf 'usage: gdbcore [-r] <program>\n' +    exit 1  fi  if [ "$1" = "-r" ]; then @@ -64,6 +65,7 @@ else      line="$(sed -n "${nr}p" "$tmp")"      corefile="$coredir"/"${line%% *}"  fi +>&2 printf 'corefile: %s\n' "$corefile"  if [ ! -f "$corefile" ]; then      rm -f "$tmp" diff --git a/bin/extra/muz-sync b/bin/extra/muz-sync index 3a5c5f1..0c2dba2 100755 --- a/bin/extra/muz-sync +++ b/bin/extra/muz-sync @@ -1,9 +1,28 @@  #!/bin/sh  trap "exit 1" INT -music="$(xdg-user-dir MUSIC)" ->&2 printf "music: %s\n" "$music" +[ "$1" ] && path="$1" || path="/media/basilisk/music/sorted/" +[ "$2" ] && music="$2" || music="$(xdg-user-dir MUSIC)" +[ "$3" ] && host="$3" || host="autumn" -while ! rsync --recursive --verbose --partial --progress --ignore-existing --size-only db:/media/basilisk/music/sorted/ "$music" +>&2 printf '%s:%s -> %s\n' "$host" "$path" "$music" + +>&2 printf 'Confirm? [y/N] ' +answer="$(head -n 1)" +[ "$answer" ] || exit 1 + +if [ "$answer" != "y" ] && [ "$answer" != "Y" ]; then  +	exit 1 +fi + +# retry until failure +while ! rsync \ +	--recursive \ +	--verbose \ +	--partial \ +	--progress \ +	--ignore-existing \ +	--size-only \ +	"$host":"$path" "$music"  do :  done diff --git a/bin/extra/rek b/bin/extra/rek deleted file mode 100755 index b5baac7..0000000 --- a/bin/extra/rek +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# Record desktop with ffmpeg, strip metadata and use mp4 for relative small file size -# copy the path of the output file to the system clipboard for sharing -out="out.mp4" - -# with audio -if [ "$1" = "-a" ] -then -    ffmpeg -y -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0+0,0 -f pulse -ac 2 -i default -map 0:v -map 0:a? -map_metadata -1 -map_metadata:s:v -1 -map_metadata:s:a -1 -map_chapters -1 -disposition 0 "$out" -else -    ffmpeg -y -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0+0,0 -map 0:v -map 0:a? -map_metadata -1 -map_metadata:s:v -1 -map_metadata:s:a -1 -map_chapters -1 -disposition 0 "$out" -fi - -# copy output path -readlink -f "$out" | clipp diff --git a/bin/guiscripts/vrec b/bin/guiscripts/vrec index 6af8d58..e16679d 100755 --- a/bin/guiscripts/vrec +++ b/bin/guiscripts/vrec @@ -45,15 +45,14 @@ record_cmd()  	w=$(($3 + $3 % 2))  	h=$(($4 + $4 % 2))  	ffmpeg $audio        \ -	    -v 16            \ +            -hide_banner     \  	    -r 30            \  	    -f x11grab       \  	    -s "${w}x${h}"   \  	    -i ":0.0+$1,$2"  \ -	    -preset slow     \ -	    -c:v h264        \ +	    -preset ultrafast\ +	    -c:v libx264     \  	    -pix_fmt yuv420p \ -	    -crf 20          \  	    "$5/$6.mp4"  	rm -f "$lock"  	herbe "vrec" "stopped recording." &  @@ -69,14 +68,21 @@ else  	dir="$(xdg-user-dir VIDEOS)"  	[ -d "$dir" ] && dir="$dir/records" || dir="$HOME"  fi +mkdir -p "$dir" +  # Set audio variable  if [ "$1" = "-a" ]  then -    ## Mic -	# audio="-f pulse -ac 2 -i default" -    ## Desktop -	audio="-f pulse -i alsa_output.pci-0000_00_1f.3.analog-stereo.monitor -ac 1" -	shift +    if [ "$2" = "-m" ] +    then +        ## Mic +        audio="-f pulse -ac 2 -i default" +        shift +    else +        ## Desktop +        audio="-f pulse -i alsa_output.pci-0000_00_1f.3.analog-stereo.monitor -ac 1" +    fi +    shift  fi  output="$(date +%F_%H-%M-%S)" @@ -99,7 +105,7 @@ case "$option" in          ;;      stop)          pid="$(pgrep ffmpeg | xargs ps | grep 'x11grab' | awk '{print $1}')" -        [ "$pid" ] && kill "$pid" +        [ "$pid" ] && kill -TERM $pid          rm -f "$lock"           herbe "vrec" "stopped recording." &          ;; @@ -108,6 +114,16 @@ case "$option" in          printf '%s' "$file" | clipp          ;;      full) record_cmd 0 0 1920 1080 "$dir" "$output" ;; -    audio) $0 -a; exit ;; +    audio)  +    	choice="$(printf 'mic\ndesktop\n' | dmenu -c)" +    	[ "$choice" ] || exit 1 +    	if [ "$choice" = "desktop" ] +    	then +	    $0 -a +	else +            $0 -a -m +	fi +        exit +        ;;      help|*) >&2 printf 'record [dir] (active|part|stop|full|last|audio)\n' ;;  esac diff --git a/bin/menuscripts/mpower b/bin/menuscripts/mpower index b4b8640..fb7249d 100755 --- a/bin/menuscripts/mpower +++ b/bin/menuscripts/mpower @@ -9,6 +9,15 @@ hibernate  EOF  )" +if [ "$(hostname)" = "winter" ]; then  +	if [ "$choice" = "firmware" ]; then +		systemctl reboot --firmware-setup +		exit +	fi +	systemctl "$choice" +	exit +fi +  case "$choice" in  	"suspend") doas /usr/sbin/zzz ;;  	"poweroff") doas /usr/sbin/poweroff ;; diff --git a/bin/menuscripts/pomo b/bin/menuscripts/pomo index 07db166..5b52ebd 100755 --- a/bin/menuscripts/pomo +++ b/bin/menuscripts/pomo @@ -1,7 +1,9 @@  #!/bin/sh -# time in minutes of one pomodoro +# time in minutes  [ "$SLEEP_TIME" ] || SLEEP_TIME=25 +[ "$BREAK_TIME" ] || BREAK_TIME=5 +[ "$GIGA_BREAK_TIME" ] || GIGA_BREAK_TIME=20  ### FUNCTIONS  notif() { @@ -25,7 +27,7 @@ player_command() {  # $1: time in minutes  # $2: msg for notification  ring_ring() { -	printf >&2 '%s B %s\n' "$(date '+%R')" "$round" +	printf >&2 '%s %s [%s]\n' "$(date '+%R')" "Break" "$round"  	player_command  	herbe "pomo" "$2" &  	sleep "${1}m" @@ -62,13 +64,13 @@ done  while true; do  	notif "*START" -	printf >&2 '%s S %s\n' "$(date '+%R')" "$round" +	printf >&2 '%s %s [%s]\n' "$(date '+%R')" "Start" "$round"  	sleep "${SLEEP_TIME}m"  	if [ "$round" -eq 3 ]; then -		ring_ring 20 "*GIGA BREAK TIME" +		ring_ring "$GIGA_BREAK_TIME" "*GIGA BREAK TIME"  		round=0  	else -		ring_ring 5 "*BREAK TIME" +		ring_ring "$BREAK_TIME" "*BREAK TIME"  		round=$((round + 1))  	fi  done  | 
