diff options
author | Guangxiong Lin <[email protected]> | 2022-12-30 16:16:06 +0800 |
---|---|---|
committer | Guangxiong Lin <[email protected]> | 2022-12-30 16:16:06 +0800 |
commit | 5427e16b22973f17269c23ffaad539fc1c49d9e0 (patch) | |
tree | f2d724b1777616fbca2fb543347a259f85d941fc | |
parent | d33989f616136991955f9966fcfffac508b20bec (diff) | |
download | dotfiles-5427e16b22973f17269c23ffaad539fc1c49d9e0.tar.gz dotfiles-5427e16b22973f17269c23ffaad539fc1c49d9e0.tar.bz2 dotfiles-5427e16b22973f17269c23ffaad539fc1c49d9e0.zip |
Update autostart
-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" |