diff options
Diffstat (limited to 'dotfiles/system/.local/bin')
| -rwxr-xr-x | dotfiles/system/.local/bin/any2opus | 99 | ||||
| -rwxr-xr-x | dotfiles/system/.local/bin/startdwm | 7 | 
2 files changed, 55 insertions, 51 deletions
diff --git a/dotfiles/system/.local/bin/any2opus b/dotfiles/system/.local/bin/any2opus index 3fa4563..c5a7dbd 100755 --- a/dotfiles/system/.local/bin/any2opus +++ b/dotfiles/system/.local/bin/any2opus @@ -10,7 +10,7 @@ recursive=false  # Usage info  show_help() { -	cat << EOF +    cat << EOF  Usage: ${0##*/} [-h] [-d] [-r] [-f FILE]  Convert audio/video files to the Opus format. @@ -33,69 +33,70 @@ fi  # Identify arguments; quit if invalid argument  while getopts ":df:rh" opt; do -	case ${opt} in -		d) -			delete_after_conversion=true -			;; -		f) -			filename=$OPTARG -			;; -		r) -			recursive=true -			;; -		h) -			show_help -			exit 0 -			;; -		\?) -			echo "Invalid option: -$OPTARG" >&2 -			show_help -			exit 1 -			;; +    case ${opt} in +        d) +            delete_after_conversion=true +            ;; +        f) +            filename=$OPTARG +            ;; +        r) +            recursive=true +            ;; +        h) +            show_help +            exit 0 +            ;; +        \?) +            echo "Invalid option: -$OPTARG" >&2 +            show_help +            exit 1 +            ;;      esac  done  # Display error and quit if incompatible arguments  if [ "$recursive" = true ] && [ -n "$filename" ]  then -	echo "The -f and -r options cannot be used together." -	show_help -	exit 1 +    echo "The -f and -r options cannot be used together." +    show_help +    exit 1 +fi  # Convert function checks mime-type and converts/deletes a single file  convert() { -	f=$1 -	# Check the mime-type of the file -	mime_type=$(file -b --mime-type "$f") -	# If the file is an audio or video file and not already in opus format then convert it to opus -	if [[ $mime_type == video/* || $mime_type == audio/* ]] && [[ $f != *.opus ]]; then -		ffmpeg -i "$f" "${f%.*}.opus" -		# If the '-d' option was specified, delete the original file after conversion -		if $delete_after_conversion; then -			rm "$f" -		fi -	fi +    f=$1 +    # Check the mime-type of the file +    mime_type=$(file -b --mime-type "$f") +    # If the file is an audio or video file and not already in opus format then convert it to opus +    if [[ $mime_type == video/* || $mime_type == audio/* ]] && [[ $f != *.opus ]]; then +        ffmpeg -i "$f" "${f%.*}.opus" +        # If the '-d' option was specified, delete the original file after conversion +        if $delete_after_conversion; then +            rm "$f" +        fi +    fi  }  # Use above convert function based on user's intended set of files  if [ "$recursive" = true ]  then -	# convert all media files in current and child directories -	find . -type f -exec bash -c 'convert "$0"' {} \; +    # convert all media files in current and child directories +    find . -type f -exec bash -c 'convert "$0"' {} \;  elif [[ -n $filename ]]  then -	# if filename is not empty, convert only this file -	convert $filename +    # if filename is not empty, convert only this file +    convert $filename  else -	# Convert all -	echo "All non-opus media files in the current directory will be converted. Originals are kept." -	read -p "Proceed? (Y/n) " -n 1 -r -	echo -	if [[ $REPLY =~ ^[Yy]$ ]] -	then -		# Iterate over each file in the directory and convert -		for f in *; do -			convert $f -		done -	fi +    # Convert all +    echo "All non-opus media files in the current directory will be converted. Originals are kept." +    read -p "Proceed? (Y/n) " -n 1 -r +    echo +    if [[ $REPLY =~ ^[Yy]$ ]] +    then +        # Iterate over each file in the directory and convert +        for f in *; do +            convert $f +        done +    fi  fi diff --git a/dotfiles/system/.local/bin/startdwm b/dotfiles/system/.local/bin/startdwm index 9966282..69efcaa 100755 --- a/dotfiles/system/.local/bin/startdwm +++ b/dotfiles/system/.local/bin/startdwm @@ -27,9 +27,12 @@ xhost +si:localuser:root  # info in the status bar  (conky | while read LINE; do xsetroot -name "$LINE"; done) & -# make short-pressed Ctrl behave like Escape +# map short-pressed Ctrl to Escape  xcape -e 'Control_L=Escape' & +# map shift backspace to delete +xcape -e 'Shift_L=Delete' +  # make CapsLock behave like Ctrl:  setxkbmap -option ctrl:nocaps @@ -51,7 +54,7 @@ insync start &  touchpad-indicator-start &  signal-desktop --start-in-tray &  protonmail-bridge --no-window & -warpinator-start & +# warpinator-start &  # start dwm  echo "$(date): Starting dwm" >> "$logfile" 2>&1  | 
