Merge remote-tracking branch 'origin/github/pr/95'
authorMichael Prokop <mika@grml.org>
Wed, 27 May 2020 09:14:01 +0000 (11:14 +0200)
committerMichael Prokop <mika@grml.org>
Wed, 27 May 2020 09:14:01 +0000 (11:14 +0200)
1  2 
etc/zsh/zshrc

diff --combined etc/zsh/zshrc
@@@ -837,16 -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[@]"
@@@ -1864,7 -1856,7 +1864,7 @@@ don
  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)
@@@ -2517,15 -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
  }