Fix code style

This commit is contained in:
Dominik Ritter 2017-03-08 23:19:03 +01:00
parent 569bef567f
commit 53eafeb414
1 changed files with 16 additions and 17 deletions

View File

@ -1650,32 +1650,31 @@ get_term_font() {
# thou, but that does not match to a guid in the plist. # thou, but that does not match to a guid in the plist.
# So, be warned! Collisions may occur! # So, be warned! Collisions may occur!
# See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg # See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg
local currentProfileName local current_profile_name
currentProfileName=$(osascript -e 'tell application "iTerm2" to profile name of current session of current window') 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! # 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
# Count Guids in "New Bookmarks"; they should be unique # Count Guids in "New Bookmarks"; they should be unique
local profilesCount local profiles_count
profilesCount=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null | grep -c "Guid") profiles_count="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null | grep -c "Guid")"
for idx in $(seq 0 "${profilesCount}"); do for ((i=0; i<=profiles_count; i++)); do
local profileName local profile_name
profileName=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Name:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null) profile_name="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${i}:Name:" ~/Library/Preferences/com.googlecode.iterm2.plist 2>/dev/null)"
if [[ "${profileName}" == "${currentProfileName}" ]]; then if [[ "$profile_name" == "$current_profile_name" ]]; then
# "Normal Font" # "Normal Font"
term_font=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Normal\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) term_font="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${i}:Normal\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)"
# Font for non-ascii characters # Font for non-ascii characters
# Only check for a different non-ascii font, if the user checked # Only check for a different non-ascii font, if the user checked
# the "use a different font for non-ascii text" switch. # the "use a different font for non-ascii text" switch.
local useDifferentFont local use_different_font
useDifferentFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Use\ Non-ASCII\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) use_different_font="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${i}:Use\ Non-ASCII\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)"
if [[ "$useDifferentFont" == "true" ]]; then if [[ "$use_different_font" == "true" ]]; then
local nonAsciiFont local non_ascii_font
nonAsciiFont=$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${idx}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist) non_ascii_font="$(/usr/libexec/PlistBuddy -c "Print :New\ Bookmarks:${i}:Non\ Ascii\ Font:" ~/Library/Preferences/com.googlecode.iterm2.plist)"
if [[ "$term_font" != "$nonAsciiFont" ]]; then [[ "$term_font" != "$non_ascii_font" ]] && \
term_font="$term_font (normal) / $nonAsciiFont (non-ascii)" term_font="$term_font (normal) / $non_ascii_font (non-ascii)"
fi
fi fi
fi fi
done done