macOS: Use the system cursor blink interval by default

Can be changed with:

defaults write -g NSTextInsertionPointBlinkPeriodOff -float 500
defaults write -g NSTextInsertionPointBlinkPeriodOn -float 500
This commit is contained in:
Kovid Goyal
2019-02-25 09:37:48 +05:30
parent 2387c71b3c
commit 72ccf87d19
4 changed files with 34 additions and 5 deletions

View File

@@ -427,6 +427,21 @@ cocoa_get_lang(PyObject UNUSED *self) {
return Py_BuildValue("s", [locale UTF8String]);
}
double
cocoa_cursor_blink_interval(void) {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
double on_period_ms = [defaults doubleForKey:@"NSTextInsertionPointBlinkPeriodOn"];
double off_period_ms = [defaults doubleForKey:@"NSTextInsertionPointBlinkPeriodOff"];
double period_ms = [defaults doubleForKey:@"NSTextInsertionPointBlinkPeriod"];
double max_value = 60 * 1000.0, ans = -1.0;
if (on_period_ms || off_period_ms) {
ans = on_period_ms + off_period_ms;
} else if (period_ms) {
ans = period_ms;
}
return ans > max_value ? 0.0 : ans;
}
void
cocoa_set_hide_from_tasks(void) {
[NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];