[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).
This commit is contained in:
Rico Tiongson 2017-11-07 00:44:47 +08:00
parent 3f53a19f93
commit b491d8179b
2 changed files with 11 additions and 4 deletions

10
install
View File

@ -1,9 +1,10 @@
#!/bin/bash #!/bin/bash
DIR=$(dirname $0) DIR=$(dirname $0)
PROGRAM=$HOME/.local/bin/comfortable-swipe
if [ -x "$(command -v git)" ]; then if [ -x "$(command -v git)" ]; then
# stop any running comfortable-swipe if it exists # stop any running comfortable-swipe if it exists
comfortable-swipe stop $PROGRAM stop
fi fi
#copy config file #copy config file
@ -29,5 +30,10 @@ else
fi fi
echo "Installing..." echo "Installing..."
mkdir -p ~/.local/bin 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'." echo "Successfully installed. You may now run 'comfortable-swipe start'."

View File

@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <ctime> #include <ctime>
#include <unistd.h> #include <unistd.h>
#define cstr const string& #define cstr const string&
#define PROGRAM "$HOME/.local/bin/comfortable-swipe"
using namespace std; using namespace std;
extern "C" { extern "C" {
@ -267,7 +268,7 @@ namespace service {
} }
// starts service // starts service
void start() { 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 // stops service
void stop() { void stop() {
@ -316,7 +317,7 @@ namespace service {
fout << fout <<
"[Desktop Entry]\n" "[Desktop Entry]\n"
"Type=Application\n" "Type=Application\n"
"Exec=comfortable-swipe start\n" "Exec=bash -c \"" PROGRAM " start\"\n"
"Hidden=false\n" "Hidden=false\n"
"NoDisplay=false\n" "NoDisplay=false\n"
"X-GNOME-Autostart-enabled=true\n" "X-GNOME-Autostart-enabled=true\n"