diff --git a/mac/Keyman4Mac/Keyman4Mac/Info.plist b/mac/Keyman4Mac/Keyman4Mac/Info.plist
index 722ecba1d3..270ca251ca 100644
--- a/mac/Keyman4Mac/Keyman4Mac/Info.plist
+++ b/mac/Keyman4Mac/Keyman4Mac/Info.plist
@@ -17,11 +17,11 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- Keyman $(PRODUCT_VERSION) for macOS
+ 13.0.99
CFBundleSignature
????
CFBundleVersion
- $(PRODUCT_VERSION)
+ 13.0.99
LSMinimumSystemVersion
$(MACOSX_DEPLOYMENT_TARGET)
NSHumanReadableCopyright
diff --git a/mac/Keyman4MacIM/Keyman-template.dmg b/mac/Keyman4MacIM/Keyman-template.dmg
index 34c4a4ca78..357cea1845 100644
Binary files a/mac/Keyman4MacIM/Keyman-template.dmg and b/mac/Keyman4MacIM/Keyman-template.dmg differ
diff --git a/mac/Keyman4MacIM/Keyman4MacIM/Info.plist b/mac/Keyman4MacIM/Keyman4MacIM/Info.plist
index d3c18c359b..4735a28acb 100644
--- a/mac/Keyman4MacIM/Keyman4MacIM/Info.plist
+++ b/mac/Keyman4MacIM/Keyman4MacIM/Info.plist
@@ -2,8 +2,6 @@
- NSAppleEventsUsageDescription
- Keyman needs to send key events to the target application.
CFBundleDevelopmentRegion
English
CFBundleDocumentTypes
@@ -25,6 +23,8 @@
CFBundleExecutable
$(EXECUTABLE_NAME)
+ CFBundleGetInfoString
+ $(GET_INFO_STRING)
CFBundleIconFile
CFBundleIdentifier
@@ -36,7 +36,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- $(PRODUCT_VERSION)
+ 13.0.99
CFBundleSignature
????
CFBundleURLTypes
@@ -51,13 +51,11 @@
CFBundleVersion
- $(PRODUCT_VERSION)
- CFBundleGetInfoString
- $(GET_INFO_STRING)
+ 13.0.99
Fabric
APIKey
- 68056571ada44ad2d93864380272808ada308b24
+ 4efced22a226f98e05442a7e472b377d89fcc294
Kits
@@ -80,6 +78,8 @@
LSMinimumSystemVersion
$(MACOSX_DEPLOYMENT_TARGET)
+ NSAppleEventsUsageDescription
+ Keyman needs to send key events to the target application.
NSHumanReadableCopyright
$(COPYRIGHT_STRING)
NSMainNibFile
diff --git a/mac/Keyman4MacIM/make-km-dmg.sh b/mac/Keyman4MacIM/make-km-dmg.sh
index ac9c2ff4d3..6702b2b7c9 100755
--- a/mac/Keyman4MacIM/make-km-dmg.sh
+++ b/mac/Keyman4MacIM/make-km-dmg.sh
@@ -44,11 +44,11 @@ popd > /dev/null
. $KEYMAN_MACIM_BASE_PATH/../bashHelperFunctions.sh
-KM_APP_NAME="Keyman.app"
-SOURCE_KM_APP="$KEYMAN_MACIM_BASE_PATH/build/Release/$KM_APP_NAME"
+KM_APP_NAME="Install Keyman.app"
OUTPUT_DIR="$KEYMAN_MACIM_BASE_PATH/output"
STAGING_DIR="$OUTPUT_DIR/temp"
DEST_DIR="$OUTPUT_DIR/upload"
+SOURCE_KM_APP="$OUTPUT_DIR/$KM_APP_NAME"
ADD_VERSION_TO_DEST_DIR=true
TEMPLATE_IMAGE="$KEYMAN_MACIM_BASE_PATH/Keyman-template.dmg"
VERBOSITY=""
@@ -139,6 +139,8 @@ elif [[ ! -d "$DEST_DIR" ]]; then
fail "Destination dir exists but is not a directory: $2"
fi
+# TODO: Check that no Keyman volume is already mounted.
+
# Step 1 - Copy template to working copy to prevent unintended changes
WORKING_COPY_OF_IMAGE="$OUTPUT_DIR/Keyman-temp-$KM_VERSION.dmg"
displayInfo "Copying \"$TEMPLATE_IMAGE\" to \"$WORKING_COPY_OF_IMAGE\"..."
@@ -165,9 +167,13 @@ fi
# Step 3 - Replace existing application files with new version
displayInfo "Copying files from \"$SOURCE_KM_APP\"..."
+find "$DEST_KM_APP" -mindepth 1 -maxdepth 1
+echo "---------"
find "$DEST_KM_APP" -mindepth 1 -maxdepth 1 -print0 | xargs -0 rm -rf
cp -fR "$SOURCE_KM_APP/" "$DEST_KM_APP"
+ls -la /Volumes/Keyman/background/
+
# Step 4 - Detach/unmount the temporary image/staging area
displayInfo "Detaching \"$WORKING_COPY_OF_IMAGE\""
hdiutil detach $STAGING_DIR $VERBOSITY
diff --git a/mac/KeymanEngine4Mac/KeymanEngine4Mac/Info.plist b/mac/KeymanEngine4Mac/KeymanEngine4Mac/Info.plist
index db9a1b2335..9dc9580150 100644
--- a/mac/KeymanEngine4Mac/KeymanEngine4Mac/Info.plist
+++ b/mac/KeymanEngine4Mac/KeymanEngine4Mac/Info.plist
@@ -6,6 +6,8 @@
en
CFBundleExecutable
$(EXECUTABLE_NAME)
+ CFBundleGetInfoString
+ $(GET_INFO_STRING)
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
@@ -15,13 +17,11 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- Keyman Engine $(PRODUCT_VERSION) for macOS
- CFBundleGetInfoString
- $(GET_INFO_STRING)
+ 13.0.99
CFBundleSignature
????
CFBundleVersion
- $(PRODUCT_VERSION)
+ 13.0.99
NSHumanReadableCopyright
$(COPYRIGHT_STRING_RIGHTS)
NSPrincipalClass
diff --git a/mac/build.sh b/mac/build.sh
index 3d46c1cb09..599d3e56ca 100755
--- a/mac/build.sh
+++ b/mac/build.sh
@@ -1,5 +1,7 @@
#!/bin/sh
+set -e
+
# Include our resource functions; they're pretty useful!
. ../resources/shellHelperFunctions.sh
@@ -445,6 +447,10 @@ if $LOCALDEPLOY ; then
elif $PREPRELEASE ; then
echo_heading "Preparing files for release deployment..."
# Create the disk image
+ pushd setup
+ eval "./build.sh"
+ popd
+
eval "$KM4MIM_BASE_PATH/make-km-dmg.sh" -version $KM_VERSION $QUIET_FLAG
if [ $? == 0 ]; then
displayInfo "Creating disk image succeeded!" ""
diff --git a/mac/setup/Install Keyman.app/Contents/Info.plist b/mac/setup/Install Keyman.app/Contents/Info.plist
new file mode 100644
index 0000000000..a99fad9639
--- /dev/null
+++ b/mac/setup/Install Keyman.app/Contents/Info.plist
@@ -0,0 +1,114 @@
+
+
+
+
+ BuildMachineOSBuild
+ 18A391019
+ CFBundleDevelopmentRegion
+ English
+ CFBundleDocumentTypes
+
+
+ CFBundleTypeExtensions
+
+ *
+
+ CFBundleTypeOSTypes
+
+ ****
+
+ CFBundleTypeRole
+ Viewer
+
+
+ CFBundleExecutable
+ CocoaApplet
+ CFBundleIconFile
+ applet
+ CFBundleIdentifier
+ com.keyman.mac.installKeyman
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ Install Keyman
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ 1.0
+ CFBundleSignature
+ aplt
+ CFBundleSupportedPlatforms
+
+ MacOSX
+
+ CFBundleVersion
+ 1.0
+ DTCompiler
+ com.apple.compilers.llvm.clang.1_0
+ DTPlatformBuild
+ 11M392v
+ DTPlatformName
+ macosx
+ DTPlatformVersion
+ 10.15
+ DTSDKBuild
+ 19C38
+ DTSDKName
+ macosx10.15internal
+ DTXcode
+ 1100
+ DTXcodeBuild
+ 11M392v
+ LSApplicationCategoryType
+ public.app-category.utilities
+ LSMinimumSystemVersion
+ 10.15
+ NSAppleEventsUsageDescription
+ This script needs to control other applications to run.
+ NSAppleMusicUsageDescription
+ This script needs access to your music to run.
+ NSCalendarsUsageDescription
+ This script needs access to your calendars to run.
+ NSCameraUsageDescription
+ This script needs access to your camera to run.
+ NSContactsUsageDescription
+ This script needs access to your contacts to run.
+ NSHomeKitUsageDescription
+ This script needs access to your HomeKit Home to run.
+ NSHumanReadableCopyright
+ Copyright 2020 SIL International.
+ NSMainNibFile
+ MainMenu
+ NSMicrophoneUsageDescription
+ This script needs access to your microphone to run.
+ NSPhotoLibraryUsageDescription
+ This script needs access to your photos to run.
+ NSPrincipalClass
+ NSApplication
+ NSRemindersUsageDescription
+ This script needs access to your reminders to run.
+ NSSiriUsageDescription
+ This script needs access to Siri to run.
+ NSSystemAdministrationUsageDescription
+ This script needs access to administer this system to run.
+ WindowState
+
+ bundleDividerCollapsed
+
+ bundlePositionOfDivider
+ 1162
+ dividerCollapsed
+
+ eventLogLevel
+ 2
+ name
+ ScriptWindowState
+ positionOfDivider
+ 594
+ savedFrame
+ 148 235 1461 732 0 0 1920 1057
+ selectedTab
+ result
+
+
+
diff --git a/mac/setup/Install Keyman.app/Contents/MacOS/CocoaApplet b/mac/setup/Install Keyman.app/Contents/MacOS/CocoaApplet
new file mode 100755
index 0000000000..3f580e2dae
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/MacOS/CocoaApplet differ
diff --git a/mac/setup/Install Keyman.app/Contents/PkgInfo b/mac/setup/Install Keyman.app/Contents/PkgInfo
new file mode 100644
index 0000000000..3253614c40
--- /dev/null
+++ b/mac/setup/Install Keyman.app/Contents/PkgInfo
@@ -0,0 +1 @@
+APPLaplt
\ No newline at end of file
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/Base.lproj/MainMenu.nib b/mac/setup/Install Keyman.app/Contents/Resources/Base.lproj/MainMenu.nib
new file mode 100644
index 0000000000..ea2798c7aa
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/Base.lproj/MainMenu.nib differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/CocoaAppletAppDelegate.scpt b/mac/setup/Install Keyman.app/Contents/Resources/CocoaAppletAppDelegate.scpt
new file mode 100644
index 0000000000..dd351d1b8b
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/CocoaAppletAppDelegate.scpt differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/Scripts/main.scpt b/mac/setup/Install Keyman.app/Contents/Resources/Scripts/main.scpt
new file mode 100644
index 0000000000..25289de53d
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/Scripts/main.scpt differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/applet.icns b/mac/setup/Install Keyman.app/Contents/Resources/applet.icns
new file mode 100644
index 0000000000..6dad794a2b
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/applet.icns differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ar.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/ar.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..5df2be6afc
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ar.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ar.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/ar.lproj/MainMenu.strings
new file mode 100644
index 0000000000..8a1ea86978
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ar.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ca.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/ca.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..8187b35495
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ca.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ca.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/ca.lproj/MainMenu.strings
new file mode 100644
index 0000000000..8acd9951eb
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ca.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/cs.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/cs.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..1d681b7e6d
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/cs.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/cs.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/cs.lproj/MainMenu.strings
new file mode 100644
index 0000000000..1f24133e56
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/cs.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/da.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/da.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..ae84b83430
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/da.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/da.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/da.lproj/MainMenu.strings
new file mode 100644
index 0000000000..668692a514
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/da.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/de.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/de.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..7ec3724f6b
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/de.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/de.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/de.lproj/MainMenu.strings
new file mode 100644
index 0000000000..734190b6c0
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/de.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/description.rtfd/TXT.rtf b/mac/setup/Install Keyman.app/Contents/Resources/description.rtfd/TXT.rtf
new file mode 100644
index 0000000000..7bfb78c2db
--- /dev/null
+++ b/mac/setup/Install Keyman.app/Contents/Resources/description.rtfd/TXT.rtf
@@ -0,0 +1,5 @@
+{\rtf1\ansi\ansicpg1252\cocoartf2511
+\cocoatextscaling0\cocoaplatform0{\fonttbl}
+{\colortbl;\red255\green255\blue255;}
+{\*\expandedcolortbl;;}
+}
\ No newline at end of file
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/el.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/el.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..c2100c87a4
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/el.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/el.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/el.lproj/MainMenu.strings
new file mode 100644
index 0000000000..f5d22b1442
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/el.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/en.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/en.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..b524fee4a7
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/en.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/en_AU.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/en_AU.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..b524fee4a7
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/en_AU.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/en_AU.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/en_AU.lproj/MainMenu.strings
new file mode 100644
index 0000000000..d681dfc135
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/en_AU.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/en_GB.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/en_GB.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..b524fee4a7
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/en_GB.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/en_GB.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/en_GB.lproj/MainMenu.strings
new file mode 100644
index 0000000000..dbb1749c63
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/en_GB.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/es.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/es.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..b12896589e
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/es.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/es.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/es.lproj/MainMenu.strings
new file mode 100644
index 0000000000..9d691ee16f
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/es.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/es_419.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/es_419.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..cdc9275e5b
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/es_419.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/es_419.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/es_419.lproj/MainMenu.strings
new file mode 100644
index 0000000000..89cc8cd7f9
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/es_419.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/fi.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/fi.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..fcc1f245e7
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/fi.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/fi.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/fi.lproj/MainMenu.strings
new file mode 100644
index 0000000000..5122fdb7c3
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/fi.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/fr.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/fr.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..497129d6fb
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/fr.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/fr.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/fr.lproj/MainMenu.strings
new file mode 100644
index 0000000000..48263113fd
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/fr.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/fr_CA.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/fr_CA.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..b65ad0156b
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/fr_CA.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/fr_CA.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/fr_CA.lproj/MainMenu.strings
new file mode 100644
index 0000000000..3ab4e9b159
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/fr_CA.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/he.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/he.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..0808288e4f
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/he.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/he.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/he.lproj/MainMenu.strings
new file mode 100644
index 0000000000..1a12a8d2fe
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/he.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/hi.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/hi.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..089af01d10
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/hi.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/hi.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/hi.lproj/MainMenu.strings
new file mode 100644
index 0000000000..ce7e03066c
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/hi.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/hr.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/hr.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..1722896b53
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/hr.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/hr.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/hr.lproj/MainMenu.strings
new file mode 100644
index 0000000000..334456ae9d
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/hr.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/hu.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/hu.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..3f4b39d826
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/hu.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/hu.lproj/MainMenu.nib b/mac/setup/Install Keyman.app/Contents/Resources/hu.lproj/MainMenu.nib
new file mode 100644
index 0000000000..8ef2513442
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/hu.lproj/MainMenu.nib differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/id.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/id.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..4e12b692d8
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/id.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/id.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/id.lproj/MainMenu.strings
new file mode 100644
index 0000000000..097c2ce7f5
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/id.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/it.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/it.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..bda764370b
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/it.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/it.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/it.lproj/MainMenu.strings
new file mode 100644
index 0000000000..917a7bd04b
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/it.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ja.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/ja.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..340f673db1
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ja.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ja.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/ja.lproj/MainMenu.strings
new file mode 100644
index 0000000000..dbb442f0d6
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ja.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ko.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/ko.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..b421d9477f
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ko.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ko.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/ko.lproj/MainMenu.strings
new file mode 100644
index 0000000000..aa0446c844
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ko.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ms.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/ms.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..72aba1e09a
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ms.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ms.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/ms.lproj/MainMenu.strings
new file mode 100644
index 0000000000..1ad0b98631
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ms.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/nl.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/nl.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..64f71af066
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/nl.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/nl.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/nl.lproj/MainMenu.strings
new file mode 100644
index 0000000000..feb8fca854
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/nl.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/no.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/no.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..f371d56542
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/no.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/no.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/no.lproj/MainMenu.strings
new file mode 100644
index 0000000000..e4ed0048bb
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/no.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/pl.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/pl.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..f749a26dee
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/pl.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/pl.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/pl.lproj/MainMenu.strings
new file mode 100644
index 0000000000..8184a3f008
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/pl.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/pt.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/pt.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..a04169f62e
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/pt.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/pt.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/pt.lproj/MainMenu.strings
new file mode 100644
index 0000000000..6e9a827cd1
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/pt.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/pt_PT.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/pt_PT.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..db1744a01c
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/pt_PT.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/pt_PT.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/pt_PT.lproj/MainMenu.strings
new file mode 100644
index 0000000000..7ae2f4e83a
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/pt_PT.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ro.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/ro.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..1fd259fa97
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ro.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ro.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/ro.lproj/MainMenu.strings
new file mode 100644
index 0000000000..8eb12e0828
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ro.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ru.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/ru.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..e68487274d
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ru.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/ru.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/ru.lproj/MainMenu.strings
new file mode 100644
index 0000000000..093bd32a64
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/ru.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/sk.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/sk.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..62cadb1de6
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/sk.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/sk.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/sk.lproj/MainMenu.strings
new file mode 100644
index 0000000000..8534cd895d
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/sk.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/sv.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/sv.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..7f11ac222c
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/sv.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/sv.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/sv.lproj/MainMenu.strings
new file mode 100644
index 0000000000..4dc38ef229
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/sv.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/th.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/th.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..4194ccb630
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/th.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/th.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/th.lproj/MainMenu.strings
new file mode 100644
index 0000000000..dec61672db
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/th.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/tr.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/tr.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..3c3d0a39c6
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/tr.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/tr.lproj/MainMenu.nib b/mac/setup/Install Keyman.app/Contents/Resources/tr.lproj/MainMenu.nib
new file mode 100644
index 0000000000..14844a9755
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/tr.lproj/MainMenu.nib differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/uk.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/uk.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..fc18eeef55
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/uk.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/uk.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/uk.lproj/MainMenu.strings
new file mode 100644
index 0000000000..35a3929112
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/uk.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/vi.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/vi.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..b080921e95
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/vi.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/vi.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/vi.lproj/MainMenu.strings
new file mode 100644
index 0000000000..6abe20e53c
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/vi.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/zh_CN.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/zh_CN.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..6adcf5b867
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/zh_CN.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/zh_CN.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/zh_CN.lproj/MainMenu.strings
new file mode 100644
index 0000000000..bb54c1c2d2
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/zh_CN.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/zh_HK.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/zh_HK.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..0d984b5f2c
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/zh_HK.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/zh_HK.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/zh_HK.lproj/MainMenu.strings
new file mode 100644
index 0000000000..bdbf32b85d
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/zh_HK.lproj/MainMenu.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/zh_TW.lproj/InfoPlist.strings b/mac/setup/Install Keyman.app/Contents/Resources/zh_TW.lproj/InfoPlist.strings
new file mode 100644
index 0000000000..32bd2fa6af
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/zh_TW.lproj/InfoPlist.strings differ
diff --git a/mac/setup/Install Keyman.app/Contents/Resources/zh_TW.lproj/MainMenu.strings b/mac/setup/Install Keyman.app/Contents/Resources/zh_TW.lproj/MainMenu.strings
new file mode 100644
index 0000000000..dc6ce8c9be
Binary files /dev/null and b/mac/setup/Install Keyman.app/Contents/Resources/zh_TW.lproj/MainMenu.strings differ
diff --git a/mac/setup/build.sh b/mac/setup/build.sh
new file mode 100755
index 0000000000..fc42a9f36c
--- /dev/null
+++ b/mac/setup/build.sh
@@ -0,0 +1,101 @@
+#!/bin/bash
+
+set -e
+set -u
+
+# Include our resource functions; they're pretty useful!
+. ../../resources/shellHelperFunctions.sh
+
+# Please note that this build script (understandably) assumes that it is running on Mac OS X.
+verify_on_mac
+
+#
+# Constants
+#
+
+SOURCEAPP="./Install Keyman.app"
+TARGETPATH=../Keyman4MacIM/output
+TARGETAPP="$TARGETPATH/Install Keyman.app"
+KEYMANAPP=../Keyman4MacIM/build/Release/Keyman.app
+
+#
+# Build textinputsource
+#
+
+pushd textinputsource
+./build.sh
+popd
+
+#
+# Build install candidate of "Install Keyman"
+#
+
+# TODO: get script folder so we can run this from anywhere safely
+# TODO: set version number in install image
+
+# Remove old install image
+mkdir -p "$TARGETPATH"
+rm -rf "$TARGETAPP" || true
+
+# Copy new install image to output foldercer
+cp -R "$SOURCEAPP" "$TARGETPATH/"
+
+# Copy Keyman.app into install image
+cp -R "$KEYMANAPP" "$TARGETAPP/Contents/MacOS/Keyman.app"
+
+# Copy textinputsource into install image
+cp textinputsource/textinputsource "$TARGETAPP/Contents/MacOS/textinputsource"
+
+# NOW TO notarize...
+xattr -rc "$TARGETAPP"
+codesign --force --options runtime --deep --sign "${CERTIFICATE_ID}" "$TARGETAPP"
+
+#
+# Notarize the app (copied from ../build.sh)
+# TODO: merge notarization into function
+#
+
+TARGET_ZIP_PATH="$TARGETPATH/Install Keyman.zip"
+TARGET_APP_PATH="$TARGETAPP"
+ALTOOL_LOG_PATH="$TARGETPATH/altool.log"
+
+echo_heading "Zipping Install Keyman.app for notarization to $TARGET_ZIP_PATH"
+
+/usr/bin/ditto -c -k --keepParent "$TARGET_APP_PATH" "$TARGET_ZIP_PATH"
+
+echo_heading "Uploading Install Keyman.zip to Apple for notarization"
+
+xcrun altool --notarize-app --primary-bundle-id "com.Keyman.install.zip" --asc-provider "$APPSTORECONNECT_PROVIDER" --username "$APPSTORECONNECT_USERNAME" --password @env:APPSTORECONNECT_PASSWORD --file "$TARGET_ZIP_PATH" --output-format xml > $ALTOOL_LOG_PATH || fail "altool failed"
+cat "$ALTOOL_LOG_PATH"
+
+ALTOOL_UUID=$(/usr/libexec/PlistBuddy -c "Print notarization-upload:RequestUUID" "$ALTOOL_LOG_PATH")
+ALTOOL_FINISHED=0
+
+while [ $ALTOOL_FINISHED -eq 0 ]
+do
+ # We'll sleep 30 seconds before checking status, to give the altool server time to process the archive
+ echo "Waiting 30 seconds for status"
+ sleep 30
+ xcrun altool --notarization-info "$ALTOOL_UUID" --username "$APPSTORECONNECT_USERNAME" --password @env:APPSTORECONNECT_PASSWORD --output-format xml > "$ALTOOL_LOG_PATH" || fail "altool failed"
+ ALTOOL_STATUS=$(/usr/libexec/PlistBuddy -c "Print notarization-info:Status" "$ALTOOL_LOG_PATH")
+ if [ "$ALTOOL_STATUS" == "success" ]; then
+ ALTOOL_FINISHED=1
+ elif [ "$ALTOOL_STATUS" != "in progress" ]; then
+ # Probably failing with 'invalid'
+ cat "$ALTOOL_LOG_PATH"
+ ALTOOL_LOG_URL=$(/usr/libexec/PlistBuddy -c "Print notarization-info:LogFileURL" "$ALTOOL_LOG_PATH")
+ curl "$ALTOOL_LOG_URL"
+ fail "Notarization failed with $ALTOOL_STATUS; check log at $ALTOOL_LOG_PATH"
+ fi
+done
+
+echo_heading "Notarization completed successfully. Review logs below for any warnings."
+cat "$ALTOOL_LOG_PATH"
+ALTOOL_LOG_URL=$(/usr/libexec/PlistBuddy -c "Print notarization-info:LogFileURL" "$ALTOOL_LOG_PATH")
+curl "$ALTOOL_LOG_URL"
+echo
+echo_heading "Attempting to staple notarization to Install Keyman.app"
+xcrun stapler staple "$TARGET_APP_PATH" || fail "stapler failed"
+
+# Done.
+# Now, we can add "Install Keyman.app" to the .dmg for distribution!
diff --git a/mac/setup/textinputsource/build.sh b/mac/setup/textinputsource/build.sh
new file mode 100755
index 0000000000..e9cc4ceb0d
--- /dev/null
+++ b/mac/setup/textinputsource/build.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -e
+set -u
+gcc -framework Carbon -o textinputsource main.c
\ No newline at end of file
diff --git a/mac/setup/textinputsource/main.c b/mac/setup/textinputsource/main.c
new file mode 100644
index 0000000000..cd059924c3
--- /dev/null
+++ b/mac/setup/textinputsource/main.c
@@ -0,0 +1,144 @@
+/*
+ file
+ main.c
+
+ function
+ to manipulate text input source, i.e.,
+ - print currently selected source,
+ - select specified source (enable it as needed)
+ - enable specified source,
+ - disable specified source,
+ - toggle enabled/disabled state of specified source.
+
+ compile
+ gcc -framework Carbon -o textinputsource main.c
+
+ usage e.g.
+ ./textinputsource [-s|e|d|t name]
+
+ given no arguments, it will print the current source name.
+ options:
+ -s : select source name (enable it as needed)
+ -e : enable source name
+ -d : disable source name
+ -t : toggle enabled/disabled on source name
+
+
+ Originally found at https://discussions.apple.com/thread/5610262
+*/
+
+#include
+#include // basename
+
+TISInputSourceRef getInputSourceByName(char *);
+
+int
+main (int argc, char * argv[])
+{
+ int ret = -1;
+ int c;
+ TISInputSourceRef tis;
+ CFStringRef name;
+ OSStatus err = 0;
+
+ while ((c = getopt(argc, argv, "s:e:d:t:h")) != -1)
+ {
+ switch (c)
+ {
+ case 's':
+ tis = getInputSourceByName(optarg);
+ if (tis)
+ {
+ CFBooleanRef enabled = TISGetInputSourceProperty(tis, kTISPropertyInputSourceIsEnabled);
+ if (enabled == kCFBooleanFalse)
+ TISEnableInputSource(tis);
+ err = TISSelectInputSource(tis);
+ CFRelease(tis);
+ }
+ ret = tis ? (int) err : 1;
+ break;
+ case 'e':
+ tis = getInputSourceByName(optarg);
+ if (tis)
+ {
+ err = TISEnableInputSource(tis);
+ CFRelease(tis);
+ }
+ ret = tis ? (int) err : 1;
+ break;
+ case 'd':
+ tis = getInputSourceByName(optarg);
+ if (tis)
+ {
+ err = TISDisableInputSource(tis);
+ CFRelease(tis);
+ }
+ ret = tis ? (int) err : 1;
+ break;
+ case 't':
+ tis = getInputSourceByName(optarg);
+ if (tis)
+ {
+ CFBooleanRef enabled = TISGetInputSourceProperty(tis, kTISPropertyInputSourceIsEnabled);
+ if (enabled == kCFBooleanTrue)
+ err = TISDisableInputSource(tis);
+ else
+ err = TISEnableInputSource(tis);
+ CFRelease(tis);
+ }
+ ret = tis ? (int) err : 1;
+ break;
+ case 'h':
+ case '?':
+ default:
+ fprintf(stderr, "Usage: %s %s\n\t\%s\n\t%s\n\t%s\n\t%s\n\t%s\n",
+ basename(argv[0]),
+ "[-s|e|d|t name]",
+ "-s : select source name (enable it as needed)",
+ "-e : enable source name",
+ "-d : disable source name",
+ "-t : toggle enabled/disabled of source name",
+ "no arguments : print current source name"
+ );
+ ret = 1;
+ break;
+ }
+ }
+ if (ret == -1) // no args: print current keyboard input source
+ {
+ tis = TISCopyCurrentKeyboardInputSource();
+ name = TISGetInputSourceProperty(tis, kTISPropertyLocalizedName);
+ int len = CFStringGetLength(name) * 4 + 1;
+ char cname[len];
+ bool b = CFStringGetCString(name, cname, len, kCFStringEncodingUTF8);
+ printf("%s\n", b ? cname : "");
+ ret = b ? 0 : 1;
+ }
+ if (err != noErr)
+ fprintf(stderr, "Text Input Source Services error: %d\n", (int) err);
+ return ret;
+}
+
+TISInputSourceRef
+getInputSourceByName(char *cname)
+{
+ // char *cname : input source name in UTF-8 terminated by null character
+ // return TISInputSourceRef or NULL : text input source reference (retained)
+
+ CFStringRef name = CFStringCreateWithCString(kCFAllocatorDefault, cname, kCFStringEncodingUTF8);
+ CFStringRef keys[] = { kTISPropertyLocalizedName };
+ CFStringRef values[] = { name };
+ CFDictionaryRef dict = CFDictionaryCreate(kCFAllocatorDefault, (const void **)keys, (const void **)values, 1, NULL, NULL);
+ CFArrayRef array = TISCreateInputSourceList(dict, true);
+ CFRelease(dict);
+ CFRelease(name);
+ if (!array)
+ {
+ fprintf(stderr, "No such text input source: %s\n", optarg);
+ return NULL;
+ }
+ TISInputSourceRef tis = (TISInputSourceRef) CFArrayGetValueAtIndex(array, 0);
+ CFRetain(tis);
+ CFRelease(array);
+ return tis;
+}
\ No newline at end of file