blob: 382a57b297e1d5511fb6c61763ef915ffebe787e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# systemctl aliases
user_commands=(
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
)
sudo_commands=(
add-requires
add-wants
cancel
daemon-reexec
daemon-reload
default
disable
edit
emergency
enable
halt
import-environment
isolate
kexec
kill
link
list-machines
load
mask
preset
preset-all
reenable
reload
reload-or-restart
reset-failed
rescue
restart
revert
set-default
set-environment
set-property
start
stop
switch-root
try-reload-or-restart
try-restart
unmask
unset-environment
)
power_commands=(
hibernate
hybrid-sleep
poweroff
reboot
suspend
)
for c in $user_commands; do
alias "sc-$c"="systemctl $c"
alias "scu-$c"="systemctl --user $c"
done
for c in $sudo_commands; do
alias "sc-$c"="sudo systemctl $c"
alias "scu-$c"="systemctl --user $c"
done
for c in $power_commands; do
alias "sc-$c"="systemctl $c"
done
unset c user_commands sudo_commands power_commands
# --now commands
alias sc-enable-now="sc-enable --now"
alias sc-disable-now="sc-disable --now"
alias sc-mask-now="sc-mask --now"
alias scu-enable-now="scu-enable --now"
alias scu-disable-now="scu-disable --now"
alias scu-mask-now="scu-mask --now"
# --failed commands
alias scu-failed='systemctl --user --failed'
alias sc-failed='systemctl --failed'
function systemd_prompt_info {
local unit
for unit in "$@"; do
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_PREFIX"
if [[ -n "$ZSH_THEME_SYSTEMD_PROMPT_CAPS" ]]; then
echo -n "${(U)unit:gs/%/%%}:"
else
echo -n "${unit:gs/%/%%}:"
fi
if systemctl is-active "$unit" &>/dev/null; then
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_ACTIVE"
elif systemctl --user 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
}
|