From 7dd2a4e8525f3b59d00c70d4d2cb9e210dc58beb Mon Sep 17 00:00:00 2001 From: Nathan Collins Date: Sun, 25 Mar 2018 20:10:11 -0700 Subject: [PATCH] Make fluxgui autostart work for locally installed fluxgui Gnome doesn't (necessarily?) consult the `$PATH` of the user's `/etc/passwd` defined shell when launching via a `.desktop` file, so here we change the `autostart/fluxgui.desktop` file to explicitly use the user's `$SHELL` and hence `$PATH`. --- README.md | 7 +++++-- debian/changelog | 5 ++++- src/fluxgui/settings.py | 16 +++++++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a3982a4..a5c3f4f 100644 --- a/README.md +++ b/README.md @@ -51,10 +51,13 @@ python download-xflux.py # EITHER install globally sudo python setup.py install + # EXCLUSIVE OR, install in your home directory. The binary installs -# into ~/.local/bin, so be sure to add that to your PATH if installing locally. +# into ~/.local/bin, so be sure to add that to your PATH if installing +# locally. In particular, autostarting fluxgui in Gnome will not work +# if the locally installed fluxgui is not on your PATH. python setup.py install --user - + # Run flux fluxgui ``` diff --git a/debian/changelog b/debian/changelog index d5bf7bd..330bd9b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,10 @@ +# -*- text -*- fluxgui (1.1.11~pre) wily; urgency=low + * make fluxgui Gnome autostart work for locally installed fluxgui, + https://github.com/xflux-gui/fluxgui/pull/89. * update icons: https://github.com/xflux-gui/fluxgui/issues/85, - https://github.com/xflux-gui/fluxgui/pull/86 + https://github.com/xflux-gui/fluxgui/pull/86. * fix https:/github.com/xflux-gui/fluxgui/issues/79: tray icon name was incorrect for some desktop environments. diff --git a/src/fluxgui/settings.py b/src/fluxgui/settings.py index dc3abc1..6153f80 100644 --- a/src/fluxgui/settings.py +++ b/src/fluxgui/settings.py @@ -158,7 +158,21 @@ def _create_autostarter(self): #create autostart entry starter_item = DesktopEntry(autostart_file) starter_item.set('Name', 'f.lux indicator applet') - starter_item.set('Exec', 'fluxgui') + # Use the user's shell to start 'fluxgui', in case + # 'fluxgui' is not installed on a standard system path. We + # use 'sh' to start the users '/etc/passwd' shell via + # '$SHELL', so that this will still work if the user + # changes their shell after the + # 'autostart/fluxgui.desktop' file is created. + # + # See PR #89 for an alternative approach: + # + # https://github.com/xflux-gui/fluxgui/pull/89 + # + # The escaping of the 'Exec' field is described in + # + # https://developer.gnome.org/desktop-entry-spec/#exec-variables. + starter_item.set('Exec', r'sh -c "\\"\\$SHELL\\" -c fluxgui"') starter_item.set('Icon', 'fluxgui') starter_item.set('X-GNOME-Autostart-enabled', 'true') starter_item.write()