Add qubes.StartApp service

A simple service to start application described in .desktop file.
This way, dom0 can completely ignore VM-originated Exec= entry.
This commit is contained in:
Marek Marczykowski-Górecki 2017-05-20 03:48:02 +02:00
parent 41cd218660
commit 22e261f909
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
3 changed files with 26 additions and 0 deletions

View File

@ -238,6 +238,7 @@ install-common:
install -m 0644 qubes-rpc/qubes.SetDateTime $(DESTDIR)/etc/qubes-rpc
install -m 0755 qubes-rpc/qubes.InstallUpdatesGUI $(DESTDIR)/etc/qubes-rpc
install -m 0755 qubes-rpc/qubes.ResizeDisk $(DESTDIR)/etc/qubes-rpc
install -m 0755 qubes-rpc/qubes.StartApp $(DESTDIR)/etc/qubes-rpc
install -d $(DESTDIR)/etc/qubes/suspend-pre.d
install -m 0644 qubes-rpc/suspend-pre.README $(DESTDIR)/etc/qubes/suspend-pre.d/README

24
qubes-rpc/qubes.StartApp Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
if [ -z "$1" ]; then
echo "This service require an argument" >&2
exit 1
fi
# make sure it have .desktop suffix, and only one of it
app_basename="${1%.desktop}.desktop"
# Based on XDG Base Directory Specification, Version 0.7
[ -n "$XDG_DATA_HOME" ] || XDG_DATA_HOME="$HOME/.local/share"
[ -n "$XDG_DATA_DIRS" ] || XDG_DATA_DIRS="/usr/local/share:/usr/share"
for dir in $(echo "$XDG_DATA_HOME:$XDG_DATA_DIRS" | tr : ' '); do
if ! [ -d "$dir/applications" ]; then
continue
fi
if [ -f "$dir/applications/$app_basename" ]; then
exec qubes-desktop-run "$dir/applications/$app_basename"
fi
done
echo "applications/$app_basename not found in $XDG_DATA_HOME:$XDG_DATA_DIRS" >&2
exit 1

View File

@ -353,6 +353,7 @@ rm -f %{name}-%{version}
%config(noreplace) /etc/qubes-rpc/qubes.SetDateTime
%config(noreplace) /etc/qubes-rpc/qubes.InstallUpdatesGUI
%config(noreplace) /etc/qubes-rpc/qubes.ResizeDisk
%config(noreplace) /etc/qubes-rpc/qubes.StartApp
%dir /etc/qubes/autostart
/etc/qubes/autostart/README.txt
%config /etc/qubes/autostart/*.desktop.d/30_qubes.conf