Skip to content

Commit ece2273

Browse files
authored
Stop macOS stealing key repeat with the press-and-hold accent overlay (#308)
1 parent bb1c3b2 commit ece2273

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

Macterm/App/MactermApp.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,20 @@ struct MactermApp: App {
2929
// It must run THIS early: the tooltip machinery can initialize with
3030
// the first window, which precedes applicationDidFinishLaunching on
3131
// some launches (see the didBecomeMain note on AppDelegate).
32-
UserDefaults.standard.register(defaults: ["NSInitialToolTipDelay": 350])
32+
// Hold a key down in a terminal and macOS's press-and-hold accent
33+
// overlay ("é è ê…") steals the repeat, which is wrong in every TUI
34+
// that binds a held key to motion — hjkl in helix/vim being the case
35+
// that gets reported. Terminals want key repeat, not diacritics.
36+
// Ghostty registers exactly this key, which is why the same ghostty
37+
// config behaves differently there: the knob is an AppKit default in
38+
// OUR process, not anything the config pipeline can carry.
39+
// Registration domain again (see above): a user who genuinely wants
40+
// the overlay keeps it via `defaults write -g ApplePressAndHoldEnabled
41+
// true`, since NSGlobalDomain is searched ahead of registration.
42+
UserDefaults.standard.register(defaults: [
43+
"NSInitialToolTipDelay": 350,
44+
"ApplePressAndHoldEnabled": false,
45+
])
3346
}
3447

3548
var body: some Scene {

0 commit comments

Comments
 (0)