Skip to content

Commit

Permalink
Add logic to check if input source is CJK
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyunje Jun committed Sep 15, 2017
1 parent 642028c commit 95be8f5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion kawa/InputSourceManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@ class InputSource: Equatable {
}

func select() {
TISSelectInputSource(tisInputSource)
let langs = InputSource.getProperty(tisInputSource, kTISPropertyInputSourceLanguages)! as Array<String>

if langs.contains(where: { $0 == "ko" || $0 == "ja" || $0.hasPrefix("zh") }) {
// Workaround for TIS CJK layout bug:
// FIXME: when it's CJK, select English first and then return
print("CJK")
} else {
TISSelectInputSource(tisInputSource)
}
}

func getRetinaImageURL(_ path: URL) -> URL {
Expand Down

0 comments on commit 95be8f5

Please sign in to comment.