Extension to make a link (⌘K)

Is there an extension for adding a link? The keyboard shortcut is CMD-K, but would be great to have a it on the Popclip menu.

1 Like
#popclip
name: Add Link
icon: ⌘K
key combo: command k

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

Is it possible to create a version of this extension compatible with PopClip 2021.4 (3131) for macOS Sierra 10.12.1? Thanks in advance! :slightly_smiling_face:

Thanks. Can this be configured based on application? Some apps use cmd + k, while some use cmd + shift + u. Any way to customize per app?

1 Like

yes, it can be done with multiple actions, each with different app requirements, similar to https://github.com/pilotmoon/PopClip-Extensions/blob/master/source/Highlight.popclipext/Config.json

Thanks. Sorry for the lame question but is a config file or is it the extension itself? I mostly create extension using inverted syntax in yaml or JS.

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