Skip to content
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

Aerospace not registering key presses on letter keys #732

Open
samholmes opened this issue Nov 20, 2024 · 23 comments
Open

Aerospace not registering key presses on letter keys #732

samholmes opened this issue Nov 20, 2024 · 23 comments
Labels
bug Something isn't working as expected

Comments

@samholmes
Copy link

samholmes commented Nov 20, 2024

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
@samholmes samholmes added the bug Something isn't working as expected label Nov 20, 2024
@skeet70
Copy link

skeet70 commented Nov 21, 2024

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).

@nils-werner
Copy link

I just stumbled across this, and have found another peculiarity:

If I add

alt-z = 'fullscreen'

at the very end of my aerospace.toml, AeroSpace does not register the keypress.

But if I move the binding up, just below all the

alt-1 = 'workspace 1'
...
# alt-z = 'workspace Z'

binds, the keypress registers.

@esodesod
Copy link

esodesod commented Dec 6, 2024

EDIT (now resolved): Tracked it down using sudo fs_usage -f filesys in terminal, and hammered down on some of my broken shortcuts, and found I (sadly forgot that) enabled skhd/yabai (while having issues with aerospace 16.x), which took over (some) of my keyboard shortcuts (now they're all working again) -- my bad; hopefully the command can help someone else track down keyboard shortcuts and which application is picking it up!

Something related for me as well, e.g. alt-f = 'fullscreen' suddenly not working anymore (and a lot of other combinations stopped working -- mainly letter-based combinations, e.g. alt-h, alt-j, alt-k, alt-l is not working at all), but alt-z = 'fullscreen' does indeed work (added on about the same line as alf-f-binding (see config below).

Issue detected in 0.16.0, 0.16.1 and now 0.16.2. Also updated macOS to 15.1.1 (could be related, but sadly I've already upgraded all my macOS instances, so I can't verify if this was the case).

PS: If I change to using e.g. ctrl-f = 'fullscreen', it works. Something special with alt and some letter combinations?

aerospace CLI client version: 0.16.2-Beta 21336ad382539b35fdc94b4fbd55408e10b101f8
AeroSpace.app server version: 0.16.2-Beta 21336ad382539b35fdc94b4fbd55408e10b101f8

└$ sw_vers 
ProductName:            macOS
ProductVersion:         15.1.1
BuildVersion:           24B91
# Place a copy of this config to ~/.aerospace.toml
# After that, you can edit ~/.aerospace.toml to your liking

# 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

# 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 = 30

# 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'

# 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
# Fallback value (if you omit the key): on-focused-monitor-changed = []
on-focused-monitor-changed = ['move-mouse monitor-lazy-center']

# You can effectively turn off macOS "Hide application" (cmd-h) feature by toggling this flag
# Useful if you don't use this macOS feature, but accidentally hit cmd-h or cmd-alt-h key
# Also see: https://nikitabobko.github.io/AeroSpace/goodness#disable-hide-app
automatically-unhide-macos-hidden-apps = false

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

# 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

# 'main' binding mode declaration
# See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes
# 'main' binding mode must be always presented
# Fallback value (if you omit the key): mode.main.binding = {}
[mode.main.binding]

# 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

# See: https://nikitabobko.github.io/AeroSpace/commands#exec-and-forget
# You can uncomment the following lines to open up terminal with alt + enter shortcut (like in i3)
# alt-enter = '''exec-and-forget osascript -e '
# tell application "Terminal"
#     do script
#     activate
# end tell'
# '''

# See: https://nikitabobko.github.io/AeroSpace/commands#layout
alt-slash = 'layout tiles horizontal vertical'
ctrl-comma = 'layout tiles horizontal vertical'
alt-comma = 'layout accordion horizontal vertical'

# See: https://nikitabobko.github.io/AeroSpace/commands#focus
alt-h = 'focus left'
alt-j = 'focus down'
alt-k = 'focus up'
alt-l = 'focus right'

# See: https://nikitabobko.github.io/AeroSpace/commands#move
alt-shift-h = 'move left'
alt-shift-j = 'move down'
alt-shift-k = 'move up'
alt-shift-l = 'move right'

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

# See: https://nikitabobko.github.io/AeroSpace/commands#workspace
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-a = 'workspace A' # In your config, you can drop workspace bindings that you don't need
alt-b = 'workspace B'
alt-c = 'workspace C'
alt-d = 'workspace D'
alt-e = 'workspace E'
# alt-f = 'workspace F'
alt-g = 'workspace G'
alt-i = 'workspace I'
alt-m = 'workspace M'
alt-n = 'workspace N'
alt-o = 'workspace O'
alt-p = 'workspace P'
alt-q = 'workspace Q'
alt-r = 'workspace R'
alt-s = 'workspace S'
alt-t = 'workspace T'
alt-u = 'workspace U'
alt-v = 'workspace V'
alt-w = 'workspace W'
alt-x = 'workspace X'
alt-y = 'workspace Y'
# alt-z = 'workspace Z'

# See: https://nikitabobko.github.io/AeroSpace/commands#move-node-to-workspace
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-a = 'move-node-to-workspace A'
alt-shift-b = 'move-node-to-workspace B'
alt-shift-c = 'move-node-to-workspace C'
alt-shift-d = 'move-node-to-workspace D'
alt-shift-e = 'move-node-to-workspace E'
# alt-shift-f = 'move-node-to-workspace F'
alt-shift-g = 'move-node-to-workspace G'
alt-shift-i = 'move-node-to-workspace I'
alt-shift-m = 'move-node-to-workspace M'
alt-shift-n = 'move-node-to-workspace N'
alt-shift-o = 'move-node-to-workspace O'
alt-shift-p = 'move-node-to-workspace P'
alt-shift-q = 'move-node-to-workspace Q'
alt-shift-r = 'move-node-to-workspace R'
alt-shift-s = 'move-node-to-workspace S'
alt-shift-t = 'move-node-to-workspace T'
alt-shift-u = 'move-node-to-workspace U'
alt-shift-v = 'move-node-to-workspace V'
alt-shift-w = 'move-node-to-workspace W'
alt-shift-x = 'move-node-to-workspace X'
alt-shift-y = 'move-node-to-workspace Y'
# alt-shift-z = 'move-node-to-workspace Z'


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




# esod
# ---

ctrl-alt-cmd-space = 'layout floating tiling'
ctrl-shift-space = 'layout horizontal vertical'

# See: https://nikitabobko.github.io/AeroSpace/commands#resize
ctrl-shift-l = 'move-node-to-monitor right --focus-follows-window'
ctrl-shift-h = 'move-node-to-monitor left --focus-follows-window'

# See: https://nikitabobko.github.io/AeroSpace/commands#balance-sizes
ctrl-alt-space = 'balance-sizes'
# See: https://nikitabobko.github.io/AeroSpace/commands#resize
ctrl-alt-k = 'resize smart +50'
ctrl-alt-j = 'resize smart -50'
# same, but more size
ctrl-alt-h = 'resize smart -350'
ctrl-alt-l = 'resize smart +350'
# fullscreen
alt-f = 'fullscreen'
alt-z = 'fullscreen'


alt-shift-esc = 'mode service'


# See: https://nikitabobko.github.io/AeroSpace/commands#mode
alt-shift-semicolon = 'mode service'

# 'service' binding mode declaration.
# See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes
[mode.service.binding]
esc = ['reload-config', 'mode main']
r = ['flatten-workspace-tree', 'mode main'] # reset layout
f = ['layout floating tiling', 'mode main'] # Toggle between floating and tiling layout
backspace = ['close-all-windows-but-current', 'mode main']

# sticky is not yet supported https://github.com/nikitabobko/AeroSpace/issues/2
#s = ['layout sticky tiling', 'mode main']

alt-shift-h = ['join-with left', 'mode main']
alt-shift-j = ['join-with down', 'mode main']
alt-shift-k = ['join-with up', 'mode main']
alt-shift-l = ['join-with right', 'mode main']

[[on-window-detected]]
if.app-id = 'md.obsidian'
run = "move-node-to-workspace 1"

[[on-window-detected]]
if.app-id = 'com.google.Chrome'
run = "move-node-to-workspace 2"

[[on-window-detected]]
if.app-id = 'com.github.wez.wezterm'
run = "move-node-to-workspace 3"

[[on-window-detected]]
if.app-id = 'com.citrix.receiver.icaviewer.mac'
run = "move-node-to-workspace 4"
[[on-window-detected]]
if.app-id = 'com.citrix.receiver.nomas'
run = "move-node-to-workspace 4"

[[on-window-detected]]
if.app-id = 'company.thebrowser.Browser'
run = "move-node-to-workspace 5"

[[on-window-detected]]
if.app-id = 'com.todoist.mac.Todoist'
run = "move-node-to-workspace N"

[[on-window-detected]]
if.app-id = 'com.flexibits.fantastical2.mac'
run = "move-node-to-workspace N"

[[on-window-detected]]
if.app-id = 'com.microsoft.teams2'
run = "move-node-to-workspace P"

[[on-window-detected]]
if.app-id = 'com.hnc.Discord'
run = "move-node-to-workspace P"

[[on-window-detected]]
if.app-id = 'com.spotify.client'
run = "move-node-to-workspace P"

@jim-at-jibba
Copy link

jim-at-jibba commented Dec 9, 2024

I am experiencing this too. Fresh install on Saturday and non of the alt-* commands are working

My mistake! Hammerspoon was interfering.

@michieliJoe
Copy link

I am experiencing this intermittently, but once it happens, it requires a reboot to be fixed. Could this be something within macOS? I have attempted to look through fs_usage logs, as well as utilize tools such as Shortcut Detector to determine if anything was getting caught in between, but with no luck. At some point, the alt combinations just fail to be caught by aerospace, even after a config reload, and complete stop and start of the application. At that point, alt keys work regularly, in any application they are used in, providing the correct shortcuts for that particular application. I have no other applications that claim the use of that key at a global level.

@AssisrMatheus
Copy link

AssisrMatheus commented Dec 13, 2024

What I realized is that the modes (like service mode or any custom mode we add) are not being cleared. The app stays on service mode or app mode or any mode after we run a command, even if we run it by adding mode main as the last command.

You can see that by looking at the menubar and noticing the [s] added to the numbers. So the hotkeys become the ones for that command, hence why the main mode bindings don't work.

And by restarting, you are effectively forcing it back to main mode

@samholmes
Copy link
Author

Restarting doesn't fix the issue I reported. Something is persistent with the issue where it wont register letter keys anymore (though keys pressed with a modifier key are captured) if I remember correctly.

@michieliJoe
Copy link

You can see that by looking at the menubar and noticing the [s] added to the numbers. So the hotkeys become the ones for that command, hence why the main mode bindings don't work.

This is unfortunately not what I am experiencing. If that were the case, a restart of the application itself should fix it, but it doesn't. I need to reboot my system entirely for it to work properly again. The mode seems to be in normal mode when this happens. The alt combinations just don't work (except for alt tab, which does work switching to the previous workspace).

@AtzeDeVries
Copy link

I had

alt-space = 'fullscreen'
alt-f = 'fullscreen'

in my aerospace config, the alt-space never used to work, but now it works, but alt-f is not working anymore, also not if i comment the alt-space. Alt+ number also does not work anymore.

@ashleyharvey
Copy link

I think this is related to macOS Sequoia. Aerospace was working perfectly for me, until I updated from Sonoma. Now I'm having this issue as well.

@ashleyharvey
Copy link

Update: I rebooted, the issue went away. Some time later, I (co-incidentally) ran brew leaves and found skhd still installed. I think skhd was intercepting my key-presses, and happened to not load before Aerospace this time around. Maybe this is true for others as well (I used Yabai before Aerospace and it needed skhd to handle keyboard shortcuts).

@AtzeDeVries
Copy link

I had skhd running as well, but killing the process did not fix it. I know uninstalled skhd. Will report back in some time on if this fixes it for me.
Can also confirm that rebooting the computer fixes the shortcut issues for some time.

@skeet70
Copy link

skeet70 commented Dec 16, 2024

Restarting does not fix it for me, and I never had skhd installed (or anything else capturing across the board afaik). I am on Sequoia. What I'm experiencing seems to match up directly to what @samholmes is.

@oliversturm
Copy link

oliversturm commented Dec 17, 2024

FWIW, I have the same problem. I was working along configuring Aerospace things earlier this morning, and just when I sat down to start doing some real work I found that shortcuts from the docs config like alt-, and alt-/ don't work anymore. Others with alt work fine -- it seems quite random.

One thing I can add to everybody else's descriptions. I have a setup for multi-monitor that uses modes. Like this:

ctrl-alt-f1 = 'mode wa'
ctrl-alt-f2 = 'mode wb'
ctrl-alt-f3 = 'mode wc'

ctrl-shift-f1 = 'mode towa'
ctrl-shift-f2 = 'mode towb'
ctrl-shift-f3 = 'mode towc'

[mode.wa.binding]
f1 = ['workspace a1', 'mode main']
f2 = ['workspace a2', 'mode main']
f3 = ['workspace a3', 'mode main']
f4 = ['workspace a4', 'mode main']
f5 = ['workspace a5', 'mode main']
f6 = ['workspace a6', 'mode main']
f7 = ['workspace a7', 'mode main']
f8 = ['workspace a8', 'mode main']
f9 = ['workspace a9', 'mode main']
esc = 'mode main'

...

Now, before the problem occurred today I had the keys in the [mode.wa.binding] using just numeric 1, 2, 3, ... and it worked great. Now the problem with the alt bindings has started, the number keys were not working in the mode anymore and I changed them to F keys which works correctly at the moment.

I'm on Sequoia 15.2, but I was also there this morning when all was good. I double checked for things like Hammerspoon and skhd since I had them installed before, but I didn't find anything.

I guess Aerospace could use a "debug keyboard shortcuts" mode where it outputs on the console what keyboard shortcuts it can "see" -- that would make it a bit easier to try around with various running apps and see if any specific one interrupts the correct recognition of keyboard shortcuts.


Edit: another example for the problem with bindings in modes just came up. Since my alt-comma and alt-slash were not working anymore, I decided to add them to the service mode. So I did this:

ctrl-alt-esc = 'mode service'

[mode.service.binding]
slash = ['layout tiles horizontal vertical', 'mode main']
comma = ['layout accordion horizontal vertical', 'mode main']

But it did not work! I just got stuck in service mode because there was no reaction to , or / keys while in the mode.

I changed the setup to this and now it's all good:

ctrl-alt-esc = 'mode service'

[mode.service.binding]
ctrl-alt-slash = ['layout tiles horizontal vertical', 'mode main']
ctrl-alt-comma = ['layout accordion horizontal vertical', 'mode main']

Technically I can't swear that this issue with bindings in modes is the same as the one that prevents alt combos from working -- but both these problems certainly kicked in for me at exactly the same time.

@michieliJoe
Copy link

michieliJoe commented Dec 17, 2024

Could this potentially have something to do with the number of workspaces available to use?

Upon initially installing, I left the default config as-is with all of the pre-defined workspaces, 0-9 and a-z. I noticed after switching back and forth between workspaces quickly, the switch would start to slow down, and at some point, it would be so behind that I could not even open the menu in the top bar for aerospace until I gave it time to catch up. At this time, I could not use any key bindings, however whatever key binds I pushed would seemingly get added to the queue and be performed in sequence whenever aerospace caught up.

Thinking about this, I removed most of the workspaces keybindings from the config and left only those which I actually use (about 5). After doing this, workspace switches are much faster. To me this seems like an un-optomized process lurking in the workspace switching logic. Can't say if it is the cause of the original issue here, but something to consider

@oliversturm
Copy link

I found something pretty interesting today: the Alt/Option key is used by the Mac for something called the Accessibility Inspector, if and when that feature has been enabled. I never consciously enabled this and I was surprised to find that it was active. I noticed this first because when I pressed and held the Alt key, I noticed that there was a cross-shaped mouse cursor being used over certain UI elements. So I went into the system settings at accessibility/shortcuts and then I saw that the feature was active.

The screenshot shows all those checkboxes disabled, but when I first got into this dialog, they were all enabled.

2024-12-18-001441@2x

I wonder if I accidentally pressed the keyboard shortcut at some point that's mentioned in the dialog -- I checked keyboard shortcuts in System Settings as well, and it was disabled so I'm not sure that can be the reason.

Hope this helps someone -- I haven't done all possible tests yet, but this is clearly a feature that could interfere with keyboard shortcuts, so I guess it can't hurt to mention it here.

@benjivm
Copy link

benjivm commented Dec 18, 2024

I am having this issue as well. I can reliably break all shortcuts by locking the computer with CMD CTRL Q and logging back in, AeroSpace will not work until I log out or restart, despite a full application restart and config reload.

Edit: Well, this is awkward, while it was consistently breaking as described above when locking/suspending, I can no longer reproduce this issue.

@grapexy
Copy link

grapexy commented Dec 19, 2024

I am having this issue as well. I can reliably break all shortcuts by locking the computer with CMD CTRL Q and logging back in, AeroSpace will not work until I log out or restart, despite a full application restart and config reload.

Experienced the exact same thing, then I started killing apps one by one to see which one was interfering. Killing Bitwarden completely resolved the issue - I have no idea why it would be taking over all Options shortcuts though, but it worked.

@grapexy
Copy link

grapexy commented Dec 19, 2024

This is pretty interesting. I think the issue might involve an app that never actually gets focus, but still sits there waiting for a password input. Generally speaking, on macOS, if password input is focused, global shortcuts don't work, this is a known behavior.

How to reproduce:

  1. Log out, then log back in with Bitwarden set to run at login and waiting for a password.
  2. Lock the session.
  3. Unlock the session.
  4. Shortcuts are now broken.

It seems like at step 4, there’s some hidden password input that “has focus,” causing the OS to disable shortcuts. If you ever bring that app to the foreground, click on somewhere else to defocus password input or kill it, shortcuts start working again, even after another lock/unlock cycle. Removing Bitwarden from the login items also fixes this.

I’m guessing this isn’t limited to Bitwarden. Any app that starts up focused on a password input could cause the same kind of shortcut lockout.

@ashleyharvey
Copy link

This is pretty interesting. I think the issue might involve an app that never actually gets focus, but still sits there waiting for a password input. Generally speaking, on macOS, if password input is focused, global shortcuts don't work, this is a known behavior.

How to reproduce:

  1. Log out, then log back in with Bitwarden set to run at login and waiting for a password.
  2. Lock the session.
  3. Unlock the session.
  4. Shortcuts are now broken.

It seems like at step 4, there’s some hidden password input that “has focus,” causing the OS to disable shortcuts. If you ever bring that app to the foreground, click on somewhere else to defocus password input or kill it, shortcuts start working again, even after another lock/unlock cycle. Removing Bitwarden from the login items also fixes this.

I’m guessing this isn’t limited to Bitwarden. Any app that starts up focused on a password input could cause the same kind of shortcut lockout.

I experienced this a ton back when I used Yabai/skhd. (Some?) password input fields enable "secure input" mode - basically, macOS's way of preventing keystroke logging. My Yabai/skhd keyboard shortcuts never worked when e.g. I had Chrome open in the background, with the cursor sitting in the password field waiting to login to my Proxmox server. The interesting thing is, I don't run into that situation using Aerospace, despite the same circumstances coming up all the time.

Maybe Apple updated the APIs for dealing with this but some apps (e.g. BitWarden) are still using an old method? Shot in the dark. It's interesting nonetheless.

@ekvedaras
Copy link

doc-brown-gif-by-back-to-the-future-trilogy

Can confirm! Had NordPass open a window somewhere in the background prompting me for password after logging in. After I made that window go away (logged in), aerospace works again 🎉

@oliversturm
Copy link

oliversturm commented Dec 19, 2024

I tried to verify this but I can't. This morning my Alt-combos work correctly, and the existence of various login entries fields in other windows does nothing to deter them.

2024-12-19-001447@2x

Yep, even with the Touch ID dialog hanging around on one screen, I can still use alt-/ and alt-, to change layouts on another screen.

Edit: one thing I find is that if I focus the password entry field in 1Password, I can't use alt-, and alt-/ because the keystrokes are entered in the field. However, I can use alt-<cursor key> to move to another window on the same screen, and once I'm there I can use alt-, and alt-/ again.

@ekvedaras
Copy link

ekvedaras commented Dec 19, 2024

I can consistently reproduce with NordPass. When you open NordPass the login window gets put in background automatically, so you usually don't notice. But as long as that window is open somewhere alt-<letter> is not functioning. As soon as that window is closed, it all works again.

This does not happen with Bitwarden (although I only have browser extension) 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests