Compare commits

..
9 changed files with 99 additions and 104 deletions

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
dist: xenial
sudo: required
language: c++
matrix:
include:
- env: {MATRIX_EVAL: '"CC=gcc-7 && CXX=g++-7 && alias g++=g++-7"'}
addons:
apt:
update: true
sources:
- ubuntu-toolchain-r-test
packages:
- libxdo-dev
- libinput-tools
- g++-7
- env: {MATRIX_EVAL: '"CC=gcc-8 && CXX=g++-8 && alias g++=g+++-8"'}
addons:
apt:
update: true
sources:
- ubuntu-toolchain-r-test
packages:
- libxdo-dev
- libinput-tools
- g++-8
before_install:
- eval "${MATRIX_EVAL}"
- g++ --version
install: bash install
script: bash tests/run_tests
after_script: bash uninstall
+9 -24
View File
@@ -1,5 +1,4 @@
# Comfortable Swipe (Ubuntu) # Comfortable Swipe (Ubuntu)
[![comfortable-swipe version](https://img.shields.io/github/release/Hikari9/comfortable-swipe.svg?label=comfortable-swipe&color=orange)](https://github.com/Hikari9/comfortable-swipe/releases)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures for Ubuntu 14.04 LTS and beyond. May work for other Linux distros that support `libinput`. Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures for Ubuntu 14.04 LTS and beyond. May work for other Linux distros that support `libinput`.
@@ -15,8 +14,8 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
2. Clone this repository 2. Clone this repository
```bash ```bash
git clone https://github.com/Hikari9/comfortable-swipe.git --depth 1 git clone https://github.com/Hikari9/comfortable-swipe-ubuntu.git
cd comfortable-swipe cd comfortable-swipe-ubuntu
``` ```
3. Install 3. Install
@@ -25,7 +24,7 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
bash install bash install
``` ```
4. You may delete the downloaded `comfortable-swipe` folder after installation. 4. You may delete the downloaded `comfortable-swipe-ubuntu` folder after installation.
## How to Run ## How to Run
@@ -50,7 +49,7 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
## Configurations ## Configurations
Comfortable swipe makes use of keyboard shortcuts for configurations. Edit by running Comfortable swipe makes use of keyboard shortcuts for configurations. Edit by running
``` ```
gedit $(comfortable-swipe config) nano $(comfortable-swipe config)
``` ```
Make sure to run after making changes: Make sure to run after making changes:
@@ -61,13 +60,13 @@ comfortable-swipe restart
Property | Description | Default Value | Default Behavior Property | Description | Default Value | Default Behavior
--------- | ----------- | -------------- | ----- --------- | ----------- | -------------- | -----
threshold | mouse pixels to activate swipe; higher = less sensitive; floating-point (Note: Sky is the limit! Can be as large as 1000.0) | 0.0 threshold | mouse pixels to activate swipe; higher = less sensitive; floating-point (Note: Sky is the limit! Can be as large as 1000.0) | 0.0
left3 | 3-finger swipe left | ctrl+alt+Right | switch to right workspace left3 | 3-finger swipe left | ctrl+shift+Right | switch to right workspace
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+alt+Left | switch to left 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
up3 | 3-finger swipe up | ctrl+alt+Down | switch to bottom workspace 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 up4 | 4-finger swipe up | ctrl+alt+shift+Down | move window to bottom workspace
down3 | 3-finger swipe down | ctrl+alt+Down | switch to above 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 down4 | 4-finger swipe down | ctrl+alt+shift+Up | move window to above workpace
Taken from `man xdotool`: Taken from `man xdotool`:
@@ -127,18 +126,4 @@ Download the `uninstall` script then run `bash uninstall`
## Bug Reports ## Bug Reports
Search in [Issues](https://github.com/Hikari9/comfortable-swipe/issues?utf8=%E2%9C%93&q=is%3Aissue) if the problem has already been solved. Create an issue [here](https://github.com/Hikari9/comfortable-swipe-ubuntu/issues/new) to report a bug.
Otherwise, [create a new issue](https://github.com/Hikari9/comfortable-swipe/issues/new) to report your bug.
Please include the output of the following:
1. `lsb_release -a`
2. `g++ --version`
3. `ls -l /dev/input/event*`
3. `xinput list | grep touchpad -i`
4. `lsmod | grep hid`
5. `comfortable-swipe status`
6. `comfortable-swipe start` (if you can run it)
7. `comfortable-swipe debug` (try swiping if you can see `GESTURE_SWIPE_XXX`)
8. `cat $(comfortable-swipe config)`
-1
View File
@@ -1 +0,0 @@
v1.0.4
+1 -6
View File
@@ -1,7 +1,2 @@
#!/bin/sh #!/bin/sh
dir="$(dirname $0)" g++ $(dirname $0)/comfortable-swipe.cpp -std=c++11 -O2 -lxdo -Wno-unused-result -o $1
g++ "$dir/comfortable-swipe.cpp" \
-o "$1" \
-std=c++11 \
-O2 -lxdo -Wno-unused-result \
-DCOMFORTABLE_SWIPE_VERSION="\"$(cat $dir/VERSION | tr -d '[:space:]')\""
+49 -60
View File
@@ -1,30 +1,27 @@
#!/bin/bash #!/bin/bash
# prefer running as root
DIR=$(dirname $0)
PROGRAM=/usr/local/bin/comfortable-swipe
COMPILE=$DIR/comfortable-swipe.compile.sh
CONF_PATH=/usr/local/share/comfortable-swipe/comfortable-swipe.conf
DCONF_PATH=$DIR/defaults.conf
OLD_CONF_PATH=${XDG_CONFIG_HOME:-$HOME/.config}/comfortable-swipe.conf
function install { if [ -x "$(command -v $PROGRAM)" ]; then
# prefer running as root # stop any running comfortable-swipe if it exists
local dir="$(dirname $0)" $PROGRAM stop
local program=comfortable-swipe fi
local program_exe=/usr/local/bin/$program
local compile_command="$dir/$program.compile.sh"
local conf_path=/usr/local/share/$program/$program.conf
local dconf_path="$dir/defaults.conf"
local old_conf_path="${XDG_CONFIG_HOME:-$HOME/.config}/$program.conf"
if [ -x "$(command -v $program_exe)" ]; then #copy config file
# stop any running $program if it exists abort () {
$program_exe stop
fi
#copy config file
abort () {
exec echo "Installation aborted" exec echo "Installation aborted"
} }
sudo mkdir -p "$(dirname $conf_path)" || abort sudo mkdir -p $(dirname $CONF_PATH) || abort
# check if "-y" or "--yes" is passed as an argument # check if "-y" or "--yes" is passed as an argument
YES=false YES=false
while test $# -gt 0 while test $# -gt 0
do do
case "$1" in case "$1" in
-y) YES=true -y) YES=true
;; ;;
@@ -32,62 +29,54 @@ function install {
;; ;;
esac esac
shift shift
done done
sudo chown $USER "$(dirname $conf_path)" sudo chown $USER $(dirname $CONF_PATH)
if [ ! -f "$conf_path" ]; then if [ ! -f $CONF_PATH ]; then
if [ ! -f "$old_conf_path" ]; then if [ ! -f $OLD_CONF_PATH ]; then
# old config file not found, create from scratch # old config file not found, create from scratch
cat "$dconf_path" > "$conf_path" || abort cat $DCONF_PATH > $CONF_PATH || abort
else else
# old config file found, move to the new path # old config file found, move to the new path
cat "$old_conf_path" > "$conf_path" || abort cat $OLD_CONF_PATH > $CONF_PATH || abort
echo "Configuration copied from $old_conf_path to $conf_path" echo "Configuration copied from $OLD_CONF_PATH to $CONF_PATH"
fi fi
else else
# config file found, ask user if overwrite # config file found, ask user if overwrite
echo "Old conf file found in $conf_path" echo "Old conf file found in $CONF_PATH"
if [ "$YES" == false ]; then if [ $YES == false ]; then
read -r -p "Keep the old conf file? (default: yes) [Y/n] " response read -r -p "Keep the old conf file? (default: yes) [Y/n] " response
response="${response,,}" # tolower response=${response,,} # tolower
if [[ "$response" =~ ^(no|n)$ ]]; then if [[ "$response" =~ ^(no|n)$ ]]; then
read -r -p "Conf file will be overwritten. Are you sure? [Y/n] " response read -r -p "Conf file will be overwritten. Are you sure? [Y/n] " response
response="${response,,}" response=${response,,}
if [[ "$response" =~ ^(yes|y)$ ]]; then if [[ "$response" =~ ^(yes|y)$ ]]; then
cat "$dconf_path" > "$conf_path" || abort cat $DCONF_PATH > $CONF_PATH || abort
else else
abort abort
fi fi
fi fi
fi fi
fi fi
echo "Installing to $program_exe ..." echo "Installing..."
# remove existing $program # remove existing comfortable-swipe
if [ -x "$(command -v $program_exe)" ]; then if [ -x "$(command -v $PROGRAM)" ]; then
sudo rm -f "$(which $program)" sudo rm -f $(which comfortable-swipe)
fi fi
# compile library # compile library
sudo "$compile_command" "$program_exe" || abort sudo $COMPILE $PROGRAM || abort
# add permissions to input group (defer) # add permissions to input group (defer)
# 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
# turn on autostart by default # toggle autostart twice to refresh any changes
local autostart_status="$($program_exe autostart)" $PROGRAM autostart > /dev/null || abort
if [[ "$autostart_status" == *off* ]]; then $PROGRAM autostart > /dev/null || abort
autostart_status="$($program_exe autostart)"
fi
echo "Successfully installed $program $(cat $dir/VERSION | tr -d '[:space:]')" echo "Successfully installed comfortable-swipe."
echo "" echo "Configuration file is located at $CONF_PATH"
echo "$autostart_status" echo ""
echo "Edit configuration file: gedit \$($program config)" echo "Try running 'comfortable-swipe start' to test."
echo ""
echo "Try running: $program start"
}
install
unset -f install
+1 -2
View File
@@ -177,8 +177,7 @@ namespace comfortable_swipe::gesture
else else
{ {
// not swiping, check if swipe will begin // not swiping, check if swipe will begin
if (std::regex_match(line, matches, gesture_swipe_begin) != 0 if (std::regex_match(line, matches, gesture_swipe_begin) != 0)
|| std::regex_match(line, matches, gesture_swipe_update) != 0)
{ {
// assign necessary variables for swipe begin // assign necessary variables for swipe begin
this->flag_swiping = true; this->flag_swiping = true;
-5
View File
@@ -28,11 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define __COMFORTABLE_SWIPE__CONFIG__ "/usr/local/share/comfortable-swipe/comfortable-swipe.conf" #define __COMFORTABLE_SWIPE__CONFIG__ "/usr/local/share/comfortable-swipe/comfortable-swipe.conf"
#endif /* __COMFORTABLE_SWIPE__CONFIG__ */ #endif /* __COMFORTABLE_SWIPE__CONFIG__ */
#ifndef COMFORTABLE_SWIPE_VERSION
#warning COMFORTABLE_SWIPE_VERSION is not defined
#define COMFORTABLE_SWIPE_VERSION "v(UNKNOWN)"
#endif /* COMFORTABLE_SWIPE_VERSION */
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
+1 -1
View File
@@ -30,7 +30,7 @@ namespace comfortable_swipe::service
void help() void help()
{ {
using comfortable_swipe::util::conf_filename; using comfortable_swipe::util::conf_filename;
std::puts("comfortable-swipe " COMFORTABLE_SWIPE_VERSION " [start|stop|restart|autostart|buffer|help|config|debug|status]"); std::puts("comfortable-swipe [start|stop|restart|autostart|buffer|help|config|debug|status]");
std::puts(""); std::puts("");
std::puts("start - starts 3/4-finger gesture service"); std::puts("start - starts 3/4-finger gesture service");
std::puts("stop - stops 3/4-finger gesture service"); std::puts("stop - stops 3/4-finger gesture service");
+7 -5
View File
@@ -50,13 +50,19 @@ namespace comfortable_swipe::service
auto autostart_f = comfortable_swipe::util::autostart_filename(); auto autostart_f = comfortable_swipe::util::autostart_filename();
bool autostart_on = access(autostart_f, F_OK) != -1; bool autostart_on = access(autostart_f, F_OK) != -1;
std::puts(comfortable_swipe::util::conf_filename()); // print status
std::printf("program is %s\n", running ? "ON" : "OFF");
std::printf("autostart is %s\n", autostart_on ? "ON" : "OFF");
std::printf("config file at %s\n", comfortable_swipe::util::conf_filename());
// check status of configuration file // check status of configuration file
try try
{ {
auto config = comfortable_swipe::util::read_config_file(comfortable_swipe::util::conf_filename()); auto config = comfortable_swipe::util::read_config_file(comfortable_swipe::util::conf_filename());
// print keys and values of config file
std::printf("\nConfigurations:\n");
// print threshold // print threshold
if (config.count("threshold") > 0) if (config.count("threshold") > 0)
{ {
@@ -85,10 +91,6 @@ namespace comfortable_swipe::service
{ {
std::printf("config error: %s\n", e.what()); std::printf("config error: %s\n", e.what());
} }
// print status
std::printf("autostart is %s\n", autostart_on ? "ON" : "OFF");
std::printf("comfortable-swipe program is %s\n", running ? "RUNNING" : "STOPPED");
} }
} }