Open
Description
Description
Add an ability to define application specific bindings
The issue becomes even more relevant after the introduction of menu-bar
command #1403
Details
The design is yet unclear, but the feature request deserves a tracking issue (which this issue is about)
Very much related and should be designed together: #278
Use cases
- per-app
menu-bar
command Implementmenu-bar
,new-window-or-open
,new-tab-or-open
subcommands #1403 - Swap alt/opt and cmd modifiers (not covered by the suggested drafts)
Drafts
[[conditional]]
if = 'test --app-bundle-id org.mozilla.firefox'
[conditional.binding] # TOML is hell ugly
ctrl-n = 'menu-bar --match-path-suffix "new tab" --click-first'
[mode.main.app-binding.org.mozilla.firefox]
ctrl-n = 'menu-bar --match-path-suffix "new tab" --click-first'
[[mode.main.conditional-binding]] # Surprisingly it doesn't conflict with [mode.main.binding]
if = 'test --app-bundle-id org.mozilla.firefox'
ctrl-n = '...'
Discarded alternatives
[mode.main.binding]
ctrl-n = '''
if test --app-bundle-id org.mozilla.firefox do
menu-bar --match-path-suffix 'new tab' --click
else
pass
# or: send-key ctrl-n
end
'''
Discarded because I am slowly moving away from the idea of introducing built-in control flow structures like if
[mode.main.binding]
ctrl-n = { if = 'test --app-bundle-id org.mozilla.firefox', run = 'menu-bar --match-path-suffix "new tab" --click-first' }
Discarded because the syntax is misleading on when the binding swallows the key event
Open questions
- The exact TOML syntax is an open question
- It'd be cool if modes somehow could cover the use case, but I don't see how