nikitabobko / AeroSpace

AeroSpace is an i3-like tiling window manager for macOS
https://nikitabobko.github.io/AeroSpace/guide
MIT License
7.56k stars 124 forks source link

Aerospace not registering key presses on letter keys #732

Open samholmes opened 1 day ago

samholmes commented 1 day ago

Describe the bug Aerospace works great for a majority of the time. It suddenly stops tracking keyboard letter and number keys but chorded keys with modifiers will still work. It seems to have been caused by connecting to a monitor. I don't have a repo steps, but when it happens, it happens and it's not clear how to fix it.

Known solution I stopped using Aerospace for now because it's not reliable enough at the moment. I wish I could help in anyway to improve it's reliability.

Steps to Reproduce Use my config for a while and use an external monitor it'll eventually happen (maybe):

# Place a copy of this config to ~/.aerospace.toml
# After that, you can edit ~/.aerospace.toml to your liking

# It's not necessary to copy all keys to your config.
# If the key is missing in your config, "default-config.toml" will serve as a fallback

# You can use it to add commands that run after login to macOS user session.
# 'start-at-login' needs to be 'true' for 'after-login-command' to work
# Available commands: https://nikitabobko.github.io/AeroSpace/commands
after-login-command = []

# You can use it to add commands that run after AeroSpace startup.
# 'after-startup-command' is run after 'after-login-command'
# Available commands : https://nikitabobko.github.io/AeroSpace/commands
after-startup-command = []

# Start AeroSpace at login
start-at-login = false

# Normalizations. See: https://nikitabobko.github.io/AeroSpace/guide#normalization
enable-normalization-flatten-containers = true
enable-normalization-opposite-orientation-for-nested-containers = true

# Possible values: tiles|accordion
default-root-container-layout = 'tiles'

# Possible values: horizontal|vertical|auto
# 'auto' means: wide monitor (anything wider than high) gets horizontal orientation,
#               tall monitor (anything higher than wide) gets vertical orientation
default-root-container-orientation = 'auto'

# Possible values: (qwerty|dvorak)
# See https://nikitabobko.github.io/AeroSpace/guide#key-mapping
key-mapping.preset = 'qwerty'

# See: https://nikitabobko.github.io/AeroSpace/guide#layouts
# The 'accordion-padding' specifies the size of accordion padding
# You can set 0 to disable the padding feature
accordion-padding = 8

# Mouse follows focus when focused monitor changes
# Drop it from your config, if you don't like this behavior
# See https://nikitabobko.github.io/AeroSpace/guide#on-focus-changed-callbacks
# See https://nikitabobko.github.io/AeroSpace/commands#move-mouse
# on-focused-monitor-changed = ['move-mouse window-lazy-center']
# on-focus-changed = ['move-mouse window-force-center']

# Gaps between windows (inner-*) and between monitor edges (outer-*).
# Possible values:
# - Constant:     gaps.outer.top = 8
# - Per monitor:  gaps.outer.top = [{ monitor.main = 16 }, { monitor."some-pattern" = 32 }, 24]
#                 In this example, 24 is a default value when there is no match.
#                 Monitor pattern is the same as for 'workspace-to-monitor-force-assignment'.
#                 See: https://nikitabobko.github.io/AeroSpace/guide#assign-workspaces-to-monitors
[gaps]
inner.horizontal = 0
inner.vertical =   0
outer.left =       0
outer.bottom =     0
outer.top =        0
outer.right =      0

#
# Bindings
#

# All possible keys:
# - Letters.        a, b, c, ..., z
# - Numbers.        0, 1, 2, ..., 9
# - Keypad numbers. keypad0, keypad1, keypad2, ..., keypad9
# - F-keys.         f1, f2, ..., f20
# - Special keys.   minus, equal, period, comma, slash, backslash, quote, semicolon, backtick,
#                   leftSquareBracket, rightSquareBracket, space, enter, esc, backspace, tab
# - Keypad special. keypadClear, keypadDecimalMark, keypadDivide, keypadEnter, keypadEqual,
#                   keypadMinus, keypadMultiply, keypadPlus
# - Arrows.         left, down, up, right

# All possible modifiers: cmd, alt, ctrl, shift

