qvm-sync-appmenus: I wrote a “post” sls file that I ran after setting everything up…so in essence, I’m going from step 1 through the first line of your step 3…then shutting down. Then -post.sls runs, and it starts the template, runs qvm-sync-appmenus, and stops the template. It never fixes anything when I do this. (I also tried putting commands for dom0 to wait a few seconds into the sequence.)
My sequence is -create.sls (clone, prefs, features, tags, menu-items and/or default-menu-items [but see below where I talk about menu setup]. This all happens on dom0. Then I run the installs (-configure.sls; this causes the disp-mgmt to start the vm and do the installs, with the states running on the vm. Finally I do -post.sls…if there’s anything to be done after installing; this is where I tried to use qvm-sync-appmenus but I removed it when it had no effect. (Without it I very rarely need a post.sls file.)
If I issue those three commands from the command prompt, it works. If i do it with a bash script, it works. But from salt, I can rerun it until I’m blue in the face and it won’t work.
I note that you appear to be setting the menu-items and default-menu-items before installing things. (Of course anything that existed on the qube you cloned is already there, but possibly other items haven’t been installed yet when you add them to the menu.) I’m doing that as well.
OK now on to what I have to do to get qubes to show up in the menu properly. I know this is going to get VERY confusing, but it turns out there are four distinct cases, and there’s a template-for-dispvms pref and an appmenus-dispvm feature involved too.
To recap that for the benefit of anyone trying to follow along:
A TemplateVM should show up as “template: ” with a double cube icon with the upper left of the qubes being a “ghost.” (Apparently that means “template” be it either a TemplateVM or Dvm Template.)
An AppVM that is not a DVM template should show up as “Qube: ” with a plain cube icon if icons are visible.
A DVM template should show up as “Template (disp): ” with a double cube icon with the upper left of the two qubes being a “ghost.” Note that this is the one that will actually run something on the DVM template itself, not on a disposable made from the template.
Then also (if enabled with “qvm-features appmenus-dispvm 1” [I don’t recall whether 0 or one is the default; I always just set it to one or the other without relying on the default]) “Disposable: ”–this will run disp1234. In this case it’s a double cube icon with the lower right qube being the “ghost”. If it’s a DVM template why would you want to disable this? It makes sense to do so if a named DVM is based on this DVM template and you never want to run disp1234 disposables off of it.
A Named DVM will look like “Qube: ” with the same “disposable” icon, solid cube upper left, ghost qube lower right. (The name of its DVM template does not appear, and that’s a good thing.)
For a TemplateVM OR an Appvm that isn’t a dvm template, I set menu-items only, not default-menu-items, during create.
For a DVM Template, I set default-menu-items only during create. I found that if I set menu-items here, the dvm template will show up in the KDE menu looking exactly like a regular AppVM, and you can’t launch disp1234 disposables from it. (This was the subject of this thread: Possible glitch in KDE menuing (and other menus too) for Qubes disposable templates - User Support / General - Qubes OS Forum (qubes-os.org)–I found out that if I didn’t do it the way I am describing here the qube would not be treated as a dvm template in the menus). Only after installing software do I then go back (in a bash shell, though I could create a “post.sls” file–the bash shell allows me to do it in just one place) and find out what’s in default-menu-items and set menu-items to the same thing. (This would probably be unnecessary if only I could set the template-for-dispvm during the qvm.present state, but apparently it has to be set in qvm.prefs state that runs after qvm.present. This is why cloning a “broken” vm worked: the clone is made of a qube that has the flag already properly set.) In that old thread, I was doing both default-menu-items and menu-items, and had to remove the menu-items setting in my create.sls file to get it to work properly. You reported yours was working fine, I started removing things from the sls file until I found the thing that was preventing it from working.
In all of the above cases, I then have to run qvm-sync-appmenus (as discussed above, I have to do it in bash because doing it in salt has no effect).
That leaves one case, the Named DVM. All I have to do there is set menu-items only. It just works, I won’t even have to run qvm-sync-appmenus on it. (I am not sure…since it should pick up the DVMT’s settings, I may not even need to set menu-items on it, unless it want it to differ from its template.)
I do not recall if I found that setting default-menu-items was harmful for non-dvmt-AppVMs, named dvms and Templates, or just useless. I do know that setting menu-items during create for dvm templates is harmful (as recounted in that other thread).