Starting apps via array and loop now

This commit is contained in:
jon
2022-06-04 09:32:20 -05:00
parent 5b7e4cda54
commit c175a4a012

108
f01
View File

@@ -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