Skip to content

Feature: conditional bindings. Per-app bindings #1454

Open
@nikitabobko

Description

@nikitabobko

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureFeature proposal

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions