From b491d8179b69282e90a69395d001a8cb7d8f81d3 Mon Sep 17 00:00:00 2001 From: Rico Tiongson Date: Tue, 7 Nov 2017 00:44:47 +0800 Subject: [PATCH] [bugfix-kde-startup] Defer to bash when executing autostart script PATH is not reliable especially for .zshrc when running autostart script. Prefer executing autostart from bash by default instead. Fixes autostart bug is present in KDE neon v5.11 (plasma v5.11.2). --- install | 10 ++++++++-- src/comfortable-swipe.cpp | 5 +++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/install b/install index c3976f2..ff77fde 100755 --- a/install +++ b/install @@ -1,9 +1,10 @@ #!/bin/bash DIR=$(dirname $0) +PROGRAM=$HOME/.local/bin/comfortable-swipe if [ -x "$(command -v git)" ]; then # stop any running comfortable-swipe if it exists - comfortable-swipe stop + $PROGRAM stop fi #copy config file @@ -29,5 +30,10 @@ else fi echo "Installing..." mkdir -p ~/.local/bin -g++ -std=c++11 -O2 $DIR/src/comfortable-swipe.cpp -lxdo -o $HOME/.local/bin/comfortable-swipe || exec echo "Installation aborted" +g++ -std=c++11 -O2 $DIR/src/comfortable-swipe.cpp -lxdo -o $PROGRAM || exec echo "Installation aborted" + +# toggle autostart twice to refresh any changes +$PROGRAM autostart > /dev/null || exec echo "Installation aborted" +$PROGRAM autostart > /dev/null || exec echo "Installation aborted" + echo "Successfully installed. You may now run 'comfortable-swipe start'." diff --git a/src/comfortable-swipe.cpp b/src/comfortable-swipe.cpp index 898d043..9db210f 100644 --- a/src/comfortable-swipe.cpp +++ b/src/comfortable-swipe.cpp @@ -31,6 +31,7 @@ along with this program. If not, see . #include #include #define cstr const string& +#define PROGRAM "$HOME/.local/bin/comfortable-swipe" using namespace std; extern "C" { @@ -267,7 +268,7 @@ namespace service { } // starts service void start() { - int x = system("stdbuf -oL -eL libinput-debug-events | $HOME/.local/bin/comfortable-swipe buffer"); + int x = system("stdbuf -oL -eL libinput-debug-events | " PROGRAM " buffer"); } // stops service void stop() { @@ -316,7 +317,7 @@ namespace service { fout << "[Desktop Entry]\n" "Type=Application\n" - "Exec=comfortable-swipe start\n" + "Exec=bash -c \"" PROGRAM " start\"\n" "Hidden=false\n" "NoDisplay=false\n" "X-GNOME-Autostart-enabled=true\n"