From 4c48b426accb5f553012f920f7e1036746ce05d9 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 2 Aug 2017 13:06:17 +1000 Subject: [PATCH] general: Fix missing backslashes --- neofetch | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/neofetch b/neofetch index f4743eef..c92f37b7 100755 --- a/neofetch +++ b/neofetch @@ -810,14 +810,14 @@ get_wm_theme() { kdebugrc="${kde_config_dir}/kdebugrc" if [[ -f "$kwinrc" ]]; then - wm_theme="$(awk '/theme=/{gsub(/theme=.*qml_|theme=.*svg__/,"",$0); + wm_theme="$(awk '/theme=/{gsub(/theme=.*qml_|theme=.*svg__/,"",$0);\ print $0; exit}' "$kwinrc")" [[ -z "$wm_theme" ]] && \ - wm_theme="$(awk '/library=org.kde/{gsub(/library=org.kde./,"",$0); + wm_theme="$(awk '/library=org.kde/{gsub(/library=org.kde./,"",$0);\ print $0; exit}' "$kwinrc")" [[ -z "$wm_theme" ]] && \ - wm_theme="$(awk '/PluginLib=kwin3_/{gsub(/PluginLib=kwin3_/,"",$0); + wm_theme="$(awk '/PluginLib=kwin3_/{gsub(/PluginLib=kwin3_/,"",$0);\ print $0; exit}' "$kwinrc")" elif [[ -f "$kdebugrc" ]]; then @@ -1437,7 +1437,7 @@ get_song() { ;; "cmus"*) - song="$(cmus-remote -Q | awk '/tag artist/ {$1=$2=""; print; print " - "} + song="$(cmus-remote -Q | awk '/tag artist/ {$1=$2=""; print; print " - "}\ /tag title/ {$1=$2=""; print}')" ;; @@ -1446,14 +1446,14 @@ get_song() { "Linux") get_song_dbus "spotify" ;; "Mac OS X") - song="$(osascript -e 'tell application "Spotify" to artist of current track as + song="$(osascript -e 'tell application "Spotify" to artist of current track as \ string & " - " & name of current track as string')" ;; esac ;; "itunes"*) - song="$(osascript -e 'tell application "iTunes" to artist of current track as + song="$(osascript -e 'tell application "iTunes" to artist of current track as \ string & " - " & name of current track as string')" ;; @@ -1479,14 +1479,14 @@ get_song() { "quodlibet"*) song="$(dbus-send --print-reply --dest=net.sacredchao.QuodLibet \ /net/sacredchao/QuodLibet net.sacredchao.QuodLibet.CurrentSong |\ - awk -F'"' '/artist/ {getline; a=$2} + awk -F'"' '/artist/ {getline; a=$2} \ /title/ {getline; t=$2} END{print a " - " t}')" ;; "pogo"*) song="$(dbus-send --print-reply --dest=org.mpris.pogo /Player \ org.freedesktop.MediaPlayer.GetMetadata | - awk -F'"' '/string "artist"/ {getline; a=$2} /string "title"/ {getline; t=$2} + awk -F'"' '/string "artist"/ {getline; a=$2} /string "title"/ {getline; t=$2} \ END{print a " - " t}')" ;; @@ -1563,7 +1563,7 @@ get_resolution() { case "$refresh_rate" in "on") resolution="$(xrandr --nograb --current |\ - awk 'match($0,/[0-9]*\.[0-9]*\*/) {printf $1 " @ " + awk 'match($0,/[0-9]*\.[0-9]*\*/) {printf $1 " @ "\ substr($0,RSTART,RLENGTH) "Hz, "}')" ;; @@ -1797,7 +1797,7 @@ get_term_font() { ;; "Apple_Terminal") - term_font="$(osascript -e 'tell application "Terminal" to + term_font="$(osascript -e 'tell application "Terminal" to \ font name of window frontmost')" ;; @@ -1809,18 +1809,15 @@ get_term_font() { # See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg local current_profile_name profiles_count profile_name diff_font none_ascii - current_profile_name="$(osascript -e 'tell application "iTerm2" to profile name + current_profile_name="$(osascript -e 'tell application "iTerm2" to profile name \ of current session of current window')" # Warning: Dynamic profiles are not taken into account here! # https://www.iterm2.com/documentation-dynamic-profiles.html + font_file="${HOME}/Library/Preferences/com.googlecode.iterm2.plist" # Count Guids in "New Bookmarks"; they should be unique - profiles_count="$(PlistBuddy -c "Print :New\ Bookmarks:" \ - "" |\ - grep -c "Guid")" - - font_file="${HOME}/Library/Preferences/com.googlecode.iterm2.plist" + profiles_count="$(PlistBuddy -c "Print :New\ Bookmarks:" "$font_file" | grep -c "Guid")" for ((i=0; i<=profiles_count; i++)); do profile_name="$(PlistBuddy -c "Print :New\ Bookmarks:${i}:Name:" "$font_file")" @@ -1901,8 +1898,8 @@ get_term_font() { role="${role//\"}" profile="$(awk -F '=' -v r="$role" \ - '$0~r {getline; if(/Maximized/) getline; - if(/Fullscreen/) getline; id=$2"]"} + '$0~r {getline; if(/Maximized/) getline; \ + if(/Fullscreen/) getline; id=$2"]"} \ $0~id {if(id) {getline; print $2; exit}}' "$mateterm_config")" rm -f "$mateterm_config" @@ -1950,7 +1947,7 @@ get_term_font() { [[ -f "${XDG_CONFIG_HOME}/termite/config" ]] && \ termite_config="${XDG_CONFIG_HOME}/termite/config" - term_font="$(awk -F '= ' '/\[options\]/ {opt=1} /^\s*font/ {if(opt==1) a=$2; opt=0} + term_font="$(awk -F '= ' '/\[options\]/ {opt=1} /^\s*font/ {if(opt==1) a=$2; opt=0} \ END{print a}' "/etc/xdg/termite/config" "$termite_config")" ;;