diff --git a/.bin/autostart-manage b/.bin/autostart-manage index 470f153..fca1bce 100755 --- a/.bin/autostart-manage +++ b/.bin/autostart-manage @@ -10,8 +10,15 @@ _systemctl () { systemctl --user "${@:2}" "$(_filename "$1")" } +_list () { + systemctl --user list-unit-files \ + | grep "autostart-" \ + | awk '{print $1}' \ + | sed -e 's/^autostart-//' -e 's/.service$//' +} + _echo_table () { - printf "Unit\tFilename\tEnabled\n" + printf "Unit\tFilename\tStatus\n" for unit in "$@" do printf "%s\t%s\t%s\n" \ @@ -32,23 +39,20 @@ EOF } _autostart_manage_list () { - systemctl --user list-unit-files \ - | grep "autostart-" \ - | awk '{print $1}' \ - | sed -e 's/^autostart-//' -e 's/.service$//' + _list } _autostart_manage_info () { - mapfile -t autostart_units < <( _autostart_manage_list ) + mapfile -t autostart_units < <( _list ) _echo_table "${autostart_units[@]}" | column -t -s$'\t' } -_autostart_manage_enable () { - _systemctl "$1" add-wants autostart.target -} - -_autostart_manage_disable () { - _systemctl "$1" disable +_autostart_manage_enable_all () { + mapfile -t autostart_units < <( _list ) + for unit in "${autostart_units[@]}" + do + _systemctl "$unit" add-wants autostart.target + done } _autostart_manage_rm () { @@ -59,8 +63,11 @@ case $1 in list) _autostart_manage_list ;; info) _autostart_manage_info ;; add) _autostart_manage_add "$2" "$3" ;; - enable) _autostart_manage_enable "$2" ;; - disable) _autostart_manage_disable "$2" ;; rm) _autostart_manage_rm "$2" ;; + enable-all) _autostart_manage_enable_all "$2" ;; + show) _systemctl "$2" cat ;; + edit) _systemctl "$2" edit --full ;; + enable) _systemctl "$2" add-wants autostart.target ;; + disable) _systemctl "$2" enable ;; *) echo "'$1' is not valid" ;; esac diff --git a/.xprofile b/.xprofile index 3be3943..b708839 100644 --- a/.xprofile +++ b/.xprofile @@ -5,27 +5,6 @@ numlockx on setxkbmap de setxkbmap -option caps:none -_autostart_apps() -{ - dunst & - parcellite & - solaar --window hide & - - conky --daemonize --config="$HOME/.config/conky/clock.conf" - conky --daemonize --config="$HOME/.config/conky/system.conf" - conky --daemonize --config="$HOME/.config/conky/archlinux-updates.conf" - - syncthing -no-browser & - /usr/lib/kdeconnectd & - qbittorrent & - - qutebrowser & - - mopidy & - - /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & -} - _autostart() { ### wait for audio @@ -38,8 +17,6 @@ _autostart() (pass notes/keepass | head -n 1 | keepassxc --pw-stdin ~/sync/passwords.kdbx) & pass x && sleep 5 - _autostart_apps & - systemctl --user start autostart.target }