# All possible commands: https://nikitabobko.github.io/AeroSpace/commands

# 'main' binding mode declaration
# See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes
# 'main' binding mode must be always presented
[mode.main.binding]
ctrl-alt-cmd-shift-space = ['mode alt']

# ctrl-alt-cmd-shift-h = ['focus --boundaries-action stop left', 'move-mouse window-force-center']
# ctrl-alt-cmd-shift-j = ['focus --boundaries-action stop down', 'move-mouse window-force-center']
# ctrl-alt-cmd-shift-k = ['focus --boundaries-action stop up', 'move-mouse window-force-center']
# ctrl-alt-cmd-shift-l = ['focus --boundaries-action stop right', 'move-mouse window-force-center']
# ctrl-alt-cmd-shift-u = 'workspace prev'
# ctrl-alt-cmd-shift-i = 'workspace next'
# ctrl-alt-cmd-shift-p = ['focus-monitor prev', 'move-mouse window-force-center']
# ctrl-alt-cmd-shift-n = ['focus-monitor next', 'move-mouse window-force-center']

[mode.alt.binding]
# ctrl-alt-cmd-shift-space = ['mode main']
space = ['mode main']
esc = ['mode main']
backtick = ['reload-config', 'mode main']

# You can uncomment this line to open up terminal with alt + enter shortcut
# See: https://nikitabobko.github.io/AeroSpace/commands#exec-and-forget
# alt-enter = 'exec-and-forget open -n /System/Applications/Utilities/Terminal.app'

# See: https://nikitabobko.github.io/AeroSpace/commands#layout
slash = 'layout horizontal vertical'
# Stack or unstack windows
s = 'layout tiles accordion'

#
# Navigation
#

# See: https://nikitabobko.github.io/AeroSpace/commands#focus
h = ['focus --boundaries-action stop left', 'move-mouse window-force-center']
j = ['focus --boundaries-action stop down', 'move-mouse window-force-center']
k = ['focus --boundaries-action stop up', 'move-mouse window-force-center']
l = ['focus --boundaries-action stop right', 'move-mouse window-force-center']
u = 'workspace prev'
i = 'workspace next'
p = ['focus-monitor prev', 'move-mouse monitor-force-center']
n = ['focus-monitor next', 'move-mouse monitor-force-center']

ctrl-alt-cmd-shift-h = ['workspace prev']
ctrl-alt-cmd-shift-l = ['workspace next']
ctrl-alt-cmd-shift-k = ['focus-monitor prev', 'move-mouse window-force-center']
ctrl-alt-cmd-shift-j = ['focus-monitor next', 'move-mouse window-force-center']

c = ['move-mouse window-force-center']

# See: https://nikitabobko.github.io/AeroSpace/commands#workspace
1 = 'workspace 1'
2 = 'workspace 2'
3 = 'workspace 3'
4 = 'workspace 4'
5 = 'workspace 5'
6 = 'workspace 6'
7 = 'workspace 7'
8 = 'workspace 8'
9 = 'workspace 9'

# See: https://nikitabobko.github.io/AeroSpace/commands#workspace-back-and-forth
tab = 'workspace-back-and-forth'

#
# Moving
#

# See: https://nikitabobko.github.io/AeroSpace/commands#move
shift-h = 'move left'
shift-j = 'move down'
shift-k = 'move up'
shift-l = 'move right'
shift-u = 'move-node-to-workspace prev'
shift-i = 'move-node-to-workspace next'
shift-p = 'move-workspace-to-monitor prev'
shift-n = 'move-workspace-to-monitor next'

# See: https://nikitabobko.github.io/AeroSpace/commands#move-node-to-workspace
shift-1 = 'move-node-to-workspace 1'
shift-2 = 'move-node-to-workspace 2'
shift-3 = 'move-node-to-workspace 3'
shift-4 = 'move-node-to-workspace 4'
shift-5 = 'move-node-to-workspace 5'
shift-6 = 'move-node-to-workspace 6'
shift-7 = 'move-node-to-workspace 7'
shift-8 = 'move-node-to-workspace 8'
shift-9 = 'move-node-to-workspace 9'

