diff options
-rwxr-xr-x | bin/autostart | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/bin/autostart b/bin/autostart index 6fb5da2..5580f74 100755 --- a/bin/autostart +++ b/bin/autostart @@ -1,23 +1,26 @@ #!/usr/bin/env bash -[ -f /usr/bin/fcitx5 ] && fcitx5 -d +run_if_exists () { + local prog="$1" + if command -v "$prog" > /dev/null; then + "$@" & + fi +} -[ -f /usr/bin/dunst ] && dunst & -[ -f /usr/bin/udiskie ] && udiskie -a -n -s --appindicator & - -[ -f /usr/bin/clipmenud ] && clipmenud & +run_if_exists fcitx5 -d +run_if_exists dunst +run_if_exists udiskie -a -n -s --appindicator +run_if_exists clipmenud +run_if_exists lxqt-policykit-agent if [ "$XDG_SESSION_TYPE" = x11 ]; then - [ -f ~/.fehbg ] && ~/.fehbg & + run_if_exists "$HOME/.fehbg" fi if [ "$XDG_SESSION_TYPE" = wayland ]; then - command -v gammastep > /dev/null && \ - command -v awk > /dev/null && \ - command -v tr > /dev/null && \ - gammastep \ + run_if_exists gammastep \ -l $(curl -s "https://location.services.mozilla.com/v1/geolocate?key=geoclue" | awk 'OFS=":" {print $3,$5}' | tr -d ',}') \ -m wayland fi -[ -x "$HOME/.local/autostart" ] && "$HOME/.local/autostart" +run_if_exists "$HOME/.local/autostart" |