-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
支持命令行切换中英文模式 #797
base: master
Are you sure you want to change the base?
支持命令行切换中英文模式 #797
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,21 @@ int main(int argc, char *argv[]) { | |
return 0; | ||
} | ||
|
||
if (argc > 1 && !strcmp("--ascii_mode", argv[1])) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a one-way setting
|
||
[[NSDistributedNotificationCenter defaultCenter] | ||
postNotificationName:@"SquirrelChangeToAsciiModeNotification" | ||
object: nil]; | ||
return 0; | ||
} | ||
|
||
if (argc > 1 && !strcmp("--ascii_mode_prev", argv[1])) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can the caller keep track of which state should be put back in? |
||
[[NSDistributedNotificationCenter defaultCenter] | ||
postNotificationName:@"SquirrelChangeToAsciiModePrevNotification" | ||
object: nil]; | ||
return 0; | ||
} | ||
|
||
|
||
@autoreleasepool { | ||
// find the bundle identifier and then initialize the input method server | ||
NSBundle *main = [NSBundle mainBundle]; | ||
|
@@ -70,19 +85,19 @@ int main(int argc, char *argv[]) { | |
|
||
// load the bundle explicitly because in this case the input method is a | ||
// background only application | ||
[main loadNibNamed:@"MainMenu" owner:[NSApplication sharedApplication] topLevelObjects:NULL]; | ||
[main loadNibNamed:@"MainMenu" | ||
owner:[NSApplication sharedApplication] | ||
topLevelObjects:NULL]; | ||
|
||
// opencc will be configured with relative dictionary paths | ||
[[NSFileManager defaultManager] | ||
changeCurrentDirectoryPath:main.sharedSupportPath]; | ||
|
||
if (NSApp.squirrelAppDelegate.problematicLaunchDetected) { | ||
NSLog(@"Problematic launch detected!"); | ||
NSArray *args = @[ | ||
@"Problematic launch detected! \ | ||
NSArray *args = @[ @"Problematic launch detected! \ | ||
Squirrel may be suffering a crash due to imporper configuration. \ | ||
Revert previous modifications to see if the problem recurs." | ||
]; | ||
Revert previous modifications to see if the problem recurs." ]; | ||
[NSTask launchedTaskWithLaunchPath:@"/usr/bin/say" arguments:args]; | ||
} else { | ||
[NSApp.squirrelAppDelegate setupRime]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_prev
does not sync with the current status from the rime session.Between last call to
changeToAscii
and this one, theascii_mode
value could have changed by the user.