Calling an external script from a GNOME Shell extension + distributing the extension?

Hi all,

I am developing an extension for GNOME Shell to interface with a Nitrokey 3. The extension asks the fob to generate an OTP and places it in the clipboard.

The Nitrokey developers provide a Python interface to talk to the fob, and rewriting everything in Javascript isn’t really doable, so I’ve written a small (~50 lines of code) script which operates on the key and sends back the results to GNOME Shell as JSON. I find the script with <extension>.path and invoke it via Gio.Subprocess.

However, I’m not sure how to submit to extensions.gnome.org: the script has ~10 dependencies, some of them are a MB big or more and some of them have native code, so I can’t just remove them or bundle wheel files in the extensions.

Would it be acceptable if the script detected the problem and directed the user to execute pip install nitrokey in a terminal?

So, the extension essentially only talks to a device, which then creates a code, which is supposed to be copied into the clipboard.

I think in this case Write Applications When It Makes Sense applies. This is not really functionality that specifically needs to be part of the desktop.
Having it as an app would make it more portable, allows more flexibility regarding programming language and API, and you can use a package manager to define the necessary dependencies.

I think in this case Write Applications When It Makes Sense applies. This is not really functionality that specifically needs to be part of the desktop.

I chose an extension because “request the user to stop what they’re doing and touch a physical button” is a naturally system-modal task, and in fact other security/authentication technologies are embedded in GNOME Shell.

I understand that it’s a niche use case for owners of a specific piece of hardware. That’s why it’s an extension. I have already written and used it, it is a lot easier to operate then the existing app, therefore I am asking about how to distribute it in extensions.gnome.org.

I guess I could write a more minimal app to distribute on Flathub, and putting it in the favorites would let me operate it with a similar amount of clicks and a large UI in the vein of GNOME Shell’s quick settings menu. Yes, I would be able to avoid JavaScript and subprocesses, but it wouldn’t be much easier to discover for the audience and it would have slightly worse UX (GcrSystemPrompter for example doesn’t let one pick a choice from a list, so it wouldn’t be system modal in the same way as keyring or polkit).

Would it be acceptable if the script detected the problem and directed the user to execute pip install nitrokey in a terminal?

As we mentioned in the Review Guidelines: Scripts and Binaries, you can use pip:

Extensions may install modules from well-known services such as pip , npm or yarn but MUST require explicit user action. For example, the extension preferences may include a page which describes the modules to be installed with a button.

You can even simply mention in the description that:

This extension is using nitrokey as its dependency. You can install it via pip install nitrokey