Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ The latest version is Version 1.3. To install or update Math Symbols Input:

1. Download the [installer for the latest version](https://github.com/knrafto/MathSymbolsInput/releases/latest/download/MathSymbolsInput.pkg).
2. Open the installer and continue through the installation steps.
3. Log out and log back in (or reboot).

The installer can enable the input method automatically. If you want to configure input sources, see the [macOS help page on input sources](
3. **macOS 15 (Sequoia) and later**: Due to security restrictions, you will need to manually enable the input method after installation:
- Go to **System Settings → Keyboard → Input Sources**
- Click the **+** button
- Find **Math Symbols Input** under English
- Add it to your input sources
4. Log out and log back in (or reboot).

On macOS 14 (Sonoma) and earlier, the installer can enable the input method automatically. For more information about configuring input sources, see the [macOS help page on input sources](
https://support.apple.com/guide/mac-help/type-language-mac-input-sources-mchlp1406/mac).

# Usage
Expand All @@ -38,6 +43,17 @@ New commands will take effect immediately.

# FAQ

## The input method isn't working after installation on macOS 15 or later

Starting with macOS 15 (Sequoia), Apple introduced security restrictions that prevent third-party input methods from being enabled automatically during installation. You need to manually enable Math Symbols Input:

1. Go to **System Settings → Keyboard → Input Sources**
2. Click the **+** button
3. Find **Math Symbols Input** under English
4. Add it to your input sources

After adding the input method, you can switch to it using the input source menu in the menu bar or with the keyboard shortcut (typically Control+Space or Control+Option+Space).

## Are there Windows or Linux versions?

Not yet, but hopefully soon.
Expand Down
44 changes: 42 additions & 2 deletions activate/main.m
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>

static const char *kInstallLocation = "/Library/Input Methods/Math Symbols Input.app";
static NSString *kProcessName = @"Math Symbols Input";
static NSString *kSourceID = @"com.mathsymbolsinput.inputmethod.MathSymbolsInput";

static void logIfError(OSStatus status, NSString *message) {
static BOOL logIfError(OSStatus status, NSString *message) {
if (status != noErr) {
NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
NSLog(@"%@: %@", message, [error localizedDescription]);
return YES;
}
return NO;
}

static BOOL isMacOS15OrLater(void) {
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
return version.majorVersion >= 15;
}

static void showManualActivationDialog(void) {
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"Math Symbols Input Installation Complete"];
[alert setInformativeText:@"Due to macOS security restrictions, you need to manually enable the input method:\n\n1. Go to System Settings → Keyboard → Input Sources\n2. Click the + button\n3. Find \"Math Symbols Input\" under English\n4. Add it to your input sources\n\nWould you like to open System Settings now?"];
[alert setAlertStyle:NSAlertStyleInformational];
[alert addButtonWithTitle:@"Open System Settings"];
[alert addButtonWithTitle:@"Later"];

NSModalResponse response = [alert runModal];

if (response == NSAlertFirstButtonReturn) {
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"x-apple.systempreferences:com.apple.Keyboard-Settings.extension"]];
}
}

Expand Down Expand Up @@ -63,9 +86,26 @@ int main(int argc, const char *argv[]) {
[NSThread sleepForTimeInterval:1.0];

NSLog(@"Enabling input source %@", kSourceID);
logIfError(TISEnableInputSource(inputMethod), @"Could not enable input source");
OSStatus enableStatus = TISEnableInputSource(inputMethod);
BOOL enableFailed = logIfError(enableStatus, @"Could not enable input source");
[NSThread sleepForTimeInterval:1.0];

// Check if the input method is actually enabled after attempting to enable it
BOOL isEnabled = CFBooleanGetValue(TISGetInputSourceProperty(inputMethod, kTISPropertyInputSourceIsEnabled));

if (!isEnabled || enableFailed) {
NSLog(@"Input source could not be automatically enabled. Manual activation required.");

// On macOS 15 (Sequoia) and later, automatic activation is blocked by security restrictions
if (isMacOS15OrLater()) {
NSLog(@"Detected macOS 15 or later. Showing manual activation instructions.");
showManualActivationDialog();
}

CFRelease(inputSources);
return 0;
}

NSLog(@"Selecting input source %@", kSourceID);
logIfError(TISSelectInputSource(inputMethod), @"Could not select input source");

Expand Down