-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On Sun, Mar 25, 2018 at 10:48:44PM +0000, Davíð Steinn Geirsson wrote: > Hi, > > One thing I would really like is a way to invoke a run dialog through the > domains tray. It would be especially useful for dispvms, which don't really > provide any way to run additional commands after startup beyond 'qvm-run' > in a dom0 shell. > > I would like to implement this. I've already extended the dbus interface > in qubesdbus/models.py to expose the vm.run() method.
vm.run() (and qvm-run with just a command) use qubes.VMShell service, which should be used as a last resort (generally we plan to limit access to this service as much as possible, because it gives full control over the VM). For starting an application there is qubes.StartApp, with argument being a name of .desktop file in /usr/share/applications (without actual .desktop extension). Check menu entries for example usage. Note that some applications have different .desktop filename than actual executable - for example gnome-terminal has org.gnome.Terminal. > Adding a menu > item for the tray application looks easy. But as far as I can see there > is no run dialog/application launcher I can count on being installed > in all templates. > > Does anyone know if there is such a thing already installed on the current > templates? If not, would it be acceptable to add for example gmrun to the > template default packages? Suggestions for a better launcher also > appreciated, though ideally with minimal dependencies. The most universal thing to do, would be to ask for the command still in dom0. But you wont get command completion and such features. > 'Run terminal' would also be a very handy menu item. But it has the same > problem - we don't know the users installed terminal emulators, though > gnome-terminal seems to be included both on debian and fedora templates. > Would it be acceptable to hardcode a dependency on that? Very similar problem is solved here: https://github.com/QubesOS/qubes-desktop-linux-i3/blob/master/i3-settings-qubes/qubes-i3-sensible-terminal IMO putting gnome-terminal earlier in that list makes sense. Note that minimal templates don't have it - AFAIR only xterm is available there. But this is not the best possible solution... Also, related: https://github.com/QubesOS/qubes-issues/issues/2706 > Is there a better way to launch the users preferred terminal? On debian > I would use /etc/alternatives/x-terminal-emulator but it seems fedora > doesn't use alternatives for this. I don't think Fedora have something like this. Another option (in addition to the above guessing/hardcoded default?) would be to use "features" introduced in Qubes 4.0. This is basically arbitrary key-value store associated with a VM. You can use it to set preferred terminal application per-VM. And there is a function to get a value for a VM, and fallback to a value on its template (if not set for the VM). Usage: - From command line: qvm-features tool. [marmarek@dom0 ~]$ qvm-features personal [marmarek@dom0 ~]$ qvm-features personal preferred-terminal [marmarek@dom0 ~]$ qvm-features personal preferred-terminal gnome-terminal [marmarek@dom0 ~]$ qvm-features personal preferred-terminal gnome-terminal [marmarek@dom0 ~]$ qvm-features personal preferred-terminal gnome-terminal - From python: https://dev.qubes-os.org/projects/core-admin-client/en/latest/qubesadmin.html#module-qubesadmin.features Usage: >>> import qubesadmin >>> q = qubesadmin.Qubes() >>> personal = q.domains['personal'] Get feature: >>> personal.features['preferred-terminal'] 'gnome-terminal' Unset: >>> del personal.features['preferred-terminal'] Getting feature when not set will get you exception (as any dict in python)... >>> personal.features['preferred-terminal'] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.5/site-packages/qubesadmin/features.py", line 55, in __getitem__ self.vm.name, 'admin.vm.feature.Get', item).decode('utf-8') File "/usr/lib/python3.5/site-packages/qubesadmin/base.py", line 68, in qubesd_call payload_stream) File "/usr/lib/python3.5/site-packages/qubesadmin/app.py", line 483, in qubesd_call return self._parse_qubesd_response(return_data) File "/usr/lib/python3.5/site-packages/qubesadmin/base.py", line 102, in _parse_qubesd_response raise exc_class(format_string, *args) qubesadmin.exc.QubesFeatureNotFoundError: "'Feature not set for domain personal: preferred-terminal'" ...unless you use 'get' and provide default value: >>> personal.features.get('preferred-terminal', 'xterm') 'xterm' Getting value, with fallback to the one on template (not available from command line): >>> f_tpl = q.domains['fedora-26'] >>> f_tpl.features['preferred-terminal'] = 'gnome-terminal' >>> personal.features.check_with_template('preferred-terminal', 'xterm') 'gnome-terminal' - -- 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----- iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAlqvI8YACgkQ24/THMrX 1ywpQQgAhWIOQdtVLJQclHt7WDbFPzyDkKgRetDH/8O9jCmy8vyMK+IFAJRp7vpu 62biv4lVeiOH7DJ3KWossP3AknYGu5DCHd6/AJFTZ+Afk3qAyqYZvQSmw7rJ4bKY b0uZsXjSkYYZvvJYxSl4iSrT42EoiwjY4zduWUkLKGjHaWt2i0wm2PS+ZJL4+Jz3 Mrm64pAYptjzfOlXlflj8pJw8XCVCf8N8PheKRpyc5hJHQSc3ml1QxYvxWHmotmT LL9//4DRwGVKxVXAx6TLmtrjJGFrwnHnHmzN1E9/b0kpUrBGL4bG6DB9snUx+7sP nAS/nQRaxqw9Sra8LGC3wy5gy3lSAw== =y9XI -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "qubes-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/qubes-devel/20180326171736.GO8343%40mail-itl. For more options, visit https://groups.google.com/d/optout.
