From 605f9063718b97975e81f76e591702e69e5a8cb1 Mon Sep 17 00:00:00 2001 From: Bumsik Kim Date: Wed, 23 May 2018 23:30:25 -0400 Subject: [PATCH] Setup.py: Fixed wrong desktop entry path --- Makefile | 10 ++++------ data/virtscreen.desktop | 3 +-- setup.py | 6 ++++-- virtscreen/virtscreen.py | 5 ++++- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index a820e8a..9d6b8e3 100644 --- a/Makefile +++ b/Makefile @@ -7,15 +7,13 @@ python-wheel: /usr/bin/python3 setup.py bdist_wheel --universal python-install: - sudo /usr/bin/python3 setup.py install + /usr/bin/pip3 install . --user python-uninstall: - sudo /usr/bin/pip3 uninstall virtscreen - sudo rm /usr/share/applications/virtscreen.desktop - sudo rm /usr/share/pixmaps/virtscreen.png - + /usr/bin/pip3 uninstall virtscreen + python-clean: - sudo rm -rf build dist virtscreen.egg-info virtscreen/qml/*.qmlc + rm -rf build dist virtscreen.egg-info virtscreen/qml/*.qmlc pip-upload: python-wheel twine upload dist/* diff --git a/data/virtscreen.desktop b/data/virtscreen.desktop index ac93627..810fb1e 100755 --- a/data/virtscreen.desktop +++ b/data/virtscreen.desktop @@ -1,10 +1,9 @@ -#!/usr/bin/env xdg-open [Desktop Entry] Encoding=UTF-8 Type=Application Name=VirtScreen Comment=Make your iPad/tablet/computer as a secondary monitor on Linux -Exec=virtscreen +Exec=bash -c "export PATH=$PATH:$HOME/.local/bin; virtscreen" Icon=virtscreen Terminal=false StartupNotify=false diff --git a/setup.py b/setup.py index d3ab616..e53f184 100644 --- a/setup.py +++ b/setup.py @@ -180,8 +180,10 @@ setup( data_files=[ # Desktop entries spec: # https://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/ - ('/usr/share/applications', ['data/virtscreen.desktop']), - ('/usr/share/pixmaps', ['data/virtscreen.png']), + ('share/applications', ['data/virtscreen.desktop']), + # $XDG_DATA_DIRS/icons + # https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout + ('share/icons', ['data/virtscreen.png']), # ('share/man/man1', ['man/virtscreen.1']) ], # Optional diff --git a/virtscreen/virtscreen.py b/virtscreen/virtscreen.py index ef45784..8264ea1 100755 --- a/virtscreen/virtscreen.py +++ b/virtscreen/virtscreen.py @@ -20,8 +20,11 @@ from netifaces import interfaces, ifaddresses, AF_INET # ------------------------------------------------------------------------------- # Sanitize environment variables # https://wiki.sei.cmu.edu/confluence/display/c/ENV03-C.+Sanitize+the+environment+when+invoking+external+programs -del os.environ['HOME'] # Delete $HOME env for security reason. This will make + +# Delete $HOME env for security reason. This will make # Path.home() to look up in the password directory (pwd module) +if 'HOME' in os.environ: + del os.environ['HOME'] os.environ['PATH'] = os.confstr("CS_PATH") # Sanitize $PATH # Setting home path and base path