From 228b936f085c56a884b2782d1abb7789c1ebb094 Mon Sep 17 00:00:00 2001 From: ArenM Date: Mon, 14 Aug 2023 13:26:03 -0400 Subject: [PATCH] Remove useless dirname calls sxmo_common.sh is in $PATH so we can let the shell handle finding it. Running a script with sh -x can be handy for debugging, but doesn't work with these because $0 doesn't get set to the full path to the script. Signed-off-by: Willow Barraco --- scripts/appscripts/sxmo_screenshot_selection.sh | 3 +-- scripts/appscripts/sxmo_youtube_audio.sh | 3 +-- scripts/core/sxmo_bluetoothmenu.sh | 2 +- scripts/core/sxmo_killwindow.sh | 2 +- scripts/core/sxmo_mmsdconfig.sh | 2 +- scripts/core/sxmo_networks.sh | 2 +- scripts/core/sxmo_phonemenu.sh | 2 +- scripts/core/sxmo_rotate.sh | 2 +- scripts/core/sxmo_type.sh | 2 +- scripts/core/sxmo_upgrade.sh | 2 +- scripts/core/sxmo_validnumber.sh | 2 +- scripts/core/sxmo_version.sh | 2 +- scripts/core/sxmo_vvmdconfig.sh | 2 +- scripts/core/sxmo_wm.sh | 2 +- scripts/modem/sxmo_modemlog.sh | 2 +- scripts/modem/sxmo_vvm.sh | 2 +- scripts/notifications/sxmo_notificationmonitor.sh | 2 +- scripts/notifications/sxmo_notificationsmenu.sh | 2 +- scripts/notifications/sxmo_notificationwrite.sh | 2 +- 19 files changed, 19 insertions(+), 21 deletions(-) diff --git a/scripts/appscripts/sxmo_screenshot_selection.sh b/scripts/appscripts/sxmo_screenshot_selection.sh index 0a682ac..8107e16 100755 --- a/scripts/appscripts/sxmo_screenshot_selection.sh +++ b/scripts/appscripts/sxmo_screenshot_selection.sh @@ -2,5 +2,4 @@ # SPDX-License-Identifier: AGPL-3.0-only # Copyright 2022 Sxmo Contributors # title="$icon_cam Screenshot (selection)" -dir="$(dirname "$0")" -"$dir/sxmo_screenshot.sh" selection +sxmo_screenshot.sh selection diff --git a/scripts/appscripts/sxmo_youtube_audio.sh b/scripts/appscripts/sxmo_youtube_audio.sh index 7de0eb6..8a0e7fa 100755 --- a/scripts/appscripts/sxmo_youtube_audio.sh +++ b/scripts/appscripts/sxmo_youtube_audio.sh @@ -2,5 +2,4 @@ # SPDX-License-Identifier: AGPL-3.0-only # Copyright 2022 Sxmo Contributors # title="$icon_ytb YouTube (audio)" -dir="$(dirname "$0")" -"$dir/sxmo_youtube.sh" audio +sxmo_youtube.sh audio diff --git a/scripts/core/sxmo_bluetoothmenu.sh b/scripts/core/sxmo_bluetoothmenu.sh index 4c731eb..9c77365 100755 --- a/scripts/core/sxmo_bluetoothmenu.sh +++ b/scripts/core/sxmo_bluetoothmenu.sh @@ -4,7 +4,7 @@ # include common definitions # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh # shellcheck source=configs/default_hooks/sxmo_hook_icons.sh . sxmo_hook_icons.sh diff --git a/scripts/core/sxmo_killwindow.sh b/scripts/core/sxmo_killwindow.sh index 60aed95..4c8257c 100755 --- a/scripts/core/sxmo_killwindow.sh +++ b/scripts/core/sxmo_killwindow.sh @@ -4,7 +4,7 @@ # include common definitions # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh case "$SXMO_WM" in sway) swaymsg kill;; diff --git a/scripts/core/sxmo_mmsdconfig.sh b/scripts/core/sxmo_mmsdconfig.sh index 035ab93..4f6b923 100755 --- a/scripts/core/sxmo_mmsdconfig.sh +++ b/scripts/core/sxmo_mmsdconfig.sh @@ -5,7 +5,7 @@ # shellcheck source=configs/default_hooks/sxmo_hook_icons.sh . sxmo_hook_icons.sh # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh set -e diff --git a/scripts/core/sxmo_networks.sh b/scripts/core/sxmo_networks.sh index 7445f4e..f454df7 100755 --- a/scripts/core/sxmo_networks.sh +++ b/scripts/core/sxmo_networks.sh @@ -6,7 +6,7 @@ # shellcheck source=configs/default_hooks/sxmo_hook_icons.sh . sxmo_hook_icons.sh # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh set -e diff --git a/scripts/core/sxmo_phonemenu.sh b/scripts/core/sxmo_phonemenu.sh index e9a6bbb..42cba37 100755 --- a/scripts/core/sxmo_phonemenu.sh +++ b/scripts/core/sxmo_phonemenu.sh @@ -5,7 +5,7 @@ # shellcheck source=configs/default_hooks/sxmo_hook_icons.sh . sxmo_hook_icons.sh # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh set -e diff --git a/scripts/core/sxmo_rotate.sh b/scripts/core/sxmo_rotate.sh index 9f8fcb6..f51ecb5 100755 --- a/scripts/core/sxmo_rotate.sh +++ b/scripts/core/sxmo_rotate.sh @@ -4,7 +4,7 @@ # include common definitions # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh applyptrmatrix() { [ -n "$SXMO_TOUCHSCREEN_ID" ] && xinput set-prop "$SXMO_TOUCHSCREEN_ID" --type=float --type=float "Coordinate Transformation Matrix" "$@" diff --git a/scripts/core/sxmo_type.sh b/scripts/core/sxmo_type.sh index e7d5b28..851c981 100755 --- a/scripts/core/sxmo_type.sh +++ b/scripts/core/sxmo_type.sh @@ -4,7 +4,7 @@ # include common definitions # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh wtype_to_xdotool() { if [ "$#" -eq 0 ]; then diff --git a/scripts/core/sxmo_upgrade.sh b/scripts/core/sxmo_upgrade.sh index 44adf18..03be28a 100755 --- a/scripts/core/sxmo_upgrade.sh +++ b/scripts/core/sxmo_upgrade.sh @@ -3,7 +3,7 @@ # Copyright 2022 Sxmo Contributors # include common definitions # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh trap "read -r" EXIT diff --git a/scripts/core/sxmo_validnumber.sh b/scripts/core/sxmo_validnumber.sh index 9783f48..f209e16 100755 --- a/scripts/core/sxmo_validnumber.sh +++ b/scripts/core/sxmo_validnumber.sh @@ -3,7 +3,7 @@ # Copyright 2022 Sxmo Contributors # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh returnvalid() { printf %s "$1" diff --git a/scripts/core/sxmo_version.sh b/scripts/core/sxmo_version.sh index 05e3595..66c1dd3 100755 --- a/scripts/core/sxmo_version.sh +++ b/scripts/core/sxmo_version.sh @@ -4,7 +4,7 @@ # include common definitions # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh printf "Sxmo " cat "$(xdg_data_path sxmo/version)" diff --git a/scripts/core/sxmo_vvmdconfig.sh b/scripts/core/sxmo_vvmdconfig.sh index ab14e4e..862e31c 100755 --- a/scripts/core/sxmo_vvmdconfig.sh +++ b/scripts/core/sxmo_vvmdconfig.sh @@ -5,7 +5,7 @@ # shellcheck source=configs/default_hooks/sxmo_hook_icons.sh . sxmo_hook_icons.sh # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh set -e diff --git a/scripts/core/sxmo_wm.sh b/scripts/core/sxmo_wm.sh index a90a181..5eeda05 100755 --- a/scripts/core/sxmo_wm.sh +++ b/scripts/core/sxmo_wm.sh @@ -4,7 +4,7 @@ # include common definitions # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh xorgdpms() { STATE=off diff --git a/scripts/modem/sxmo_modemlog.sh b/scripts/modem/sxmo_modemlog.sh index e8131be..027b296 100755 --- a/scripts/modem/sxmo_modemlog.sh +++ b/scripts/modem/sxmo_modemlog.sh @@ -4,6 +4,6 @@ # include common definitions # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh sxmo_terminal.sh sh -c "tail -n9999 -f $SXMO_LOGDIR/modemlog.tsv" diff --git a/scripts/modem/sxmo_vvm.sh b/scripts/modem/sxmo_vvm.sh index 86dcbd9..0a3a51f 100755 --- a/scripts/modem/sxmo_vvm.sh +++ b/scripts/modem/sxmo_vvm.sh @@ -6,7 +6,7 @@ # shellcheck source=configs/default_hooks/sxmo_hook_icons.sh . sxmo_hook_icons.sh # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh stderr() { sxmo_log "$*" diff --git a/scripts/notifications/sxmo_notificationmonitor.sh b/scripts/notifications/sxmo_notificationmonitor.sh index bf9b4e3..76c7376 100755 --- a/scripts/notifications/sxmo_notificationmonitor.sh +++ b/scripts/notifications/sxmo_notificationmonitor.sh @@ -4,7 +4,7 @@ # include common definitions # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh handlenewnotiffile(){ NOTIFFILE="$1" diff --git a/scripts/notifications/sxmo_notificationsmenu.sh b/scripts/notifications/sxmo_notificationsmenu.sh index aca00f0..7ac9952 100755 --- a/scripts/notifications/sxmo_notificationsmenu.sh +++ b/scripts/notifications/sxmo_notificationsmenu.sh @@ -6,7 +6,7 @@ # shellcheck source=configs/default_hooks/sxmo_hook_icons.sh . sxmo_hook_icons.sh # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh notificationmenu() { CHOICES="$icon_cls Close Menu\n$icon_del Clear Notifications" diff --git a/scripts/notifications/sxmo_notificationwrite.sh b/scripts/notifications/sxmo_notificationwrite.sh index 684951f..2f21257 100755 --- a/scripts/notifications/sxmo_notificationwrite.sh +++ b/scripts/notifications/sxmo_notificationwrite.sh @@ -4,7 +4,7 @@ # include common definitions # shellcheck source=scripts/core/sxmo_common.sh -. "$(dirname "$0")/sxmo_common.sh" +. sxmo_common.sh # Takes 4 args: # (1) the filepath of the notification to write (or random to generate a random id)