Shellcheck and tabindent all appscripts

master
Miles Alan 5 years ago
parent e23f439b65
commit f9e580106e
  1. 8
      scripts/appscripts/sxmo_files.sh
  2. 2
      scripts/appscripts/sxmo_rss.sh
  3. 20
      scripts/appscripts/sxmo_timer.sh
  4. 8
      scripts/appscripts/sxmo_weather.sh
  5. 4
      scripts/appscripts/sxmo_youtube.sh

@ -1,15 +1,15 @@
#!/usr/bin/env sh
EDITOR=vis
cd /home/$USER/
cd "/home/$USER/" || exit 1
handlefiles() {
echo "$1" | grep -iE ".(wav|webm|mp4|ogg|opus|m4a|flac|mov|avi)$" && st -e mpv "$@" && exit
echo "$1" | grep -iE ".(jpg|png|gif)$" && st -e sxiv "$@" && exit
st -e sh -ic "$EDITOR "$@"" && exit
st -e sh -ic "$EDITOR $*" && exit
}
while true; do
CHOICES="$(echo -e 'Close Menu\n../\n*\n'"$(ls -1p)")"
CHOICES="$(printf %b 'Close Menu\n../\n*\n'"$(ls -1p)")"
DIR="$(basename "$(pwd)")"
PICKED="$(
echo "$CHOICES" |
@ -18,6 +18,6 @@ while true; do
echo "$PICKED" | grep "Close Menu" && exit 0
[ -d "$PICKED" ] && cd "$PICKED" && continue
echo "$PICKED" | grep -E '^[*]$' && handlefiles *
echo "$PICKED" | grep -E '^[*]$' && handlefiles ./*
[ -f "$PICKED" ] && handlefiles "$PICKED"
done

@ -46,7 +46,7 @@ FOLDER="/tmp/sfeed_$(echo "$TIMESPAN" | sed 's/ /_/g')"
prep_temp_folder_with_items
# Show list of items
PICKED=$(echo "$(list_items)" | dmenu -p "RSS" -c -l 20 -fn Terminus-15)
PICKED=$(list_items | dmenu -p "RSS" -c -l 20 -fn Terminus-15)
# Handle picked item
URL="$(echo "$PICKED" | gawk -F " " '{print $NF}')"

@ -9,15 +9,15 @@ timerrun() {
bc
)
date1=$((`date +%s` + $TIME));
while [ "$date1" -ge `date +%s` ]; do
echo -ne "$(date -u --date @$(($date1 - `date +%s`)) +%H:%M:%S) \r";
DATE1=$(($(date +%s) + TIME));
while [ "$DATE1" -ge "$(date +%s)" ]; do
printf %b "$(date -u --date @$((DATE1 - $(date +%s))) +%H:%M:%S) \r";
sleep 0.1
done
echo "Done with $@"
echo "Done with $*"
while :;
do notify-send "Done with $@";
do notify-send "Done with $*";
sxmo_vibratepine 1000
sleep 0.5
done
@ -26,7 +26,7 @@ timerrun() {
menu() {
pidof svkbd-sxmo || svkbd-sxmo &
TIMEINPUT="$(
echo -e "
echo "
1h
10m
9m
@ -43,9 +43,9 @@ menu() {
" | awk 'NF' | awk '{$1=$1};1' | dmenu -p Timer -c -fn "Terminus-30" -l 20
)"
pkill svkbd-sxmo
[[ "Close Menu" == "$TIMEINPUT" ]] && exit 0
st -f Monospace-50 -e $0 timerrun $TIMEINPUT
[ "Close Menu" = "$TIMEINPUT" ] && exit 0
st -f Monospace-50 -e "$0" timerrun "$TIMEINPUT"
}
[ $# -gt 0 ] && $@ || menu
# shellcheck disable=SC2068
if [ $# -gt 0 ]; then $@; else menu; fi

@ -2,7 +2,7 @@
pidof svkbd-sxmo || svkbd-sxmo &
ZIP=$(
echo -e "
printf %b "
10025 - NYC
60007 - Chicago
94016 - San Francisco
@ -15,9 +15,9 @@ ZIP=$(
)
pkill svkbd-sxmo
LATLON=$(cat /usr/share/sxmo/zipcodes_for_weather.csv | grep "^$ZIP")
LAT=$(echo $LATLON | cut -d, -f2 | tr -d ' ')
LON=$(echo $LATLON | cut -d, -f3 | tr -d ' ')
LATLON="$(grep "^$ZIP" /usr/share/sxmo/zipcodes_for_weather.csv)"
LAT=$(echo "$LATLON" | cut -d, -f2 | tr -d ' ')
LON=$(echo "$LATLON" | cut -d, -f3 | tr -d ' ')
URL="https://forecast.weather.gov/MapClick.php?lat=${LAT}&lon=${LON}&unit=0&lg=english&FcstType=text&TextType=1"
st -f Monospace-20 -e w3m "$URL"

@ -18,7 +18,7 @@ menu() {
dmenu -c -l 10 -fn Terminus-20
)"
[[ "CLOSE_MENU" == "$RESULT" ]] && exit 0
[ "CLOSE_MENU" = "$RESULT" ] && exit 0
URL=$(echo "$RESULT" | awk -F " " '{print $NF}')
}
@ -32,4 +32,4 @@ audio() {
st -e mpv -v --no-video "$URL"
}
$@
$1

Loading…
Cancel
Save