From c175a4a012c28eae9bc93a582f98e98f58efe27d Mon Sep 17 00:00:00 2001 From: jon Date: Sat, 4 Jun 2022 09:32:20 -0500 Subject: [PATCH] Starting apps via array and loop now --- f01 | 108 ++++++++++-------------------------------------------------- 1 file changed, 17 insertions(+), 91 deletions(-) diff --git a/f01 b/f01 index 5056b38..985958f 100755 --- a/f01 +++ b/f01 @@ -39,102 +39,28 @@ xcalib /s/misc/monitor_calibration/dell.icc ############################################# # Launch scripts # Check if running first for idempotency +# 20220604 - dramatically simplified using a loop+array ############################################# -# compositor - for true transparency -# compton is dead, picom is a fork -if pgrep -x -u $USERNAME "picom" > /dev/null -then - #already running - do nothing - echo "picom - Already Running ..." -else - # not running - launch - picom & -fi +HOME_DIR=$HOME +echo $HOME -# pasystray - volume control -if pgrep -x -u $USERNAME "pasystray" > /dev/null -then - #already running - do nothing - echo "pasystray - Already Running ..." -else - # not running - launch - pasystray & -fi +apps=( "picom" "pasystray" "jstat" "keepassxc" "solaar" "nextcloud" "playerctld" "fcitx5" ) -# clipboard manager -if pgrep -x -u $USERNAME "copyq" > /dev/null -then - #already running - do nothing - echo "copyq - Already Running ..." -else - # not running - launch - # 2021-08-18 JMD - commented out its making gimp crash when i copy - #copyq & - echo "Not really starting, it breaks gimp!" -fi - -# launch menu bar status script -if pgrep -x "jstat" >/dev/null -then - echo "jstat - Already Running ..." -else - echo "jstat stopped - starting now" - jstat & -fi - -# launch keepassxc -if pgrep -x "keepassxc" >/dev/null -then - echo "keepassxc - Already Running ..." -else - echo "keepassxc stopped - starting now" - keepassxc & -fi - -# launch nextcloud -if pgrep -x "nextcloud" >/dev/null -then - echo "nextcloud - Already Running ..." -else - echo "nextcloud stopped - starting now" - nextcloud & -fi - -# launch solaar - mouse tool -if pgrep -x "solaar" >/dev/null -then - echo "solaar - Already Running ..." -else - echo "solaar stopped - starting now" - /usr/bin/solaar -w hide & -fi - -# launch playerctld - keyboard shortcuts for play/pause -if pgrep -x "playerctld" >/dev/null -then - if [ -f "/usr/bin/playerctld" ] +for i in "${apps[@]}" +do + if pgrep -x "$i" >/dev/null then - echo "playerctld - Already Running ..." - else - echo "playerctld - Error - playerctld binary not found!" - fi -else - echo "playerctld stopped - starting now" - /usr/bin/playerctld & -fi - -# launch fcitx5 if we're on wayland -if [ "$XDG_SESSION_TYPE" == "wayland" ]; then - if pgrep -x "fcitx5" >/dev/null; then - echo "fcitx5 - Already running ..." - else - if [ -f "/usr/bin/fcitx5" ]; then - echo "fcitx5 - Starting ..." - /usr/bin/fcitx5 & + # check for binary + if [ -f "/usr/bin/$i" ] || [ -f "$HOME/bin/$i" ] || [ -f "/usr/local/bin/$i" ] + then + echo "$i - Already Running ..." else - echo "fcitx5 - binary not found." + echo "$i - Error - $i binary not found!" fi + else + echo "$i stopped - starting now" + command $i & fi - # else run ibus-daemon -fi +done +