# See: https://nikitabobko.github.io/AeroSpace/commands#move-workspace-to-monitor
shift-tab = 'move-workspace-to-monitor --wrap-around next'

#
# Resizing
#

# See: https://nikitabobko.github.io/AeroSpace/commands#resize
minus = 'resize smart -64'
equal = 'resize smart +64'
shift-minus = 'resize smart -128'
shift-equal = 'resize smart +128'

#
# Other
#

shift-r = ['flatten-workspace-tree', 'mode alt'] # reset layout
#s = ['layout sticky tiling', 'mode alt'] # sticky is not yet supported https://github.com/nikitabobko/AeroSpace/issues/2
# Toggle fullscreen window
f = ['fullscreen']
# Float window (above)
a = ['layout floating']
# Tile window
t = ['layout tiling']

#
# Modes
#

# See: https://nikitabobko.github.io/AeroSpace/commands#mode
m = 'mode merge'
r =  'mode resize'
w = 'mode workspace'
y = 'mode yank'

[mode.merge.binding]
space = 'mode main'
esc = 'mode alt'
h = ['join-with left', 'mode alt']
j = ['join-with down', 'mode alt']
k = ['join-with up', 'mode alt']
l = ['join-with right', 'mode alt']

[mode.resize.binding]
space = 'mode main'
esc = 'mode alt'
r = 'mode alt'
h = ['resize width -64']
j = ['resize height -64']
k = ['resize height +64']
l = ['resize width +64']
shift-h = ['resize width -8']
shift-j = ['resize height -8']
shift-k = ['resize height +8']
shift-l = ['resize width +8']

[mode.workspace.binding]
space = 'mode main'
esc = 'mode alt'
w = 'mode alt'
h = ['workspace prev', 'move-mouse window-force-center']
l = ['workspace next', 'move-mouse window-force-center']
j = ['focus-monitor next', 'move-mouse window-force-center']
k = ['focus-monitor prev', 'move-mouse window-force-center']
y = 'mode yank-workspace'
shift-h = ['move-node-to-workspace prev']
shift-l = ['move-node-to-workspace next']
shift-k = ['move-node-to-monitor prev']
shift-j = ['move-node-to-monitor next']

[mode.yank.binding]
space = 'mode main'
esc = 'mode alt'
h = ['move-node-to-workspace prev', 'mode alt', 'move-mouse window-force-center']
l = ['move-node-to-workspace next', 'mode alt', 'move-mouse window-force-center']
p = ['move-node-to-monitor prev', 'focus-monitor prev', 'mode alt', 'move-mouse monitor-force-center']
n = ['move-node-to-monitor next', 'focus-monitor next', 'mode alt', 'move-mouse monitor-force-center']

[mode.yank-workspace.binding]
space = 'mode main'
esc = 'mode workspace'
h = ['move-node-to-workspace prev', 'mode workspace', 'move-mouse window-force-center']
l = ['move-node-to-workspace next', 'mode workspace', 'move-mouse window-force-center']
j = ['move-node-to-monitor next', 'mode workspace', 'move-mouse window-force-center']
k = ['move-node-to-monitor prev', 'mode workspace', 'move-mouse window-force-center']
p = ['move-workspace-to-monitor prev', 'focus-monitor prev', 'mode workspace', 'move-mouse monitor-force-center']
n = ['move-workspace-to-monitor next', 'focus-monitor next', 'mode workspace', 'move-mouse monitor-force-center']

#
# Application-specific configurations
#

# [[on-window-detected]]
# run = 'layout floating'

[[on-window-detected]]
if.app-name-regex-substring = 'Code - Insiders|Cursor|Simulator|Warp|Xcode'
run = ['layout tiling', 'move-node-to-workspace 2']

[[on-window-detected]]
if.app-name-regex-substring = 'Sublime Merge'
run = ['layout tiling', 'move-node-to-workspace 3']

[[on-window-detected]]
if.app-name-regex-substring = 'Slack|Mailspring|Calendar|zoom.us'
run = ['layout tiling', 'move-node-to-workspace 4']

[[on-window-detected]]
if.app-name-regex-substring = 'Signal|Discord|Messages'
ru
skeet70 commented 1 day ago

