=Better systemctl handling

This commit is contained in:
Gal Szkolnik 2022-08-26 14:13:42 -04:00
parent 64add644e5
commit 9dbfb53327
2 changed files with 1 additions and 19 deletions

View File

@ -1,18 +0,0 @@
get_clean_path() {
sed 's/ *:\?$//g;s/`/``/g;s/:/`:`/g;s/\\`:`/\\:/g;' <<< $1 | \
awk -v RS='`:`' -v ORS='`:`' '!arr[$0]++' | \
sed 's/`:`/:/g;s/:$//g'
}
# set PATH so it includes user's private bin if it exists
if [[ -d "$HOME/bin" ]] ; then
export PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [[ -d "$HOME/.local/bin" ]] ; then
export PATH="$HOME/.local/bin:$PATH"
fi
PATH=$( get_clean_path $PATH )

View File

@ -63,7 +63,7 @@
"style": "powerline",
"properties": {
"shell": "bash",
"command": "systemctl is-system-running || true"
"command": "'[[ -n \"$(type -t systemctl)\" ]] && systemctl is-system-running || true'"
},
"template": "{{ if not (contains \"running\" .Output) }} {{ .Output }} {{ end }}"
},