Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two NSM related keys for Desktop files #96

Closed
grammoboy2 opened this issue Jan 29, 2023 · 2 comments
Closed

Two NSM related keys for Desktop files #96

grammoboy2 opened this issue Jan 29, 2023 · 2 comments

Comments

@grammoboy2
Copy link

grammoboy2 commented Jan 29, 2023

#40

I understand that there are two NSM related keys for Desktop files?
X-NSM-Capable=true
X-NSM-Exec=jackpatch

Is this really needed? To list NSM clients, wouldn't this be enough: X-NSM-Exec=jackpatch ? Keep it simple stupid?

jean-emmanuel/loop192@4fd4f0e
I would expect it to have this key: X-NSM-Exec=loop192, but it has only X-NSM-Capable=true. There is no X-NSM-Exec key.

A application that lists NSM clients, would only need the X-NSM-Exec key as far as I can see.

I'm afraid with two keys, you get inconsistent implementations between different clients, as already becomes apparent with the loop192 example I think.

"It is important that this is a boolean value, so that it can be manually set to off if needed"
#40 (comment)

It's not possible for Carla to not add the X-NSM-Exec key to the desktop file if NSM is not supported, or set the key empty (not ideal either probably)?

Looking at these files, in it current state there is no need for an extra key as far as I can see, but ok falkTX is talking about a post-install situation, hm.
https://github.com/falkTX/Carla/tree/main/data/desktop

Edit: desktop-file-validate doesn't report an error when X-NSM-Exec has no value (X-NSM-Exec= )

FYI, reporting and closing.

@grammoboy2
Copy link
Author

Another implementation, doesn't check for X-NSM-Exec as far as I can see:
https://github.com/Houston4444/RaySession/blob/2f4a9735a4940e65c1a2860e30dcc921d379c22c/src/daemon/list_nsm_desktop.py

These different implementations are expected I think, if you've two different keys.

@ferdnyc
Copy link

ferdnyc commented May 6, 2023

Here's my take, FWIW:

Two keys are the correct approach. At least two keys. You don't want to overload the meaning of your key to answer both "can I do this?" and "how do I do this?", because it boxes you in.

Look at Agordejo's implementation, for example. It looks for an X-NSM-Exec= key, but if it doesn't find one and the .desktop file advertises as X-NSM-Capable (or is in its whitelist), it uses the regular Exec= key instead.

Considering how many NSM-capable .desktop files contain exactly this:

Exec=fooprogram
X-NSM-Capable=true
X-NSM-Exec=fooprogram

That's a good and smart optimization — you should be able to leave out the NSM Exec key if it's redundant with your normal Exec=, not leave out the X-NSM-Capable= key. That one, as was already said, is important to keep as a boolean on/off switch, and makes it possible to omit the X-NSM-Exec= key if it doesn't provide any unique information.

There's also the possibility that, down the line, methods of starting NSM-capable clients other than exec'ing a process will come along — like D-Bus activation, for example. Then you'd have an X-NSM-DBusServiceName= instead of an X-NSM-Exec=, and X-NSM-Capable= would continue to have the exact same semantics it does today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants