X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=43cda0cd9f93be08c13d216a809f2f387b626bcd;hb=05add691b8590d4b4532f1e0111f32dc1723494a;hp=296972970f9d85114a23fdbca745306f929362eb;hpb=675c85b5e23d4eb5ce94b7aaf300f6847cd0af81;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 2969729..43cda0c 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -837,8 +837,16 @@ function grmlcomp () { _ssh_hosts=() _etc_hosts=() fi + + local localname + if check_com hostname ; then + localname=$(hostname) + elif check_com hostnamectl ; then + localname=$(hostnamectl --static) + fi + hosts=( - $(hostname) + "${localname}" "$_ssh_config_hosts[@]" "$_ssh_hosts[@]" "$_etc_hosts[@]" @@ -1856,7 +1864,7 @@ done function batterydarwin () { GRML_BATTERY_LEVEL='' local -a table -table=( ${$(pmset -g ps)[(w)7,8]%%(\%|);} ) +table=( ${$(pmset -g ps)[(w)8,9]%%(\%|);} ) if [[ -n $table[2] ]] ; then case $table[2] in charging) @@ -2509,8 +2517,15 @@ function grml_vcs_to_screen_title () { } function grml_maintain_name () { - # set hostname if not running on host with name 'grml' - if [[ -n "$HOSTNAME" ]] && [[ "$HOSTNAME" != $(hostname) ]] ; then + local localname + if check_com hostname ; then + localname=$(hostname) + elif check_com hostnamectl ; then + localname=$(hostnamectl --static) + fi + + # set hostname if not running on local machine + if [[ -n "$HOSTNAME" ]] && [[ "$HOSTNAME" != "${localname}" ]] ; then NAME="@$HOSTNAME" fi }