Permalink
Browse files

Add language detection because god dammit Swedish!

  • Loading branch information...
erikzaadi committed Jun 19, 2017
1 parent 7112df5 commit b2b3cfd444e1ca56950ec013b0be6f846d406a6e
Showing with 55 additions and 1 deletion.
  1. +36 −0 bin-mac/apple-language
  2. +18 −0 bin-mac/apple-language-to-emoji
  3. +1 −1 tmux/tmux.solarized.dark.conf
View
@@ -0,0 +1,36 @@
#!/usr/bin/env osascript
# Example call.
#set activeKbdLayout to my getActiveKeyboardLayout() # ->, e.g., "U.S."
on getActiveKeyboardLayout()
# Surprisingly, using POSIX-style paths (even with '~') works with
# the `property list file` type.
set plistPath to "~/Library/Preferences/com.apple.HIToolbox.plist"
# !! First, ensure that the plist cache is flushed and that the
# !! *.plist file contains the current value; simply executing
# !! `default read` against the file - even with a dummy
# !! key - does that.
try
do shell script "defaults read " & plistPath & " dummy"
end try
tell application "System Events"
repeat with pli in property list items of ¬
property list item "AppleSelectedInputSources" of ¬
property list file plistPath
# Look for (first) entry with key "KeyboardLayout Name" and return
# its value.
# Note: Not all entries may have a 'KeyboardLayout Name' key,
# so we must ignore errors.
try
return value of property list item "KeyboardLayout Name" of pli
end try
end repeat
end tell
end getActiveKeyboardLayout
set currentLanguage to getActiveKeyboardLayout()
do shell script "echo " & quoted form of currentLanguage
@@ -0,0 +1,18 @@
#!/bin/bash
CURRENT_LANGUAGE=`apple-language`
SWEDEN="🇸🇪"
ISRAEL="🇮🇱"
US="🇺🇸"
case ${CURRENT_LANGUAGE} in
ABC)
echo ${US}
;;
Swedish)
echo ${SWEDEN}
;;
Hebrew)
echo ${ISRAEL}
;;
esac
@@ -24,6 +24,6 @@ setw -g window-status-activity-attr 'bold'
setw -g window-status-separator ''
setw -g window-status-bg 'colour0'
set -g status-left '#[fg=colour15,bg=colour14,bold] #S #[fg=colour14,bg=colour0,nobold,nounderscore,noitalics]#[fg=colour0,bg=colour14,nobold,nounderscore,noitalics]'
set -g status-right '#[fg=colour0,bg=colour0,nobold,nounderscore,noitalics]#[fg=colour10,bg=colour0] #{prefix_highlight}#[fg=colour11,bg=colour0,nobold,nounderscore,noitalics]#[fg=colour7,bg=colour11] #(itunes-tmux.sh || echo "") %a %b %d 🕐 %R #(battery) #(wifi) #(docker-status-check.sh)#[fg=colour14,bg=colour11,nobold,nounderscore,noitalics]#[fg=colour15,bg=colour14] #(whoami)💻 #h '
set -g status-right '#[fg=colour0,bg=colour0,nobold,nounderscore,noitalics]#[fg=colour10,bg=colour0] #{prefix_highlight}#[fg=colour11,bg=colour0,nobold,nounderscore,noitalics]#[fg=colour7,bg=colour11] #(itunes-tmux.sh || echo "") %a %b %d 🕐 %R #(battery) #(wifi) #(docker-status-check.sh)#[fg=colour14,bg=colour11,nobold,nounderscore,noitalics]#[fg=colour15,bg=colour14] #(apple-language-to-emoji) #(whoami)💻 #h '
setw -g window-status-format '#[fg=colour0,bg=colour0,nobold,nounderscore,noitalics]#[default] #I:#W #[fg=colour0,bg=colour0,nobold,nounderscore,noitalics]'
setw -g window-status-current-format '#[fg=colour15,bold] #I:#W#[default]'

0 comments on commit b2b3cfd

Please sign in to comment.