Compare commits

..

No commits in common. "423b1821a718ebab18473fb18d25346f73467a22" and "0c17b6454a4efaf82a6d9a2ae6840ccd766ee1c7" have entirely different histories.

5 changed files with 25 additions and 94 deletions

View file

@ -1,73 +0,0 @@
#!/usr/bin/env bash
base_dir="$HOME/.config/systemd/user/"
_filename () {
echo "autostart-$1.service"
}
_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\tStatus\n"
for unit in "$@"
do
printf "%s\t%s\t%s\n" \
"$unit" \
"$(_filename "$unit")" \
"$(_systemctl "$unit" is-enabled)"
done
}
_autostart_manage_add () {
cat <<EOF >"$base_dir$(_filename "$1")"
[Unit]
Description=$1
[Service]
ExecStart=$2
EOF
}
_autostart_manage_list () {
_list
}
_autostart_manage_info () {
mapfile -t autostart_units < <( _list )
_echo_table "${autostart_units[@]}" | column -t -s$'\t'
}
_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 () {
rm "$base_dir$(_filename "$1")"
}
case $1 in
list) _autostart_manage_list ;;
info) _autostart_manage_info ;;
add) _autostart_manage_add "$2" "$3" ;;
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

View file

@ -2,7 +2,7 @@
_dote_completions() _dote_completions()
{ {
if [ "${#COMP_WORDS[@]}" == "1" ]; then if [ "${#COMP_WORDS[@]}" != "2" ]; then
return return
fi fi
@ -13,17 +13,3 @@ _dote_completions()
done < <(compgen -W "$(.e -l)" "${COMP_WORDS[1]}") done < <(compgen -W "$(.e -l)" "${COMP_WORDS[1]}")
} }
complete -F _dote_completions ".e" complete -F _dote_completions ".e"
_autostart_manage_completions()
{
if [ "${#COMP_WORDS[@]}" == "2" ]; then
return
fi
COMPREPLY=()
while IFS='' read -r line
do
COMPREPLY+=("$line")
done < <(compgen -W "$(autostart-manage list)" "${COMP_WORDS[1]}")
}
complete -F _autostart_manage_completions "autostart-manage"

View file

@ -1,5 +0,0 @@
[Unit]
Description=Current graphical user session
Documentation=man:systemd.special(7)
RefuseManualStart=no
StopWhenUnneeded=no

View file

@ -5,10 +5,31 @@ numlockx on
setxkbmap de setxkbmap de
setxkbmap -option caps:none 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() _autostart()
{ {
### wait for audio ### wait for audio
start-audio pipewire start_audio pipewire
### wait for internet ### wait for internet
wait_for_service "network-online.target" wait_for_service "network-online.target"
@ -17,6 +38,8 @@ _autostart()
(pass notes/keepass | head -n 1 | keepassxc --pw-stdin ~/sync/passwords.kdbx) & (pass notes/keepass | head -n 1 | keepassxc --pw-stdin ~/sync/passwords.kdbx) &
pass x && sleep 5 pass x && sleep 5
_autostart_apps &
systemctl --user start autostart.target systemctl --user start autostart.target
} }