Skip to content

Instantly share code, notes, and snippets.

@eyaleizenberg
Last active April 18, 2018 06:34
Show Gist options
  • Save eyaleizenberg/8ede340db3cf1437ad8c50a306394b3a to your computer and use it in GitHub Desktop.
Save eyaleizenberg/8ede340db3cf1437ad8c50a306394b3a to your computer and use it in GitHub Desktop.
is_hebrew="$(defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources)"
lang="EN"
if [[ $is_hebrew = *"Hebrew"* ]]; then
lang="HE"
fi
tm_segment "" "colour243" "$lang"
tm_divider
-------------------------------------------------------
This is what I use for the tm_segment and tm_divider
tm_segment() {
icon=$1
color=$2
text=$3
res=""
[[ -z $color ]] && color="colour237"
[[ -n $icon ]] && res+="#[ fg=${color}, noreverse] ${icon}"
[[ -n $text ]] && res+="#[fg=${color} bg=default, noreverse] ${text} "
res+="#[bg=default, fg=default]"
echo -ne "$res"
}
tm_divider() {
echo -ne "#[fg=colour237]|#[bg=default, fg=default]"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment