Modify install script

This commit is contained in:
Rico Tiongson 2019-02-07 17:34:09 +08:00
parent fbe40b7b24
commit 1d20d3801f
4 changed files with 9 additions and 6 deletions

View File

@ -9,8 +9,6 @@ OLD_CONF_PATH=${XDG_CONFIG_HOME:-$HOME/.config}/comfortable-swipe.conf
if [ -x "$(command -v $PROGRAM)" ]; then if [ -x "$(command -v $PROGRAM)" ]; then
# stop any running comfortable-swipe if it exists # stop any running comfortable-swipe if it exists
$PROGRAM stop $PROGRAM stop
# remove existing comfortable-swipe
rm $(which comfortable-swipe)
fi fi
#copy config file #copy config file
@ -44,8 +42,11 @@ else
fi fi
fi fi
echo "Installing..." echo "Installing..."
# mkdir -p ~/.local/bin # remove existing comfortable-swipe
sudo g++ -std=c++11 -O2 $DIR/src/comfortable-swipe.cpp -lxdo -o $PROGRAM || exec echo "Installation aborted" if [ -x "$(command -v $PROGRAM)" ]; then
sudo rm -f $(which comfortable-swipe)
fi
sudo $DIR/src/compile $PROGRAM || abort
GROUP=$(ls -l /dev/input/event* | awk '{print $4}' | head --line=1) || abort GROUP=$(ls -l /dev/input/event* | awk '{print $4}' | head --line=1) || abort

2
src/compile Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
g++ $(dirname $0)/main.cpp -std=c++11 -O2 -lxdo -Wno-unused-result -o $1

View File

@ -29,7 +29,7 @@ namespace comfortable_swipe::service
*/ */
void start() void start()
{ {
std::system("stdbuf -oL -e0 libinput debug-events | " __COMFORTABLE_SWIPE__PROGRAM__ " buffer"); (void) std::system("stdbuf -oL -e0 libinput debug-events | " __COMFORTABLE_SWIPE__PROGRAM__ " buffer");
} }
} }

View File

@ -61,7 +61,7 @@ namespace comfortable_swipe::service
} }
// run "kill {pid1} {pid2}..." // run "kill {pid1} {pid2}..."
std::system(kill.data()); (void) std::system(kill.data());
delete[] buffer; delete[] buffer;
// close the pipe // close the pipe