diff --git a/scripts/appscripts/sxmo_files.sh b/scripts/appscripts/sxmo_files.sh index fcd5378..63511af 100755 --- a/scripts/appscripts/sxmo_files.sh +++ b/scripts/appscripts/sxmo_files.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + DIR="$1" [ -z "$DIR" ] && DIR="/home/$USER/" cd "$DIR" || exit 1 diff --git a/scripts/appscripts/sxmo_record.sh b/scripts/appscripts/sxmo_record.sh index ead4eb2..c2fb30c 100755 --- a/scripts/appscripts/sxmo_record.sh +++ b/scripts/appscripts/sxmo_record.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + [ -z "$SXMO_RECDIR" ] && SXMO_RECDIR="$XDG_DATA_HOME"/sxmo/recordings mkdir -p "$SXMO_RECDIR" diff --git a/scripts/appscripts/sxmo_reddit.sh b/scripts/appscripts/sxmo_reddit.sh index 6fc4132..bef3f6e 100755 --- a/scripts/appscripts/sxmo_reddit.sh +++ b/scripts/appscripts/sxmo_reddit.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + [ -z "$SXMO_SUBREDDITS" ] && SXMO_SUBREDDITS="pine64official pinephoneofficial unixporn postmarketos linux" menu() { diff --git a/scripts/appscripts/sxmo_rss.sh b/scripts/appscripts/sxmo_rss.sh index afa7f27..0e9b769 100755 --- a/scripts/appscripts/sxmo_rss.sh +++ b/scripts/appscripts/sxmo_rss.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + FETCHENABLED=1 if [ -f "$XDG_CONFIG_HOME/sxmo/sfeedrc" ]; then diff --git a/scripts/appscripts/sxmo_timer.sh b/scripts/appscripts/sxmo_timer.sh index ffac5cf..4493049 100755 --- a/scripts/appscripts/sxmo_timer.sh +++ b/scripts/appscripts/sxmo_timer.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + timerrun() { TIME=$( echo "$@" | diff --git a/scripts/appscripts/sxmo_weather.sh b/scripts/appscripts/sxmo_weather.sh index 57ff607..9f87217 100755 --- a/scripts/appscripts/sxmo_weather.sh +++ b/scripts/appscripts/sxmo_weather.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + [ -z "$SXMO_GPSLOCATIONSFILES" ] && SXMO_GPSLOCATIONSFILES="/usr/share/sxmo/appcfg/places_for_gps.tsv" ROWHOURS=12 WEATHERXML="" diff --git a/scripts/appscripts/sxmo_websearch.sh b/scripts/appscripts/sxmo_websearch.sh index 7778306..02609fe 100755 --- a/scripts/appscripts/sxmo_websearch.sh +++ b/scripts/appscripts/sxmo_websearch.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + pidof "$KEYBOARD" || "$KEYBOARD" & SEARCHQUERY="$( echo "Close Menu" | dmenu -t -p "Search:" -c -l 20 diff --git a/scripts/appscripts/sxmo_youtube.sh b/scripts/appscripts/sxmo_youtube.sh index 896e6df..e61eb8e 100755 --- a/scripts/appscripts/sxmo_youtube.sh +++ b/scripts/appscripts/sxmo_youtube.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + HISTORY_FILE="$XDG_CACHE_HOME"/sxmo/youtubehistory.tsv NRESULTS=5 AUDIOONLY=0 diff --git a/scripts/core/sxmo_audioout.sh b/scripts/core/sxmo_audioout.sh index 00b0ac1..9311ab7 100755 --- a/scripts/core/sxmo_audioout.sh +++ b/scripts/core/sxmo_audioout.sh @@ -1,6 +1,10 @@ #!/usr/bin/env sh ARG="$1" +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + SPEAKER="Line Out" HEADPHONE="Headphone" EARPIECE="Earpiece" diff --git a/scripts/core/sxmo_blinkled.sh b/scripts/core/sxmo_blinkled.sh index d11b171..2a0e556 100755 --- a/scripts/core/sxmo_blinkled.sh +++ b/scripts/core/sxmo_blinkled.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + PIDS="" for i in "$@"; do sxmo_setpineled "$i" 150 & diff --git a/scripts/core/sxmo_brightness.sh b/scripts/core/sxmo_brightness.sh index 0255bbb..2c7733d 100755 --- a/scripts/core/sxmo_brightness.sh +++ b/scripts/core/sxmo_brightness.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + [ -e /sys/class/backlight/edp-backlight ] && DEV=/sys/class/backlight/edp-backlight [ -e /sys/devices/platform/backlight/backlight/backlight ] && DEV=/sys/devices/platform/backlight/backlight/backlight diff --git a/scripts/core/sxmo_contacts.sh b/scripts/core/sxmo_contacts.sh index ce66582..85c1972 100755 --- a/scripts/core/sxmo_contacts.sh +++ b/scripts/core/sxmo_contacts.sh @@ -9,6 +9,10 @@ # # Prints in output format: "number: contact" +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + CONTACTSFILE="$XDG_CONFIG_HOME"/sxmo/contacts.tsv LOGFILE="$XDG_DATA_HOME"/sxmo/modem/modemlog.tsv diff --git a/scripts/core/sxmo_gesturehandler.sh b/scripts/core/sxmo_gesturehandler.sh index dd18454..36d6de8 100755 --- a/scripts/core/sxmo_gesturehandler.sh +++ b/scripts/core/sxmo_gesturehandler.sh @@ -1,6 +1,11 @@ #!/usr/bin/env sh + ACTION="$1" +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + XPROPOUT="$(xprop -id "$(xdotool getactivewindow)")" WMCLASS="$(echo "$XPROPOUT" | grep WM_CLASS | cut -d ' ' -f3- | cut -d ' ' -f1 | tr -d '\",')" diff --git a/scripts/core/sxmo_gpsutil.sh b/scripts/core/sxmo_gpsutil.sh index b87fdd4..56350e9 100755 --- a/scripts/core/sxmo_gpsutil.sh +++ b/scripts/core/sxmo_gpsutil.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + [ -z "$SXMO_GPSLOCATIONSFILES" ] && SXMO_GPSLOCATIONSFILES="/usr/share/sxmo/appcfg/places_for_gps.tsv" CTILESIZE=256 CLN2=0.693147180559945309417 diff --git a/scripts/core/sxmo_killwindow.sh b/scripts/core/sxmo_killwindow.sh index 57a0104..f55a076 100755 --- a/scripts/core/sxmo_killwindow.sh +++ b/scripts/core/sxmo_killwindow.sh @@ -1,2 +1,7 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + xdotool windowkill "$(xdotool getactivewindow)" diff --git a/scripts/core/sxmo_lisgdstart.sh b/scripts/core/sxmo_lisgdstart.sh index b531dd6..d90d133 100755 --- a/scripts/core/sxmo_lisgdstart.sh +++ b/scripts/core/sxmo_lisgdstart.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + pkill -9 lisgd if [ -x "$XDG_CONFIG_HOME"/sxmo/hooks/lisgdstart ]; then diff --git a/scripts/core/sxmo_lock.sh b/scripts/core/sxmo_lock.sh index e4cd822..85b0a01 100755 --- a/scripts/core/sxmo_lock.sh +++ b/scripts/core/sxmo_lock.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/lock" ]; then "$XDG_CONFIG_HOME/sxmo/hooks/lock" fi diff --git a/scripts/core/sxmo_networks.sh b/scripts/core/sxmo_networks.sh index 5043419..144f76f 100755 --- a/scripts/core/sxmo_networks.sh +++ b/scripts/core/sxmo_networks.sh @@ -1,5 +1,9 @@ #!/usr/bin/env sh +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + connections() { ACTIVE="$(nmcli -c no -t c show --active | cut -d: -f1,3 | sed 's/$/ ✓/')" INACTIVE="$(nmcli -c no -t c show | cut -d: -f1,3)" diff --git a/scripts/core/sxmo_open.sh b/scripts/core/sxmo_open.sh index fe29a94..2a758e7 100755 --- a/scripts/core/sxmo_open.sh +++ b/scripts/core/sxmo_open.sh @@ -1,5 +1,9 @@ #!/usr/bin/env sh +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + MIMEAPPS="${XDG_CONFIG_HOME:-$HOME/.config}/mimeapps.list" DESKTOPS_CACHED_MIMEAPPS="${XDG_CONFIG_HOME:-$HOME/.config}/desktops.mimeapps.list" DESKTOP_DIRS="/usr/share/sxmo/applications/|/usr/share/applications/|/usr/local/share/applications/|${XDG_DATA_HOME:-$HOME/.local/share}/applications/" diff --git a/scripts/core/sxmo_rotate.sh b/scripts/core/sxmo_rotate.sh index 85ecb71..404190c 100755 --- a/scripts/core/sxmo_rotate.sh +++ b/scripts/core/sxmo_rotate.sh @@ -1,5 +1,9 @@ #!/usr/bin/env sh +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + applyptrmatrix() { PTRID="$( xinput | grep -iE 'touchscreen.+pointer' | grep -oE 'id=[0-9]+' | cut -d= -f2 diff --git a/scripts/core/sxmo_statusbar.sh b/scripts/core/sxmo_statusbar.sh index 2254cf9..8b59a4c 100755 --- a/scripts/core/sxmo_statusbar.sh +++ b/scripts/core/sxmo_statusbar.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + trap "update" USR1 pgrep -f sxmo_statusbar.sh | grep -v $$ | xargs -r kill -9 diff --git a/scripts/core/sxmo_upgrade.sh b/scripts/core/sxmo_upgrade.sh index c40aea4..e8623f7 100755 --- a/scripts/core/sxmo_upgrade.sh +++ b/scripts/core/sxmo_upgrade.sh @@ -1,4 +1,8 @@ #!/usr/bin/env sh +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + echo "Updating all packages from repositories" sudo apk update diff --git a/scripts/core/sxmo_urlhandler.sh b/scripts/core/sxmo_urlhandler.sh index a83c07f..daa8113 100755 --- a/scripts/core/sxmo_urlhandler.sh +++ b/scripts/core/sxmo_urlhandler.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + FORK="$2" if [ -n "$1" ] diff --git a/scripts/core/sxmo_vol.sh b/scripts/core/sxmo_vol.sh index 2361159..4b7bed9 100755 --- a/scripts/core/sxmo_vol.sh +++ b/scripts/core/sxmo_vol.sh @@ -1,4 +1,9 @@ #!/usr/bin/env sh + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + notify() { VOL="$( amixer get "$(sxmo_audiocurrentdevice.sh)" | diff --git a/scripts/core/sxmo_xinit.sh b/scripts/core/sxmo_xinit.sh index f09cb0d..43e4ab9 100755 --- a/scripts/core/sxmo_xinit.sh +++ b/scripts/core/sxmo_xinit.sh @@ -1,5 +1,6 @@ #!/usr/bin/env sh + envvars() { # shellcheck disable=SC1091 [ -f /etc/profile ] && . /etc/profile @@ -84,6 +85,10 @@ startdwm() { } xinit() { + # include common definitions + # shellcheck source=scripts/core/sxmo_common.sh + . "$(dirname "$0")/sxmo_common.sh" + envvars setupxdgdir xdefaults