Improve handling of .desktop files

Instead of directly using Exec= line, parse the file (at the launch
time) with Gio library. The main reason for this change is to handle
Terminal= option, but generally this approach should be more
bulletproof, especially when some fancy options are present in desktop
files.
This commit is contained in:
Marek Marczykowski-Górecki 2014-10-27 12:25:45 +01:00
parent d208e9baa5
commit 0613a58961
4 changed files with 15 additions and 1 deletions

View File

@ -172,6 +172,7 @@ install-common:
install -d $(DESTDIR)/usr/share/file-manager/actions
install -m 0644 qubes-rpc/*-gnome.desktop $(DESTDIR)/usr/share/file-manager/actions
install -D -m 0755 misc/qubes-desktop-run $(DESTDIR)/usr/bin/qubes-desktop-run
install -D misc/nautilus-actions.conf $(DESTDIR)/etc/xdg/nautilus-actions/nautilus-actions.conf
install -d $(DESTDIR)/mnt/removable

11
misc/qubes-desktop-run Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/python
from gi.repository import Gio
import sys
def main(myname, desktop, *files):
launcher = Gio.DesktopAppInfo.new_from_filename(desktop)
launcher.launch(files, None)
if __name__ == "__main__":
main(*sys.argv)

View File

@ -1 +1,2 @@
find /usr/share/applications/ /usr/local/share/applications/ -name '*.desktop' | xargs awk '/^\[/ { if (tolower($0) != "\[desktop entry\]") nextfile } /=/ {print FILENAME ":" $0 }' 2> /dev/null
find /usr/share/applications/ /usr/local/share/applications/ -name '*.desktop' | \
xargs awk '/^\[/ { if (tolower($0) != "\[desktop entry\]") nextfile } /^Exec=/ { print FILENAME ":Exec=qubes-desktop-run " FILENAME; next } /=/ {print FILENAME ":" $0 }' 2> /dev/null

View File

@ -344,6 +344,7 @@ rm -f %{name}-%{version}
/usr/bin/qvm-run
/usr/bin/qvm-mru-entry
/usr/bin/xenstore-watch-qubes
/usr/bin/qubes-desktop-run
%dir /usr/lib/qubes
/usr/lib/qubes/vusb-ctl.py*
/usr/lib/qubes/dispvm-prerun.sh