diff --git a/Makefile b/Makefile index d048cbd..208d1d1 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/qubes-rpc/qubes.StartApp b/qubes-rpc/qubes.StartApp new file mode 100755 index 0000000..ca3c48b --- /dev/null +++ b/qubes-rpc/qubes.StartApp @@ -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 diff --git a/rpm_spec/core-vm.spec b/rpm_spec/core-vm.spec index 7b54562..d1afe00 100644 --- a/rpm_spec/core-vm.spec +++ b/rpm_spec/core-vm.spec @@ -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