Nix desktop shortcuts in dom0

91 views
Skip to first unread message

ma...@lamarciana.com

unread,
Sep 18, 2016, 6:19:33 AM9/18/16
to qubes-users
Hi,

This question is regarding a debian-8 standalone VM, but I guess it would be the same for template VMs.

I have installed [Nix](http://nixos.org/nix/) package manager. With it, I have installed latest firefox release. Then, I wanted the shortcut icon to nix installed firefox to appear in dom0 desktop. Reading [Managing shortcuts to applications in AppVMs](https://www.qubes-os.org/doc/managing-appvm-shortcuts/) and with some investigation I have achieve it. Here are the steps I have followed:

- I created a symlink to `/home/user/.nix-profile/share/applications/firefox.desktop` in `/user/share/applications`
- I run `qvm-sync-appmenus MyVM` from dom0
- I added new available shortcut

Then, I see I could do that for every GUI application I install from nix. But, is there any way to make `qvm-sync-appmenus` also read from `/home/user/.nix-profile/share/applications/`? Or should I investigate from the Nix side how to automatically create symlinks to `/usr/share/applications`?

Thanks

J. Eppler

unread,
Sep 20, 2016, 7:00:29 PM9/20/16
to qubes-users, ma...@lamarciana.com
Hello,

I would do the following:

> should I investigate from the Nix side how to automatically create symlinks to `/usr/share/applications`?

in the other case you would have to modify `qvm-sync-appmenus`, which is implemented in python.

However, I think for a single VM it is easier to go with the symlink solution.

ma...@lamarciana.com

unread,
Sep 22, 2016, 2:39:35 AM9/22/16
to qubes-users, ma...@lamarciana.com
> Hello,
>
> I would do the following:
>
> > should I investigate from the Nix side how to automatically create symlinks to `/usr/share/applications`?

Thaks for your answer. I'm trying with it, but without luck for now :) :

http://unix.stackexchange.com/questions/310666/nix-desktop-files

ma...@lamarciana.com

unread,
Sep 23, 2016, 9:45:44 AM9/23/16
to qubes-users, ma...@lamarciana.com
Hi. Finally I get some light from the other side :)

It seems that freedesktop Desktop Menu Specification defines an environment variable which should contain a path with all directories with .desktop files:

https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html#paths

$XDG_DATA_DIRS/applications/

This directory contains a .desktop file for each possible menu item. Each directory in the $XDG_DATA_DIRS search path should be used (i.e. desktop entries are collected from all of them, not just the first one that exists). When two desktop entries have the same name, the one appearing earlier in the path is used.

The <DefaultAppDirs> element in a menu file indicates that this default list of desktop entry locations should be scanned at that point. If a menu file does not contain <DefaultAppDirs>, then these locations are not scanned.

I have looked at `qvm-sync-appmenus` and I don't see it reading that variable. Can anyone confirm this point?

Thanks

Marek Marczykowski-Górecki

unread,
Sep 23, 2016, 9:57:12 AM9/23/16
to ma...@lamarciana.com, qubes-users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Yes, I can confirm:

[user@testvm ~]$ cat /etc/qubes-rpc/qubes.GetAppmenus
find /usr/share/applications/ /usr/local/share/applications/ -name '*.desktop' -print0 2>/dev/null | \
xargs -0 awk '
BEGINFILE { entry="" }
/^\[/ { if (tolower($0) != "\[desktop entry\]") nextfile }
/^Exec=/ { entry = entry FILENAME ":Exec=qubes-desktop-run " FILENAME "\n"; next }
/^NoDisplay *= *true$/ { entry=""; nextfile }
/=/ { entry = entry FILENAME ":" $0 "\n" }
ENDFILE { print entry }
' 2> /dev/null

It uses /usr/share/applications/ /usr/local/share/applications/
directly.

Does Nix set $XDG_DATA_DIRS?

- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJX5TSyAAoJENuP0xzK19cscQUIAI2+H8DxFxl8Wd/XyadzMZkZ
fjaPauYubkajzGLCmceuHYriNs1IFEYVTw98aYIq2Z23qdTJvyBt3FaQ6elj40Zr
SSxUmF3b0mBCT428idn3v5LobmMrKNdjaLBZy0MNDY3dxWNRRfzHAuD+4Ohfvtsp
W9UJAmbuivj8DbxG7w3OBMvdlUWBmP7kkcmNlO08557yOvOnA60Z2No3aRBaI6VO
De7KEkM9vak/BFX1T9yHJquuTCQ3QPHM6spN7F2sJmnp5e1CxO00qdNj2FbZEZGF
UcpNtO0Io7Qwefi/UieuFXvBlkny2DQri9Y404GE8xg4P2lRSGvK0oEFbI78b6Y=
=VliW
-----END PGP SIGNATURE-----

Marc Busqué

unread,
Sep 23, 2016, 10:53:14 AM9/23/16
to Marek Marczykowski-Górecki, qubes-users
> It uses /usr/share/applications/ /usr/local/share/applications/
> directly.
>
> Does Nix set $XDG_DATA_DIRS?

I think it doesn't. At least, it didn't set it during my installation.
But it could be set manually.

Furthermore, I don't see this variable set in debian and template VMs. I
don't have "canonical" fedora/debian machines to test it there. If it is
set there, I think qubes should follow the convention. But then, that
variable should also be set in debian/fedora VMs.

What do you think?


Marc Busqué
http://waiting-for-dev.github.io/about/

Marek Marczykowski-Górecki

unread,
Sep 23, 2016, 5:01:50 PM9/23/16
to Marc Busqué, qubes-users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Fri, Sep 23, 2016 at 04:53:10PM +0200, Marc Busqué wrote:
> > It uses /usr/share/applications/ /usr/local/share/applications/
> > directly.
> >
> > Does Nix set $XDG_DATA_DIRS?
>
> I think it doesn't. At least, it didn't set it during my installation.
> But it could be set manually.

If it doesn't, supporting XDG_DATA_DIRS would not help with Nix.

Current implementation simply assume default value, according to
spec[1]:

If $XDG_DATA_DIRS is either not set or empty, a value equal to
/usr/local/share/:/usr/share/ should be used.

[1]
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJX5Zg3AAoJENuP0xzK19cssTkIAJMRv/CE08ujWAtKXH2d6gAa
gLtJ7X+XTOTSRLFlzg6ry7ndiiukFIHFzqmgIoPWTf3+9BpsBJKGWrLyY/hDmx+5
K5iUHkRXSd2DzKmDa6QMNZxsL3+NvIYSZzWxT4k9LJLCCjEWn0r1nX2h7OYcRwwE
Nwhur4i3XouECfJ4iryYcbVkqWG0sVDGbGE1JaGrgtqqtVqNYFAt93wsbJpffIRK
JqmjBTEczlHt+zgXiGJp2//4oXevfAN5ahF6UoGRXvI1AWfwnh0aLvxnCi9id6Mu
3jGttmLPQq85BSu9Klc8gLyrGBIxO2QBBORMdlzSjI+mvEewcR+cRZ+6/7GSn7g=
=UrXO
-----END PGP SIGNATURE-----

Marc Busqué

unread,
Sep 24, 2016, 4:12:28 AM9/24/16
to Marek Marczykowski-Górecki, qubes-users

> If it doesn't, supporting XDG_DATA_DIRS would not help with Nix.

But couldn't I set it manually? Then Qubes should read from it that change is introduced.

Reply all
Reply to author
Forward
0 new messages