From 44661a8125e9e8f7bdf06e4449e0ae0cb7a58a7b Mon Sep 17 00:00:00 2001 From: Rico Tiongson Date: Sat, 11 Nov 2017 13:56:04 +0800 Subject: [PATCH] Change Default Configurations (#14) * [config] Change defaults Improve user experience by reflecting default Ubuntu configurations. * [config] Change program location from ~/.local/bin to /usr/local/bin --- README.md | 15 +++--- install | 6 ++- src/comfortable-swipe.cpp | 10 ++-- src/defaults.conf | 96 +++++++++++++++++++-------------------- uninstall | 3 +- 5 files changed, 65 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index 8121f46..59c215d 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,11 @@ Sometimes, you'll need some permissions to read touchpad input data. crw-rw---- 1 root input 13, 67 Oct 23 23:09 /dev/input/event3 ``` -2. Check the fourth column (e.g. `input`) then run +2. Check the fourth column (e.g. `input`) then run: ```bash sudo gpasswd -a $USER input ``` + > Note: Don't forget to input your `sudo` password! 3. ***Important***: Log out / Log back in @@ -67,15 +68,15 @@ Make sure to run `comfortable-swipe restart` after making changes. Property | Description | Default Value | Default Behavior --------- | ----------- | -------------- | ----- +threshold | mouse pixels to activate swipe; higher = less sensitive; floating-point | 0.0 left3 | 3-finger swipe left | ctrl+shift+Right | switch to right workspace -right3 | 3-finger swipe right | ctrl+shift+Left | switch to left workspace -up3 | 3-finger swipe up | super+w | window spread -down3 | 3-finger swipe down | super+w | window spread left4 | 4-finger swipe left | ctrl+alt+shift+Right | move window to right workspace +right3 | 3-finger swipe right | ctrl+shift+Left | switch to left workspace right4 | 4-finger swipe right | ctrl+alt+shift+Left | move window to left workspace -up4 | 4-finger swipe up | super+d | show desktop -down4 | 4-finger swipe down | super+d | show desktop -threshold | mouse pixels to activate swipe; higher = less sensitive; integers only | 20 +up3 | 3-finger swipe up | ctrl+shift+Down | switch to bottom workspace +up4 | 4-finger swipe up | ctrl+alt+shift+Down | move window to bottom workspace +down3 | 3-finger swipe down | ctrl+shift+Down | switch to above workspace +down4 | 4-finger swipe down | ctrl+alt+shift+Up | move window to above workpace ## Uninstall Download the `uninstall` script then run `bash uninstall` diff --git a/install b/install index 0b3d92b..2108fd1 100755 --- a/install +++ b/install @@ -1,10 +1,12 @@ #!/bin/bash DIR=$(dirname $0) -PROGRAM=$HOME/.local/bin/comfortable-swipe +PROGRAM=/usr/local/bin/comfortable-swipe if [ -x "$(command -v $PROGRAM)" ]; then # stop any running comfortable-swipe if it exists $PROGRAM stop + # remove existing comfortable-swipe + rm $(which comfortable-swipe) fi #copy config file @@ -29,7 +31,7 @@ else fi fi echo "Installing..." -mkdir -p ~/.local/bin +# mkdir -p ~/.local/bin g++ -std=c++11 -O2 $DIR/src/comfortable-swipe.cpp -lxdo -o $PROGRAM || exec echo "Installation aborted" # toggle autostart twice to refresh any changes diff --git a/src/comfortable-swipe.cpp b/src/comfortable-swipe.cpp index 9db210f..20edbc3 100644 --- a/src/comfortable-swipe.cpp +++ b/src/comfortable-swipe.cpp @@ -31,7 +31,7 @@ along with this program. If not, see . #include #include #define cstr const string& -#define PROGRAM "$HOME/.local/bin/comfortable-swipe" +#define PROGRAM "/usr/local/bin/comfortable-swipe" using namespace std; extern "C" { @@ -111,12 +111,12 @@ const char* const command_map[] = { }; struct swipe_gesture_impl : swipe_gesture { - int screen_num, ix, iy, threshold; - float x, y; + int screen_num, ix, iy; + float x, y, threshold; int previous_gesture; const char** commands; swipe_gesture_impl( - const int threshold, + const float threshold, const char* left3 /* 000 */, const char* left4 /* 001 */, const char* right3 /* 010 */, @@ -229,7 +229,7 @@ namespace service { auto config = util::read_config_file(conf_filename().data()); // initialize gesture handler swipe_gesture_impl swipe( - config.count("threshold") ? stoi(config["threshold"]) : 20, + config.count("threshold") ? stof(config["threshold"]) : 0.0, config["left3"].c_str(), config["left4"].c_str(), config["right3"].c_str(), diff --git a/src/defaults.conf b/src/defaults.conf index 2bda5f7..a2f0dc0 100644 --- a/src/defaults.conf +++ b/src/defaults.conf @@ -6,54 +6,6 @@ # Refer to https://www.linux.org/threads/xdotool-keyboard.10528/ for a list of # keycodes you can use. -###################### -# THREE FINGER SWIPE # -###################### - -# 3-finger swipe left -# The default shortcut is switching to the right workspace. -# Default: left3 = ctrl+alt+Right -left3 = ctrl+alt+Right - -# 3-finger swipe right -# The default shortcut is switching to the left workspace. -# Default: right3 = ctrl+alt+Left -right3 = ctrl+alt+Left - -# 3-finger swipe up -# The default shortcut is window spread. -# Default: up3 = super+w -up3 = super+w - -# 3-finger swipe down -# The default shortcut is window spread. -# Default: down3 = super+w -down3 = super+w - -##################### -# FOUR FINGER SWIPE # -##################### - -# 4-finger swipe left -# The default shortcut is moving current window to the right workspace. -# Default: left4=ctrl+alt+shift+Right -left4 = ctrl+alt+shift+Right - -# 4-finger swipe right -# The default shortcut is moving current window to the left workspace. -# Default: right4=ctrl+alt+shift+Left -right4 = ctrl+alt+shift+Left - -# 4-finger swipe up -# The default shortcut is show desktop. -# Default: up4=super+d -up4 = super+d - -# 4-finger swipe down -# The default shortcut is show desktop. -# Default: down4=super+d -down4 = super+d - ################# # MISCELLANEOUS # ################# @@ -61,5 +13,49 @@ down4 = super+d # Threshold # Tweak this value depending on the sensitivity of your mousepad to perform # gestures. A higher value means less sensitive. -# Default: threshold = 20 -threshold = 20 +# Default: threshold = 0.0 +threshold = 0.0 + +############################# +# THREE / FOUR FINGER SWIPE # +############################# + +# 3-finger swipe left +# The default shortcut is switching to the right workspace. +# Default: left3 = ctrl+alt+Right +left3 = ctrl+alt+Right + +# 4-finger swipe left +# The default shortcut is moving current window to the right workspace. +# Default: left4=ctrl+alt+shift+Right +left4 = ctrl+alt+shift+Right + +# 3-finger swipe right +# The default shortcut is switching to the left workspace. +# Default: right3 = ctrl+alt+Left +right3 = ctrl+alt+Left + +# 4-finger swipe right +# The default shortcut is moving current window to the left workspace. +# Default: right4=ctrl+alt+shift+Left +right4 = ctrl+alt+shift+Left + +# 3-finger swipe up +# The default shortcut is switching to the workspace below. +# Default: up3 = ctrl+alt+Down +up3 = ctrl+alt+Down + +# 4-finger swipe up +# The default shortcut is moving current window to the bottom workspace. +# Default: ctrl+alt+shift+Down +up4 = ctrl+alt+shift+Down + +# 3-finger swipe down +# The default shortcut is switching to the workspace above. +# Default: down3 = ctrl+alt+Up +down3 = ctrl+alt+Up + +# 4-finger swipe down +# The default shortcut is moving current window to the above workspace. +# Default: ctrl+alt+shift+Up +down4 = ctrl+alt+shift+Up diff --git a/uninstall b/uninstall index fd47646..487ead6 100644 --- a/uninstall +++ b/uninstall @@ -2,5 +2,6 @@ echo "Uninstalling..." rm ${XDG_CONFIG_HOME:-$HOME/.config}/autostart/comfortable-swipe.desktop 2> /dev/null comfortable-swipe stop 2> /dev/null -rm $HOME/.local/bin/comfortable-swipe 2> /dev/null +rm $HOME/.local/bin/comfortable-swipe 2> /dev/null # compat +rm /usr/local/bin/comfortable-swipe 2> /dev/null echo "Successfully uninstalled comfortable-swipe" \ No newline at end of file