From 0d3ab3636416802c7cada32c9164db3ec6048e53 Mon Sep 17 00:00:00 2001 From: bessonm Date: Sun, 11 Nov 2018 19:49:59 +0100 Subject: [PATCH 1/2] Match terminal wrapped by Nix and extract its name --- neofetch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neofetch b/neofetch index 38477f0a9..3bb55a236 100755 --- a/neofetch +++ b/neofetch @@ -2778,6 +2778,10 @@ get_term() { break ;; + "."*"-wrap"*) + [[ $name =~ \.(.*)-wrap.* ]] && term=${BASH_REMATCH[1]} + ;; + "gnome-terminal-") term="gnome-terminal" ;; "urxvtd") term="urxvt" ;; *"nvim") term="Neovim Terminal" ;; From a7cf2ec07fcfa2114d80fd4366d0b12dfad7d45e Mon Sep 17 00:00:00 2001 From: bessonm Date: Sun, 11 Nov 2018 19:52:15 +0100 Subject: [PATCH 2/2] Use $XDG_CONFIG_DIRS to find termite config file ie. Using Nix, directory /etc/xdg does not exist, while $XDG_CONFIG_DIRS is set. Respect XDG directory precedence - Break loop on $XDG_CONFIG_DIRS when a config is found --- neofetch | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 3bb55a236..298c0e2d5 100755 --- a/neofetch +++ b/neofetch @@ -3031,13 +3031,24 @@ END [[ -f "${XDG_CONFIG_HOME}/termite/config" ]] && \ termite_config="${XDG_CONFIG_HOME}/termite/config" + XDG_DIR="/etc/xdg" + OLD_IFS=$IFS + IFS=":" + for directory in $XDG_CONFIG_DIRS; do + if [[ -f "$directory/termite/config" ]]; then + XDG_DIR="$directory" + break + fi + done + IFS=$OLD_IFS + term_font="$(awk -F '= ' '/\[options\]/ { opt=1 } /^\s*font/ { if(opt==1) a=$2; opt=0 - } END {print a}' "/etc/xdg/termite/config" \ + } END {print a}' "$XDG_DIR/termite/config" \ "$termite_config")" ;;