Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14a6473c94 | ||
|
|
36d07b1e5d | ||
|
|
7728495350 |
No files matched your search
+1
-1
@@ -115,7 +115,7 @@ function start {
|
|||||||
debug | buffer $@
|
debug | buffer $@
|
||||||
else
|
else
|
||||||
# detach buffered output
|
# detach buffered output
|
||||||
nohup "$BASENAME" debug </dev/null 2>&1 | "$BASENAME" buffer $@ >/dev/null 2>&1 &
|
nohup "$BASENAME" debug </dev/null 2>&1 | "$BASENAME" buffer $@ >/dev/null 2>&1 & disown
|
||||||
echo "Comfortable swipe is RUNNING in the background"
|
echo "Comfortable swipe is RUNNING in the background"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ void gesture_swipe_xdokey::update() {
|
|||||||
gesture_swipe::update();
|
gesture_swipe::update();
|
||||||
// scale threshold to 1/10 when gesture is fresh
|
// scale threshold to 1/10 when gesture is fresh
|
||||||
// acts like our static friction coefficient
|
// acts like our static friction coefficient
|
||||||
float scale = get_previous_gesture() == FRESH ? 0.01f : 1.0f;
|
const float scale = get_previous_gesture() == FRESH ? 0.01f : 1.0f;
|
||||||
// we are working with floating points which are not exact
|
// we are working with floating points which are not exact
|
||||||
// make sure we compare with a very small value (1e-6f)
|
// make sure we compare with a very small value (1e-6f)
|
||||||
// if distance goes out of threshold, perform our swipe
|
// if distance goes out of threshold, perform our swipe
|
||||||
|
|||||||
@@ -112,17 +112,22 @@ int main(int argc, char *argv[]) {
|
|||||||
// get input values
|
// get input values
|
||||||
string mouse3 = config.count("mouse3") ? config["mouse3"] : config["hold3"];
|
string mouse3 = config.count("mouse3") ? config["mouse3"] : config["hold3"];
|
||||||
string mouse4 = config.count("mouse4") ? config["mouse4"] : config["hold4"];
|
string mouse4 = config.count("mouse4") ? config["mouse4"] : config["hold4"];
|
||||||
|
bool nomouse = mouse3.empty() || mouse4.empty(); // TODO: check if mouse invalid
|
||||||
// create our mouse gesture holder
|
// create our mouse gesture holder
|
||||||
gesture_swipe_xdomouse mousehold(mouse3.data(), mouse4.data());
|
gesture_swipe_xdomouse mousehold(mouse3.data(), mouse4.data());
|
||||||
// start reading lines from input one by one
|
// start reading lines from input one by one
|
||||||
for (string line; getline(cin, line);) {
|
for (string line; getline(cin, line);) {
|
||||||
// optimization: if no mouse config is set, just run keyboard
|
if (nomouse) {
|
||||||
if (mousehold.is_swiping() && mousehold.button == MOUSE_NONE) {
|
|
||||||
keyswipe.run(line.data());
|
keyswipe.run(line.data());
|
||||||
} else if (mousehold.run(line.data())) {
|
} else {
|
||||||
// only allow keyswipe gestures on mouse move
|
// optimization: if no mouse config is set, just run keyboard
|
||||||
if (mousehold.button == MOUSE_NONE || mousehold.button == MOUSE_MOVE) {
|
if (mousehold.is_swiping() && mousehold.button == MOUSE_NONE) {
|
||||||
keyswipe.run(line.data());
|
keyswipe.run(line.data());
|
||||||
|
} else if (mousehold.run(line.data())) {
|
||||||
|
// only allow keyswipe gestures on mouse move
|
||||||
|
if (mousehold.button == MOUSE_NONE || mousehold.button == MOUSE_MOVE) {
|
||||||
|
keyswipe.run(line.data());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
if [[ "$USER" == root ]]; then
|
||||||
|
echo "Please run 'bash install' as non-root user" 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
DIR="$(dirname "$0")"
|
DIR="$(dirname "$0")"
|
||||||
VERSION="$(cat $DIR/VERSION | tr -d '[:space:]')"
|
VERSION="$(cat $DIR/VERSION | tr -d '[:space:]')"
|
||||||
|
|
||||||
@@ -98,9 +103,15 @@ function install_configuration_file {
|
|||||||
function install_main_program {
|
function install_main_program {
|
||||||
# copy source to target with executable permissions
|
# copy source to target with executable permissions
|
||||||
# install to target, with hardcoded version
|
# install to target, with hardcoded version
|
||||||
trysudo sed -E "s/^VERSION=.*/VERSION=$VERSION/" "$SOURCE" > "$TARGET"
|
if [[ -f "$TARGET" ]]; then
|
||||||
# allow execute permissions
|
trysudo rm "$TARGET"
|
||||||
|
fi
|
||||||
|
trysudo cp "$SOURCE" "$TARGET"
|
||||||
|
trysudo sed -E "s/^VERSION=.*/VERSION=$VERSION/" -i "$TARGET"
|
||||||
|
# allow execute permissions with group
|
||||||
trysudo chmod +x "$TARGET"
|
trysudo chmod +x "$TARGET"
|
||||||
|
# make sure non-root user is owner
|
||||||
|
trysudo chown "$USER" "$TARGET"
|
||||||
echo "Installed: $TARGET"
|
echo "Installed: $TARGET"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,9 +125,17 @@ function install_cpp_program {
|
|||||||
# compile program to temporary file first
|
# compile program to temporary file first
|
||||||
TMP_TARGET="$(mktemp)"
|
TMP_TARGET="$(mktemp)"
|
||||||
$COMPILE "$COMPILE_SOURCE" -o "$TMP_TARGET" -DCOMFORTABLE_SWIPE_VERSION="\"$VERSION\"" -DCOMFORTABLE_SWIPE_CONFIG="\"$CONF_TARGET\"" -DCOMFORTABLE_SWIPE_AUTOSTART="\"$AUTOSTART_TARGET\""
|
$COMPILE "$COMPILE_SOURCE" -o "$TMP_TARGET" -DCOMFORTABLE_SWIPE_VERSION="\"$VERSION\"" -DCOMFORTABLE_SWIPE_CONFIG="\"$CONF_TARGET\"" -DCOMFORTABLE_SWIPE_AUTOSTART="\"$AUTOSTART_TARGET\""
|
||||||
# compilation ok, now try to install
|
# compilation ok, now try to install with sudo
|
||||||
# check permissions maybe if will need sudo
|
trysudo mkdir -p "$(dirname "$COMPILE_TARGET")"
|
||||||
|
# remove existing file for permissions to work
|
||||||
|
if [[ -f "$COMPILE_TARGET" ]]; then
|
||||||
|
sudo rm "$COMPILE_TARGET"
|
||||||
|
fi
|
||||||
trysudo mv "$TMP_TARGET" "$COMPILE_TARGET"
|
trysudo mv "$TMP_TARGET" "$COMPILE_TARGET"
|
||||||
|
# bugfix: add with group permissions
|
||||||
|
trysudo chmod go+x "$COMPILE_TARGET"
|
||||||
|
# make sure non-root user is owner
|
||||||
|
trysudo chown "$USER" "$COMPILE_TARGET"
|
||||||
echo "Installed: $COMPILE_TARGET"
|
echo "Installed: $COMPILE_TARGET"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,6 +146,7 @@ function install_cpp_program {
|
|||||||
# /home/$USER/.config/autostart/comfortable-swipe.desktop
|
# /home/$USER/.config/autostart/comfortable-swipe.desktop
|
||||||
#
|
#
|
||||||
function install_autostart {
|
function install_autostart {
|
||||||
|
mkdir -p "$(dirname "$AUTOSTART_TARGET")"
|
||||||
cat "$AUTOSTART_SOURCE" > "$AUTOSTART_TARGET"
|
cat "$AUTOSTART_SOURCE" > "$AUTOSTART_TARGET"
|
||||||
echo "Installed: $AUTOSTART_TARGET"
|
echo "Installed: $AUTOSTART_TARGET"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user