Extension to make a link (⌘K)

The linked config file has the same structure as a snippet. (Internally, snippets gets converted into such a config file.)

Here’s a snippet based on the Config file I linked, that shows the same concept simplified:

#popclip
{
  "name": "Add Link",
  "icon": "L",
  "actions": [
    {
      "keyCombo": "command k",
      "requiredApps": [
        "com.app.that.uses.command.k",
        "com.another.app.that.uses.command.k"
      ]
    },
    {
      "keyCombo": "shift command u",
      "requiredApps": [
        "com.app.that.uses.command.shift.u"
      ]
    }
  ]
}

(The above block is an extension snippet — select it then click “Install Extension” in PopClip.)

I know that looks like JSON, not YAML, but JSON is actually valid YAML! You can convert is to more typical YAML…

#popclip
name: Add Link
icon: L
actions:
  - keyCombo: command k
    requiredApps:
      - com.app.that.uses.command.k
      - com.another.app.that.uses.command.k
  - keyCombo: shift command u
    requiredApps:
      - com.app.that.uses.command.shift.u

PopClip will show the appropriate action according to the app being used.

Another approach would be to do a JS snippet that uses popclip.pressKey() with logic according to popclip.context.appIdentifier.

1 Like