I'm not sure of the trigger but I think I'm running into the same (or a similar) bug. My alt based Aerospace keybinds with letters weren't working on my newly migrated to M4, so I just spent a bunch of time trying to force the Mac to let through alt/option keys and not use them for special characters. I switched to ctrl as a super key to test though, and it's the same there. All my chorded number hotkeys still work, but anything with a letter isn't working.

my aerospace.toml ``` # Reference: https://github.com/i3/i3/blob/next/etc/config # i3 doesn't have "normalizations" feature that why we disable them here. # But the feature is very helpful. # Normalizations eliminate all sorts of weird tree configurations that don't make sense. # Give normalizations a chance and enable them back. enable-normalization-flatten-containers = true enable-normalization-opposite-orientation-for-nested-containers = true # running this in terminal allows dragging windows by holding ctrl + cmd # defaults write -g NSWindowShouldDragOnGesture -bool true # running this in terminal disables window opening animations # defaults write -g NSAutomaticWindowAnimationsEnabled -bool false # run sketchybar when aerospace starts after-startup-command = ['exec-and-forget sketchybar'] # notify sketchybar about workspace changes exec-on-workspace-change = ['/bin/bash', '-c', 'sketchybar --trigger aerospace_workspace_change FOCUSED_WORKSPACE=$AEROSPACE_FOCUSED_WORKSPACE' ] # Mouse follows focus when focused monitor changes on-focused-monitor-changed = ['move-mouse monitor-lazy-center'] [mode.main.binding] # See: https://nikitabobko.github.io/AeroSpace/goodness#open-a-new-window-with-applescript alt-enter = 'exec-and-forget open -na alacritty' alt-left = 'focus left' alt-down = 'focus down' alt-up = 'focus up' alt-right = 'focus right' alt-shift-left = 'move left' alt-shift-down = 'move down' alt-shift-up = 'move up' alt-shift-right = 'move right' # Consider using 'join-with' command as a 'split' replacement if you want to enable normalizations alt-h = 'join-with down' alt-v = 'join-with right' alt-f = 'fullscreen' alt-s = 'layout v_accordion' # 'layout stacking' in i3 alt-w = 'layout h_accordion' # 'layout tabbed' in i3 alt-e = 'layout tiles horizontal vertical' # 'layout toggle split' in i3 alt-q = 'close --quit-if-last-window' alt-shift-space = 'layout floating tiling' # 'floating toggle' in i3 # Not supported, because this command is redundant in AeroSpace mental model. # See: https://nikitabobko.github.io/AeroSpace/guide#floating-windows #alt-space = 'focus toggle_tiling_floating' # `focus parent`/`focus child` are not yet supported, and it's not clear whether they # should be supported at all https://github.com/nikitabobko/AeroSpace/issues/5 # alt-a = 'focus parent' alt-1 = 'workspace 1' alt-2 = 'workspace 2' alt-3 = 'workspace 3' alt-4 = 'workspace 4' alt-5 = 'workspace 5' alt-6 = 'workspace 6' alt-7 = 'workspace 7' alt-8 = 'workspace 8' alt-9 = 'workspace 9' alt-0 = 'workspace 10' alt-shift-1 = 'move-node-to-workspace 1' alt-shift-2 = 'move-node-to-workspace 2' alt-shift-3 = 'move-node-to-workspace 3' alt-shift-4 = 'move-node-to-workspace 4' alt-shift-5 = 'move-node-to-workspace 5' alt-shift-6 = 'move-node-to-workspace 6' alt-shift-7 = 'move-node-to-workspace 7' alt-shift-8 = 'move-node-to-workspace 8' alt-shift-9 = 'move-node-to-workspace 9' alt-shift-0 = 'move-node-to-workspace 10' alt-shift-x = 'move-workspace-to-monitor --wrap-around next' alt-shift-c = 'reload-config' alt-r = 'mode resize' [mode.resize.binding] h = 'resize width -50' j = 'resize height +50' k = 'resize height -50' l = 'resize width +50' enter = 'mode main' esc = 'mode main' # disable if you need to sight read key combos while in qwerty layout [key-mapping] preset = 'dvorak' ```

I'm on AeroSpace v0.15.2-Beta b6cf8277 and Sequoia 15.1 (24B2082).