Improve autostart-manage script

This commit is contained in:
Tobias Reisinger 2022-12-16 21:46:19 +01:00
parent e45acae5b4
commit cf6ef78b67
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
4 changed files with 24 additions and 6 deletions

View file

@ -18,13 +18,14 @@ _list () {
} }
_echo_table () { _echo_table () {
printf "Unit\tFilename\tStatus\n" printf "Unit\tFilename\tEnabled\tActive\n"
for unit in "$@" for unit in "$@"
do do
printf "%s\t%s\t%s\n" \ printf "%s\t%s\t%s\t%s\n" \
"$unit" \ "$unit" \
"$(_filename "$unit")" \ "$(_filename "$unit")" \
"$(_systemctl "$unit" is-enabled)" "$(_systemctl "$unit" is-enabled)" \
"$(_systemctl "$unit" is-active)"
done done
} }
@ -79,7 +80,10 @@ case $1 in
edit) _systemctl "$2" edit --full ;; edit) _systemctl "$2" edit --full ;;
enable) _systemctl "$2" add-wants autostart.target ;; enable) _systemctl "$2" add-wants autostart.target ;;
disable) _systemctl "$2" disable ;; disable) _systemctl "$2" disable ;;
restart) _systemctl "${2:-*}" restart;;
start) _systemctl "${2:-*}" start;;
status) _systemctl "${2:-*}" status ;; status) _systemctl "${2:-*}" status ;;
start) systemctl --user start autostart.target ;; stop) _systemctl "${2:-*}" stop ;;
run) systemctl --user start autostart.target ;;
*) echo "'$1' is not valid" ;; *) echo "'$1' is not valid" ;;
esac esac

View file

@ -6,5 +6,5 @@ case "$action" in
shutdown) systemctl poweroff -i ;; shutdown) systemctl poweroff -i ;;
reboot) systemctl reboot ;; reboot) systemctl reboot ;;
logout) systemctl --user exit ;; logout) systemctl --user exit ;;
autostart) autostart-manage start ;; autostart) autostart-manage run ;;
*) ;; esac *) ;; esac

View file

@ -0,0 +1,14 @@
[global]
# Your Spotify account name.
username = "serguzim"
password_cmd = "pass spotifyd"
use_mpris = true
backend = "pulseaudio"
volume_controller = "softvol"
device_name = "portalo"
#device_type = "computer" # correct but no shared sessions
device_type = "speaker" # allows shared sessions

View file

@ -21,7 +21,7 @@ _autostart()
pass x && sleep 5 pass x && sleep 5
autoinstall graphical autoinstall graphical
autostart-manage start autostart-manage run
} }
_autostart & _autostart &