X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=6360f5f684f1de7fec8840ddc1cbc7e653fbf1a9;hb=41249966740c33a591b9dcc14edc37ddaa595bb6;hp=296972970f9d85114a23fdbca745306f929362eb;hpb=7c81531c90c9fb23296f4d297bc2f4a0772793af;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 2969729..6360f5f 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -837,8 +837,18 @@ function grmlcomp () { _ssh_hosts=() _etc_hosts=() fi + + local localname + if check_com hostname ; then + localname=$(hostname) + elif check_com hostnamectl ; then + localname=$(hostnamectl --static) + else + localname="$(uname -n)" + fi + hosts=( - $(hostname) + "${localname}" "$_ssh_config_hosts[@]" "$_ssh_hosts[@]" "$_etc_hosts[@]" @@ -1856,7 +1866,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 +2519,17 @@ 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) + else + localname="$(uname -n)" + fi + + # set hostname if not running on local machine + if [[ -n "$HOSTNAME" ]] && [[ "$HOSTNAME" != "${localname}" ]] ; then NAME="@$HOSTNAME" fi }