pilotmoon / PopClip-Extensions

Source code for extensions in the official PopClip Extensions directory.
https://www.popclip.app/extensions/
MIT License
1.92k stars 440 forks source link

Deepl Translator extension doesn't allow setting shortcut #1236

Open ElhemEnohpi opened 9 months ago

ElhemEnohpi commented 9 months ago

From DeepL Translator — PopClip Extensions:

Options: DeepL App Shortcut: Sets the key combo for PopClip to use to activate DeepL. Leave this blank to use the default DeepL combo which is "⌘+C+C". Otherwise type a key combo like "control option command D". (See Key Combo String Format.)

I expected to see this option in the extension settings menu, but it's not there. The default combo of "⌘+C+C" is very annoying, because it leads to many false triggers when copying text in general and you accidentally press ⌘+C twice. I would like to set a different combo, and have it work with PopClip.

It looks like it's present in the source code, but it has hidden: true:

https://github.com/pilotmoon/PopClip-Extensions/blob/master/source/DeepLTranslator.popclipext/deepl.js

    const comboOption = {
        identifier: 'combo',
        label: 'DeepL App Shortcut',
        type: 'string',
        hidden: true,
        description: "Leave this blank to use '⌘+C+C', the default. Or type a shortcut like 'control option command D', if you have set custom DeepL preferences."
    };

I spent some time to figure out how to modify the extension, and changed it to hidden: false. It seems to work, is there some reason not to enable it? If you enable it, you may want to edit the description for the modeOption, and the link for the key combo string format on the extension's page should be to https://www.popclip.app/dev/key-press-actions#string-format