Compare commits

...
Author SHA1 Message Date
Rico Tiongson a88372ecee Merge branch 'master' of https://github.com/Hikari9/comfortable-swipe into improve-install 2020-05-12 09:23:05 +08:00
Rico Tiongson 0cfe16badc Bump to version 1.2.4 2020-05-12 09:22:52 +08:00
Rico Tiongson 7c3e2342f9 Specify group permissions for comfortable-swipe-buffer 2020-05-12 09:22:14 +08:00
Rico Tiongson 244549bc0e Add go+x permissions to C++ program 2020-05-12 09:19:59 +08:00
Rico Tiongson 9d25f1cc9f Update README.md 2020-05-08 01:13:01 +08:00
Rico Tiongson 59c7314a84 Update README 2020-05-08 01:12:48 +08:00
Rico Tiongson a66e41ed81 Improve install command 2020-05-08 01:04:36 +08:00
Rico Tiongson 9deaf2da2c Specify disabled swipes (#86)
* Configure swipes ok for mouse3/4 = move

* Use filled heavy check mark
2020-05-08 00:03:18 +08:00
6 changed files with 77 additions and 51 deletions

No files matched your search

+41 -35
View File
@@ -48,9 +48,7 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
1. **_Important_**: After inputing your `sudo` password, log out then log back in 1. **_Important_**: After inputing your `sudo` password, log out then log back in
## List of Commands 1. Start the Program
1. **Start the Program**
``` ```
comfortable-swipe start comfortable-swipe start
@@ -63,24 +61,19 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
Comfortable swipe is RUNNING in the background Comfortable swipe is RUNNING in the background
``` ```
1. **Stop the Program** 1. (Optional) Stop the Program
``` ```
comfortable-swipe stop comfortable-swipe stop
``` ```
1. **Toggle Autostart** (optional) 1. (Optional) Toggle autostart
```bash ```bash
comfortable-swipe autostart comfortable-swipe autostart
comfortable-swipe autostart on
comfortable-swipe autostart off
comfortable-swipe autostart toggle
comfortable-swipe autostart status
comfortable-swipe autostart path
``` ```
1. **Program status** 1. (Optional) See program status
```bash ```bash
comfortable-swipe status comfortable-swipe status
@@ -108,7 +101,7 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
mouse4 is NOTSET mouse4 is NOTSET
``` ```
1. **Get config** 1. (Optional) Get config
``` ```
comfortable-swipe <PROPERTY> comfortable-swipe <PROPERTY>
@@ -128,7 +121,7 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
comfortable-swipe mouse4 comfortable-swipe mouse4
``` ```
1. **Set config** 1. (Optional) Set config
```bash ```bash
comfortable-swipe <PROPERTY> [=] <VALUES> comfortable-swipe <PROPERTY> [=] <VALUES>
@@ -162,6 +155,16 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
comfortable-swipe --help comfortable-swipe --help
``` ```
1. Autostart commands
```bash
comfortable-swipe autostart on
comfortable-swipe autostart off
comfortable-swipe autostart toggle
comfortable-swipe autostart status
comfortable-swipe autostart path
```
1. Show output with `--attach` 1. Show output with `--attach`
Example output of 3-finger left, 4-finger left, 3-finger right, 3-finger up: Example output of 3-finger left, 4-finger left, 3-finger right, 3-finger up:
@@ -419,46 +422,49 @@ Possible Values:
- scroll - 3/4 finger natural scroll (no acceleration, very experimental) - scroll - 3/4 finger natural scroll (no acceleration, very experimental)
- scroll_reverse - 3/4 finger reverse scroll (no acceleration, very experimental) - scroll_reverse - 3/4 finger reverse scroll (no acceleration, very experimental)
> **Tip**: You can clear mouse gestures by setting them blank
>
> ```
> comfortable-swipe mouse3 =
> comfortable-swipe mouse4 =
> ```
Examples: Examples:
- 3/4-finger drag ✔️ swipes OK
⭕ swipes DISABLED
- 3/4-finger drag ⭕
```bash ```bash
comfortable-swipe mouse3 = button1 comfortable-swipe mouse3 = button1
```
```bash
comfortable-swipe mouse4 = button1 comfortable-swipe mouse4 = button1
``` ```
- 3/4-finger natural scroll
You can also use `button2` for middle click and `button3` for right click.
- 3/4-finger natural scroll ⭕
```bash ```bash
comfortable-swipe mouse3 = scroll comfortable-swipe mouse3 = scroll
```
```bash
comfortable-swipe mouse4 = scroll comfortable-swipe mouse4 = scroll
``` ```
- 3/4-finger reverse scroll - 3/4-finger reverse scroll ⭕
```bash ```bash
comfortable-swipe mouse3 = scroll_reverse comfortable-swipe mouse3 = scroll_reverse
```
```bash
comfortable-swipe mouse4 = scroll_reverse comfortable-swipe mouse4 = scroll_reverse
``` ```
- Move 3/4-fingers with the cursor - Move 3/4-fingers with the cursor ✔️
```bash ```bash
comfortable-swipe mouse3 = move comfortable-swipe mouse3 = move
comfortable-swipe mouse4 = move
``` ```
```bash > **Warning**: Some mouse configuration will **disable up/left/right/down behavior** to avoid gesture conflicts. The logic of this will be improved in the future.
mcomfortable-swipe ouse4 = move
```
> **Warning**: Applying any mouse-mouse configuration will **disable up/left/right/down behavior** to avoid gesture conflicts. The logic of this will be improved in the future.
## Debugging ## Debugging
@@ -501,13 +507,13 @@ If you can see `GESTURE_SWIPE_XXX` in your output, that means your touchpad supp
For the following reasons: For the following reasons:
1. We want prioritize "comfort" over functionality, which we deliver through performance in our near-zero-overhead implementation (that's why C++) 1. We want prioritize "comfort" over functionality, which we deliver through performance in our negligible-overhead implementation (that's why C++)
2. Running a new shell command with unpredictable process time will break our unthreaded optimizations (unlike native keystrokes) 1. There are other gesture libraries that already do this properly (eg. [libinput gestures](https://github.com/bulletmark/libinput-gestures), [Fusuma](https://github.com/iberianpig/fusuma)), we don't want to be a clone of them
3. There are other gesture libraries that already do this properly (eg. [libinput gestures](https://github.com/bulletmark/libinput-gestures), [Fusuma](https://github.com/iberianpig/fusuma)), we don't want to be a clone of them 1. Running a new shell command with unpredictable process time will break our unthreaded optimizations (unlike native keystrokes)
That's why it's not possible... That's why it's not possible... or not?
**Answer 2**: _... but actually **YES**!_ **Answer 2**: _... but actually **IT'S POSSIBLE**!_
Although we don't provide this out of the box in our config, this can definitely be Although we don't provide this out of the box in our config, this can definitely be
done with the default bash tools. done with the default bash tools.
+1 -1
View File
@@ -1 +1 @@
v1.2.2 v1.2.4
+5 -5
View File
@@ -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
} }
@@ -200,10 +200,10 @@ function status {
else else
vstatus="VALID" vstatus="VALID"
if [[ "$key" != mouse* ]]; then if [[ "$key" != mouse* ]]; then
if [[ "$key" == *3 && -n "$mouse3" ]]; then if [[ "$key" == *3 && -n "$mouse3" && "$mouse3" != move ]]; then
vstatus="IGNORED" vstatus="DISABLED"
elif [[ "$key" == *4 && -n "$mouse4" ]]; then elif [[ "$key" == *4 && -n "$mouse4" && "$mouse4" != move ]]; then
vstatus="IGNORED" vstatus="DISABLED"
fi fi
fi fi
if [[ "$key" == threshold ]]; then if [[ "$key" == threshold ]]; then
+1 -1
View File
@@ -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
+10 -5
View File
@@ -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());
}
} }
} }
} }
+19 -4
View File
@@ -98,9 +98,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 +120,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 +141,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"
} }