Skip to content

Commit

Permalink
improve registration under sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
LEOYoon-Tsaw committed May 18, 2024
1 parent e57c952 commit ed6b8d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 0 additions & 2 deletions Squirrel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,6 @@
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
OTHER_CODE_SIGN_FLAGS = "--deep";
OTHER_CPLUSPLUSFLAGS = (
"-DLEOPARD",
"-DHAVE_CONFIG_H",
Expand Down Expand Up @@ -672,7 +671,6 @@
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
OTHER_CODE_SIGN_FLAGS = "--deep";
OTHER_CPLUSPLUSFLAGS = (
"-DLEOPARD",
"-DHAVE_CONFIG_H",
Expand Down
2 changes: 2 additions & 0 deletions resources/Squirrel.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.temporary-exception.shared-preference.read-write</key>
<true/>
<key>com.apple.security.temporary-exception.files.absolute-path.read-write</key>
<array>
<string>/Library/Input Methods/Squirrel.app</string>
Expand Down
9 changes: 5 additions & 4 deletions sources/InputSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import InputMethodKit

final class SquirrelInstaller {
enum InputMode: String, CaseIterable {
static let primary = Self.main
case main = "im.rime.inputmethod.Squirrel"
static let primary = Self.hant
case hans = "im.rime.inputmethod.Squirrel.Hans"
case hant = "im.rime.inputmethod.Squirrel.Hant"
}
Expand Down Expand Up @@ -77,8 +76,10 @@ final class SquirrelInstaller {
let selectable = getBool(for: inputSource, key: kTISPropertyInputSourceIsSelectCapable),
let selected = getBool(for: inputSource, key: kTISPropertyInputSourceIsSelected),
enabled && selectable && !selected {
let error = TISSelectInputSource(inputSource)
print("Selection \(error == noErr ? "succeeds" : "fails") for input source: \(mode.rawValue)")
let error = TISSelectInputSource(inputSource)
print("Selection \(error == noErr ? "succeeds" : "fails") for input source: \(mode.rawValue)")
} else {
print("Failed to select \(mode.rawValue)")
}
}
}
Expand Down

0 comments on commit ed6b8d5

Please sign in to comment.