2012-10-01 14:29:06 +00:00
|
|
|
user_commands=(
|
2020-02-10 18:16:02 +00:00
|
|
|
cat
|
|
|
|
get-default
|
|
|
|
help
|
|
|
|
is-active
|
|
|
|
is-enabled
|
|
|
|
is-failed
|
|
|
|
is-system-running
|
|
|
|
list-dependencies
|
|
|
|
list-jobs
|
|
|
|
list-sockets
|
|
|
|
list-timers
|
|
|
|
list-unit-files
|
|
|
|
list-units
|
|
|
|
show
|
|
|
|
show-environment
|
|
|
|
status)
|
2012-10-01 14:29:06 +00:00
|
|
|
|
|
|
|
sudo_commands=(
|
2020-02-10 18:16:02 +00:00
|
|
|
add-requires
|
|
|
|
add-wants
|
|
|
|
cancel
|
|
|
|
daemon-reexec
|
|
|
|
daemon-reload
|
|
|
|
default
|
|
|
|
disable
|
|
|
|
edit
|
|
|
|
emergency
|
|
|
|
enable
|
|
|
|
halt
|
|
|
|
hibernate
|
|
|
|
hybrid-sleep
|
|
|
|
import-environment
|
|
|
|
isolate
|
|
|
|
kexec
|
|
|
|
kill
|
|
|
|
link
|
|
|
|
list-machines
|
|
|
|
load
|
|
|
|
mask
|
|
|
|
poweroff
|
|
|
|
preset
|
|
|
|
preset-all
|
|
|
|
reboot
|
|
|
|
reenable
|
|
|
|
reload
|
|
|
|
reload-or-restart
|
|
|
|
reset-failed
|
|
|
|
rescue
|
|
|
|
restart
|
|
|
|
revert
|
|
|
|
set-default
|
|
|
|
set-environment
|
|
|
|
set-property
|
|
|
|
start
|
|
|
|
stop
|
|
|
|
suspend
|
|
|
|
switch-root
|
|
|
|
try-reload-or-restart
|
|
|
|
try-restart
|
|
|
|
unmask
|
|
|
|
unset-environment)
|
2012-10-01 14:29:06 +00:00
|
|
|
|
|
|
|
for c in $user_commands; do; alias sc-$c="systemctl $c"; done
|
|
|
|
for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done
|
2018-08-19 19:39:58 +00:00
|
|
|
for c in $user_commands; do; alias scu-$c="systemctl --user $c"; done
|
|
|
|
for c in $sudo_commands; do; alias scu-$c="systemctl --user $c"; done
|
2015-09-06 11:01:09 +00:00
|
|
|
|
|
|
|
alias sc-enable-now="sc-enable --now"
|
|
|
|
alias sc-disable-now="sc-disable --now"
|
|
|
|
alias sc-mask-now="sc-mask --now"
|
2018-08-19 19:39:58 +00:00
|
|
|
|
|
|
|
alias scu-enable-now="scu-enable --now"
|
|
|
|
alias scu-disable-now="scu-disable --now"
|
|
|
|
alias scu-mask-now="scu-mask --now"
|
2020-02-18 22:04:14 +00:00
|
|
|
|
|
|
|
function systemd_prompt_info {
|
|
|
|
local unit
|
|
|
|
for unit in $@; do
|
|
|
|
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_PREFIX"
|
|
|
|
[[ -n "$ZSH_THEME_SYSTEMD_PROMPT_CAPS" ]] && echo "${(U)unit}:" || echo "$unit:"
|
|
|
|
if systemctl is-active $unit &>/dev/null; then
|
|
|
|
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_ACTIVE"
|
|
|
|
else
|
|
|
|
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_NOTACTIVE"
|
|
|
|
fi
|
|
|
|
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_SUFFIX"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|