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
This commit is contained in:
Rico Tiongson 2017-11-11 13:56:04 +08:00 committed by GitHub
parent 8a18ebddb8
commit 44661a8125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 65 additions and 65 deletions

View File

@ -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 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 ```bash
sudo gpasswd -a $USER input sudo gpasswd -a $USER input
``` ```
> Note: Don't forget to input your `sudo` password!
3. ***Important***: Log out / Log back in 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 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 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 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 right4 | 4-finger swipe right | ctrl+alt+shift+Left | move window to left workspace
up4 | 4-finger swipe up | super+d | show desktop up3 | 3-finger swipe up | ctrl+shift+Down | switch to bottom workspace
down4 | 4-finger swipe down | super+d | show desktop up4 | 4-finger swipe up | ctrl+alt+shift+Down | move window to bottom workspace
threshold | mouse pixels to activate swipe; higher = less sensitive; integers only | 20 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 ## Uninstall
Download the `uninstall` script then run `bash uninstall` Download the `uninstall` script then run `bash uninstall`

View File

@ -1,10 +1,12 @@
#!/bin/bash #!/bin/bash
DIR=$(dirname $0) DIR=$(dirname $0)
PROGRAM=$HOME/.local/bin/comfortable-swipe PROGRAM=/usr/local/bin/comfortable-swipe
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
@ -29,7 +31,7 @@ else
fi fi
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 $PROGRAM || 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 # toggle autostart twice to refresh any changes

View File

@ -31,7 +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" #define PROGRAM "/usr/local/bin/comfortable-swipe"
using namespace std; using namespace std;
extern "C" { extern "C" {
@ -111,12 +111,12 @@ const char* const command_map[] = {
}; };
struct swipe_gesture_impl : swipe_gesture { struct swipe_gesture_impl : swipe_gesture {
int screen_num, ix, iy, threshold; int screen_num, ix, iy;
float x, y; float x, y, threshold;
int previous_gesture; int previous_gesture;
const char** commands; const char** commands;
swipe_gesture_impl( swipe_gesture_impl(
const int threshold, const float threshold,
const char* left3 /* 000 */, const char* left3 /* 000 */,
const char* left4 /* 001 */, const char* left4 /* 001 */,
const char* right3 /* 010 */, const char* right3 /* 010 */,
@ -229,7 +229,7 @@ namespace service {
auto config = util::read_config_file(conf_filename().data()); auto config = util::read_config_file(conf_filename().data());
// initialize gesture handler // initialize gesture handler
swipe_gesture_impl swipe( swipe_gesture_impl swipe(
config.count("threshold") ? stoi(config["threshold"]) : 20, config.count("threshold") ? stof(config["threshold"]) : 0.0,
config["left3"].c_str(), config["left3"].c_str(),
config["left4"].c_str(), config["left4"].c_str(),
config["right3"].c_str(), config["right3"].c_str(),

View File

@ -6,54 +6,6 @@
# Refer to https://www.linux.org/threads/xdotool-keyboard.10528/ for a list of # Refer to https://www.linux.org/threads/xdotool-keyboard.10528/ for a list of
# keycodes you can use. # 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 # # MISCELLANEOUS #
################# #################
@ -61,5 +13,49 @@ down4 = super+d
# Threshold # Threshold
# Tweak this value depending on the sensitivity of your mousepad to perform # Tweak this value depending on the sensitivity of your mousepad to perform
# gestures. A higher value means less sensitive. # gestures. A higher value means less sensitive.
# Default: threshold = 20 # Default: threshold = 0.0
threshold = 20 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

View File

@ -2,5 +2,6 @@
echo "Uninstalling..." echo "Uninstalling..."
rm ${XDG_CONFIG_HOME:-$HOME/.config}/autostart/comfortable-swipe.desktop 2> /dev/null rm ${XDG_CONFIG_HOME:-$HOME/.config}/autostart/comfortable-swipe.desktop 2> /dev/null
comfortable-swipe stop 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" echo "Successfully uninstalled comfortable-swipe"