Skip to content

Commit

Permalink
Add qubes.StartApp service
Browse files Browse the repository at this point in the history
A simple service to start application described in .desktop file.
This way, dom0 can completely ignore VM-originated Exec= entry.
  • Loading branch information
marmarek committed May 20, 2017
1 parent 41cd218 commit 22e261f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions qubes-rpc/qubes.StartApp
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions rpm_spec/core-vm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 22e261f

Please sign in to comment.