general: Fix missing backslashes

This commit is contained in:
Dylan Araps 2017-08-02 13:06:17 +10:00
parent e53404e349
commit 4c48b426ac
1 changed files with 16 additions and 19 deletions

View File

@ -810,14 +810,14 @@ get_wm_theme() {
kdebugrc="${kde_config_dir}/kdebugrc" kdebugrc="${kde_config_dir}/kdebugrc"
if [[ -f "$kwinrc" ]]; then 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")" print $0; exit}' "$kwinrc")"
[[ -z "$wm_theme" ]] && \ [[ -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")" print $0; exit}' "$kwinrc")"
[[ -z "$wm_theme" ]] && \ [[ -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")" print $0; exit}' "$kwinrc")"
elif [[ -f "$kdebugrc" ]]; then elif [[ -f "$kdebugrc" ]]; then
@ -1437,7 +1437,7 @@ get_song() {
;; ;;
"cmus"*) "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}')" /tag title/ {$1=$2=""; print}')"
;; ;;
@ -1446,14 +1446,14 @@ get_song() {
"Linux") get_song_dbus "spotify" ;; "Linux") get_song_dbus "spotify" ;;
"Mac OS X") "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')" string & " - " & name of current track as string')"
;; ;;
esac esac
;; ;;
"itunes"*) "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')" string & " - " & name of current track as string')"
;; ;;
@ -1479,14 +1479,14 @@ get_song() {
"quodlibet"*) "quodlibet"*)
song="$(dbus-send --print-reply --dest=net.sacredchao.QuodLibet \ song="$(dbus-send --print-reply --dest=net.sacredchao.QuodLibet \
/net/sacredchao/QuodLibet net.sacredchao.QuodLibet.CurrentSong |\ /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}')" /title/ {getline; t=$2} END{print a " - " t}')"
;; ;;
"pogo"*) "pogo"*)
song="$(dbus-send --print-reply --dest=org.mpris.pogo /Player \ song="$(dbus-send --print-reply --dest=org.mpris.pogo /Player \
org.freedesktop.MediaPlayer.GetMetadata | 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}')" END{print a " - " t}')"
;; ;;
@ -1563,7 +1563,7 @@ get_resolution() {
case "$refresh_rate" in case "$refresh_rate" in
"on") "on")
resolution="$(xrandr --nograb --current |\ 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, "}')" substr($0,RSTART,RLENGTH) "Hz, "}')"
;; ;;
@ -1797,7 +1797,7 @@ get_term_font() {
;; ;;
"Apple_Terminal") "Apple_Terminal")
term_font="$(osascript -e 'tell application "Terminal" to term_font="$(osascript -e 'tell application "Terminal" to \
font name of window frontmost')" font name of window frontmost')"
;; ;;
@ -1809,18 +1809,15 @@ get_term_font() {
# See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg # See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg
local current_profile_name profiles_count profile_name diff_font none_ascii 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')" of current session of current window')"
# Warning: Dynamic profiles are not taken into account here! # Warning: Dynamic profiles are not taken into account here!
# https://www.iterm2.com/documentation-dynamic-profiles.html # 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 # Count Guids in "New Bookmarks"; they should be unique
profiles_count="$(PlistBuddy -c "Print :New\ Bookmarks:" \ profiles_count="$(PlistBuddy -c "Print :New\ Bookmarks:" "$font_file" | grep -c "Guid")"
"" |\
grep -c "Guid")"
font_file="${HOME}/Library/Preferences/com.googlecode.iterm2.plist"
for ((i=0; i<=profiles_count; i++)); do for ((i=0; i<=profiles_count; i++)); do
profile_name="$(PlistBuddy -c "Print :New\ Bookmarks:${i}:Name:" "$font_file")" profile_name="$(PlistBuddy -c "Print :New\ Bookmarks:${i}:Name:" "$font_file")"
@ -1901,8 +1898,8 @@ get_term_font() {
role="${role//\"}" role="${role//\"}"
profile="$(awk -F '=' -v r="$role" \ profile="$(awk -F '=' -v r="$role" \
'$0~r {getline; if(/Maximized/) getline; '$0~r {getline; if(/Maximized/) getline; \
if(/Fullscreen/) getline; id=$2"]"} if(/Fullscreen/) getline; id=$2"]"} \
$0~id {if(id) {getline; print $2; exit}}' "$mateterm_config")" $0~id {if(id) {getline; print $2; exit}}' "$mateterm_config")"
rm -f "$mateterm_config" rm -f "$mateterm_config"
@ -1950,7 +1947,7 @@ get_term_font() {
[[ -f "${XDG_CONFIG_HOME}/termite/config" ]] && \ [[ -f "${XDG_CONFIG_HOME}/termite/config" ]] && \
termite_config="${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")" END{print a}' "/etc/xdg/termite/config" "$termite_config")"
;; ;;