Travis (#62)
* Use a requirements.txt * Add initial travis configuration * Attempt fix travis configuration * Attempt fix g++ error * Bugfix missing path dir on autostart * Attempt install build-essential instead of g++ * Add missing psutil from requirements * Modify README * Attempt fix build errors in travis * Update README * Add simple build badges
This commit is contained in:
parent
adcb3d5e02
commit
044e215d97
25
.travis.yml
Normal file
25
.travis.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
dist: xenial
|
||||||
|
language: python
|
||||||
|
sudo: required
|
||||||
|
python:
|
||||||
|
- 2.7
|
||||||
|
- 3.5
|
||||||
|
- 3.6
|
||||||
|
- 3.7
|
||||||
|
- 3.8-dev
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
update: true
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
- libxdo-dev
|
||||||
|
- libinput-tools
|
||||||
|
- g++-7
|
||||||
|
env:
|
||||||
|
CC: gcc-7
|
||||||
|
CXX: g++-7
|
||||||
|
install:
|
||||||
|
- pip install .
|
||||||
|
script:
|
||||||
|
- python setup.py test
|
||||||
172
README.md
172
README.md
@ -1,30 +1,62 @@
|
|||||||
# Comfortable Swipe (Ubuntu)
|
# Comfortable Swipe (Debian/Ubuntu)
|
||||||
[](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`.
|
[](https://github.com/Hikari9/comfortable-swipe/releases)
|
||||||
|
[](https://github.com/Hikari9/comfortable-swipe/commits/master)
|
||||||
|
[](https://github.com/Hikari9/comfortable-swipe/commits/develop)
|
||||||
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||||
|
|
||||||
|
Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures. Tested in Ubuntu 14.04 LTS and beyond, for Unity, GNOME, and KDE desktop environments.
|
||||||
|
|
||||||
|
> **Note**: May work for other Linux distros that support `libinput` and `libxdo` (untested).
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Install Python3, libinput, and g++
|
1. Update and install essential tools and libraries
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt-get install git python3-dev libinput-tools libxdo-dev
|
sudo apt update && sudo apt install git g++-7 python3-pip libinput-tools libxdo-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Clone this repository
|
2. Install `comfortable-swipe` for your user
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/Hikari9/comfortable-swipe-ubuntu.git
|
pip3 install --user git+https://github.com/Hikari9/comfortable-swipe
|
||||||
cd comfortable-swipe-ubuntu
|
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Install
|
3. You can check status with `comfortable-swipe status`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash install
|
$> comfortable-swipe status
|
||||||
|
usr/local/share/comfortable-swipe/comfortable-swipe.conf
|
||||||
|
threshold = 0.0
|
||||||
|
left3 = ctrl+alt+Right
|
||||||
|
left4 = ctrl+alt+shift+Right
|
||||||
|
right3 = ctrl+alt+Left
|
||||||
|
right4 = ctrl+alt+shift+Left
|
||||||
|
up3 = ctrl+alt+Down
|
||||||
|
up4 = ctrl+alt+shift+Down
|
||||||
|
down3 = ctrl+alt+Up
|
||||||
|
down4 = ctrl+alt+shift+Up
|
||||||
|
autostart is ON
|
||||||
|
comfortable-swipe program is STOPPED
|
||||||
```
|
```
|
||||||
|
|
||||||
4. You may delete the downloaded `comfortable-swipe-ubuntu` folder after installation.
|
3. You can list down all commands with `comfortable-swipe` or `comfortable-swipe help`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$> comfortable-swipe
|
||||||
|
comfortable-swipe [start|stop|restart|autostart|buffer|help|config|debug|status]
|
||||||
|
|
||||||
|
start - starts 3/4-finger gesture service
|
||||||
|
stop - stops 3/4-finger gesture service
|
||||||
|
restart - stops then starts 3/4-finger gesture service
|
||||||
|
autostart - automatically run on startup (toggleable)
|
||||||
|
buffer - parses output of libinput debug-events
|
||||||
|
help - shows the help dialog
|
||||||
|
config - locates the config file
|
||||||
|
debug - logs raw output from input events taken from libinput
|
||||||
|
status - checks status of program and autostart
|
||||||
|
```
|
||||||
|
|
||||||
## How to Run
|
## How to Run
|
||||||
|
|
||||||
@ -33,27 +65,84 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
|
|||||||
sudo gpasswd -a $USER $(ls -l /dev/input/event* | awk '{print $4}' | head --line=1)
|
sudo gpasswd -a $USER $(ls -l /dev/input/event* | awk '{print $4}' | head --line=1)
|
||||||
```
|
```
|
||||||
2. ***Important***: After inputing your `sudo` password, log out then log back in
|
2. ***Important***: After inputing your `sudo` password, log out then log back in
|
||||||
3. Run
|
3. By default, comfortable-swipe should be running. Otherwise, run:
|
||||||
```
|
```bash
|
||||||
comfortable-swipe start
|
comfortable-swipe start
|
||||||
```
|
```
|
||||||
4. _Optional_: Automatically run on startup
|
You can see if gestures work correctly if you see `SWIPE xxx` in the output:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$> comfortable-swipe start
|
||||||
|
SWIPE left3
|
||||||
|
SWIPE right3
|
||||||
|
...
|
||||||
```
|
```
|
||||||
comfortable-swipe autostart
|
|
||||||
|
## How to Upgrade
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip3 install -U --user git+https://github.com/Hikari9/comfortable-swipe
|
||||||
|
```
|
||||||
|
|
||||||
|
## Uninstall
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Uncomment below to COMPLETELY remove configurations (not recommended)
|
||||||
|
# rm $(comfortable-swipe config)
|
||||||
|
|
||||||
|
pip3 uninstall comfortable-swipe
|
||||||
|
```
|
||||||
|
|
||||||
|
## Other Commands
|
||||||
|
|
||||||
|
1. `comfortable-swipe config` - outputs location of configuration file
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$> comfortable-swipe config
|
||||||
|
/usr/local/share/comfortable-swipe/comfortable-swipe.conf
|
||||||
```
|
```
|
||||||
5. Check the status of your application by running
|
|
||||||
|
2. `comfortable-swipe autostart` - Toggles autostart
|
||||||
|
```bash
|
||||||
|
$> comfortable-swipe autostart
|
||||||
|
Autostart switched off
|
||||||
```
|
```
|
||||||
comfortable-swipe status
|
|
||||||
|
3. `comfortable-swipe debug` - Debugs input (this is an unbuffered alias of `libinput debug-events`)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$> comfortable-swipe debug
|
||||||
|
...
|
||||||
|
-event9 DEVICE_ADDED TouchPad seat0 default group7 cap:pg size 70x50mm tap(dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on
|
||||||
|
...
|
||||||
|
event9 GESTURE_SWIPE_BEGIN +2.03s 3
|
||||||
|
event9 GESTURE_SWIPE_UPDATE +2.03s 3 -9.95/ 2.64 (-26.90/ 7.12 unaccelerated)
|
||||||
|
event9 GESTURE_SWIPE_UPDATE +2.03s 3 -10.44/ 3.19 (-28.22/ 8.62 unaccelerated)
|
||||||
|
event9 GESTURE_SWIPE_UPDATE +2.04s 3 -9.71/ 2.64 (-26.25/ 7.12 unaccelerated)
|
||||||
|
event9 GESTURE_SWIPE_UPDATE +2.05s 3 -8.98/ 2.64 (-24.28/ 7.12 unaccelerated)
|
||||||
|
event9 GESTURE_SWIPE_UPDATE +2.06s 3 -7.40/ 2.36 (-20.01/ 6.37 unaccelerated)
|
||||||
|
event9 GESTURE_SWIPE_UPDATE +2.06s 3 -6.31/ 2.50 (-17.06/ 6.75 unaccelerated)
|
||||||
|
event9 GESTURE_SWIPE_UPDATE +2.07s 3 -5.34/ 1.80 (-14.44/ 4.87 unaccelerated)
|
||||||
|
event9 GESTURE_SWIPE_UPDATE +2.08s 3 -4.61/ 2.08 (-12.47/ 5.62 unaccelerated)
|
||||||
|
event9 GESTURE_SWIPE_UPDATE +2.09s 3 -4.49/ 1.53 (-12.14/ 4.12 unaccelerated)
|
||||||
|
event9 GESTURE_SWIPE_UPDATE +2.09s 3 -4.01/ 1.25 (-10.83/ 3.37 unaccelerated)
|
||||||
|
event9 GESTURE_SWIPE_UPDATE +2.10s 3 -4.13/ 0.42 (-11.15/ 1.12 unaccelerated)
|
||||||
|
event9 GESTURE_SWIPE_END +2.11s 3
|
||||||
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you can see `GESTURE_SWIPE_XXX` in your output, that means your touchpad supports multi-touch 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
|
||||||
```
|
|
||||||
nano $(comfortable-swipe config)
|
```bash
|
||||||
|
gedit $(comfortable-swipe config)
|
||||||
```
|
```
|
||||||
|
|
||||||
Make sure to run after making changes:
|
Make sure to restart after making changes:
|
||||||
```
|
```bash
|
||||||
comfortable-swipe restart
|
comfortable-swipe restart
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -85,45 +174,6 @@ Taken from `man xdotool`:
|
|||||||
|
|
||||||
Refer to https://www.linux.org/threads/xdotool-keyboard.10528/ for a complete list of keycodes you can use.
|
Refer to https://www.linux.org/threads/xdotool-keyboard.10528/ for a complete list of keycodes you can use.
|
||||||
|
|
||||||
|
|
||||||
## Debugging
|
|
||||||
|
|
||||||
You can check your touchpad driver by running
|
|
||||||
|
|
||||||
```bash
|
|
||||||
comfortable-swipe debug
|
|
||||||
```
|
|
||||||
|
|
||||||
This is an alias of `libinput debug-events`. This logs all gestures you make on your touchpad, along with other input-based events that can be captured by libinput.
|
|
||||||
|
|
||||||
A working swipe gesture will show the following:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ comfortable-swipe debug
|
|
||||||
...
|
|
||||||
-event9 DEVICE_ADDED TouchPad seat0 default group7 cap:pg size 70x50mm tap(dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on
|
|
||||||
...
|
|
||||||
event9 GESTURE_SWIPE_BEGIN +2.03s 3
|
|
||||||
event9 GESTURE_SWIPE_UPDATE +2.03s 3 -9.95/ 2.64 (-26.90/ 7.12 unaccelerated)
|
|
||||||
event9 GESTURE_SWIPE_UPDATE +2.03s 3 -10.44/ 3.19 (-28.22/ 8.62 unaccelerated)
|
|
||||||
event9 GESTURE_SWIPE_UPDATE +2.04s 3 -9.71/ 2.64 (-26.25/ 7.12 unaccelerated)
|
|
||||||
event9 GESTURE_SWIPE_UPDATE +2.05s 3 -8.98/ 2.64 (-24.28/ 7.12 unaccelerated)
|
|
||||||
event9 GESTURE_SWIPE_UPDATE +2.06s 3 -7.40/ 2.36 (-20.01/ 6.37 unaccelerated)
|
|
||||||
event9 GESTURE_SWIPE_UPDATE +2.06s 3 -6.31/ 2.50 (-17.06/ 6.75 unaccelerated)
|
|
||||||
event9 GESTURE_SWIPE_UPDATE +2.07s 3 -5.34/ 1.80 (-14.44/ 4.87 unaccelerated)
|
|
||||||
event9 GESTURE_SWIPE_UPDATE +2.08s 3 -4.61/ 2.08 (-12.47/ 5.62 unaccelerated)
|
|
||||||
event9 GESTURE_SWIPE_UPDATE +2.09s 3 -4.49/ 1.53 (-12.14/ 4.12 unaccelerated)
|
|
||||||
event9 GESTURE_SWIPE_UPDATE +2.09s 3 -4.01/ 1.25 (-10.83/ 3.37 unaccelerated)
|
|
||||||
event9 GESTURE_SWIPE_UPDATE +2.10s 3 -4.13/ 0.42 (-11.15/ 1.12 unaccelerated)
|
|
||||||
event9 GESTURE_SWIPE_END +2.11s 3
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
If you can see `GESTURE_SWIPE_XXX` in your output, that means your touchpad supports multi-touch swipe gestures.
|
|
||||||
|
|
||||||
## Uninstall
|
|
||||||
Download the `uninstall` script then run `bash uninstall`
|
|
||||||
|
|
||||||
|
|
||||||
## Bug Reports
|
## Bug Reports
|
||||||
|
|
||||||
Create an issue [here](https://github.com/Hikari9/comfortable-swipe-ubuntu/issues/new) to report a bug.
|
Create an issue [here](https://github.com/Hikari9/comfortable-swipe-ubuntu/issues/new) to report a bug.
|
||||||
|
|||||||
@ -45,6 +45,11 @@ def get_status():
|
|||||||
# sets the autostart status
|
# sets the autostart status
|
||||||
def set_status(status=ON):
|
def set_status(status=ON):
|
||||||
if status == ON:
|
if status == ON:
|
||||||
|
# make sure dir exists
|
||||||
|
path = target_path()
|
||||||
|
path_dir = os.path.dirname(path)
|
||||||
|
if not os.path.exists(path_dir):
|
||||||
|
os.makedirs(path_dir)
|
||||||
with open(target_path(), 'w') as file:
|
with open(target_path(), 'w') as file:
|
||||||
file.write(template())
|
file.write(template())
|
||||||
elif status == OFF:
|
elif status == OFF:
|
||||||
|
|||||||
@ -32,8 +32,10 @@ extern "C"
|
|||||||
// CURRENT_WINDOW
|
// CURRENT_WINDOW
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace comfortable_swipe::gesture
|
namespace comfortable_swipe
|
||||||
{
|
{
|
||||||
|
namespace gesture
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Constructs a new swipe gesture, given configurations for certain swipe events.
|
* Constructs a new swipe gesture, given configurations for certain swipe events.
|
||||||
*/
|
*/
|
||||||
@ -208,6 +210,7 @@ namespace comfortable_swipe::gesture
|
|||||||
"down3",
|
"down3",
|
||||||
"down4"
|
"down4"
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture__ */
|
#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture__ */
|
||||||
|
|||||||
@ -21,12 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include "xdo_gesture.h"
|
#include "xdo_gesture.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
namespace comfortable_swipe
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace comfortable_swipe::gesture
|
|
||||||
{
|
{
|
||||||
|
namespace gesture
|
||||||
|
{
|
||||||
class swipe_gesture : protected xdo_gesture
|
class swipe_gesture : protected xdo_gesture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -81,10 +79,7 @@ namespace comfortable_swipe::gesture
|
|||||||
static const char* GESTURE_UPDATE_REGEX_PATTERN;
|
static const char* GESTURE_UPDATE_REGEX_PATTERN;
|
||||||
static const char* GESTURE_END_REGEX_PATTERN;
|
static const char* GESTURE_END_REGEX_PATTERN;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__ */
|
#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__ */
|
||||||
|
|||||||
@ -21,8 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include "swipe_gesture.h"
|
#include "swipe_gesture.h"
|
||||||
|
|
||||||
namespace comfortable_swipe::gesture
|
namespace comfortable_swipe
|
||||||
{
|
{
|
||||||
|
namespace gesture
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Regex pattern for the libinput entry for start of swipe.
|
* Regex pattern for the libinput entry for start of swipe.
|
||||||
* Extracts one match for the number of fingers used during the swipe.
|
* Extracts one match for the number of fingers used during the swipe.
|
||||||
@ -86,6 +88,7 @@ namespace comfortable_swipe::gesture
|
|||||||
#undef CF_NUMBER_DIVISION
|
#undef CF_NUMBER_DIVISION
|
||||||
#undef CF_NUMBER_EXTRACT
|
#undef CF_NUMBER_EXTRACT
|
||||||
#undef CF_NUMBER_REGEX
|
#undef CF_NUMBER_REGEX
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_regex__ */
|
#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_regex__ */
|
||||||
|
|||||||
@ -26,8 +26,10 @@ extern "C"
|
|||||||
|
|
||||||
#include "xdo_gesture.h"
|
#include "xdo_gesture.h"
|
||||||
|
|
||||||
namespace comfortable_swipe::gesture
|
namespace comfortable_swipe
|
||||||
{
|
{
|
||||||
|
namespace gesture
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Constructs a new gesture handler with xdo.
|
* Constructs a new gesture handler with xdo.
|
||||||
*/
|
*/
|
||||||
@ -42,6 +44,7 @@ namespace comfortable_swipe::gesture
|
|||||||
{
|
{
|
||||||
xdo_free(this->xdo);
|
xdo_free(this->xdo);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __COMFORTABLE_SWIPE__xdo_gesture__ */
|
#endif /* __COMFORTABLE_SWIPE__xdo_gesture__ */
|
||||||
|
|||||||
@ -4,10 +4,8 @@
|
|||||||
#include <map> // std::map
|
#include <map> // std::map
|
||||||
#include <string> // std::string
|
#include <string> // std::string
|
||||||
|
|
||||||
extern "C"
|
namespace comfortable_swipe
|
||||||
{
|
{
|
||||||
namespace comfortable_swipe
|
|
||||||
{
|
|
||||||
namespace service
|
namespace service
|
||||||
{
|
{
|
||||||
void buffer();
|
void buffer();
|
||||||
@ -18,7 +16,6 @@ extern "C"
|
|||||||
void stop();
|
void stop();
|
||||||
void status();
|
void status();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __COMFORTABLE_SWIPE__service_index_hpp__ */
|
#endif /* __COMFORTABLE_SWIPE__service_index_hpp__ */
|
||||||
|
|||||||
@ -2,11 +2,18 @@
|
|||||||
#define __COMFORTABLE_SWIPE__service_python__
|
#define __COMFORTABLE_SWIPE__service_python__
|
||||||
|
|
||||||
#include "_index.hpp"
|
#include "_index.hpp"
|
||||||
#include <Python.h>
|
extern "C"
|
||||||
|
{
|
||||||
|
#include <Python.h>
|
||||||
|
}
|
||||||
|
|
||||||
// export as python module
|
// export as python module
|
||||||
namespace comfortable_swipe::service::python
|
namespace comfortable_swipe
|
||||||
{
|
{
|
||||||
|
namespace service
|
||||||
|
{
|
||||||
|
namespace python
|
||||||
|
{
|
||||||
#define __comfortable_swipe_void_method(method) \
|
#define __comfortable_swipe_void_method(method) \
|
||||||
static PyObject * \
|
static PyObject * \
|
||||||
method(PyObject * self, PyObject * args) \
|
method(PyObject * self, PyObject * args) \
|
||||||
@ -56,6 +63,8 @@ namespace comfortable_swipe::service::python
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
PyObject * module;
|
PyObject * module;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize module
|
// initialize module
|
||||||
|
|||||||
@ -21,8 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include <cstdlib> // std::system
|
#include <cstdlib> // std::system
|
||||||
|
|
||||||
namespace comfortable_swipe::service
|
namespace comfortable_swipe
|
||||||
{
|
{
|
||||||
|
namespace service
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Debugs output from `libinput debug-events`.
|
* Debugs output from `libinput debug-events`.
|
||||||
*/
|
*/
|
||||||
@ -30,6 +32,7 @@ namespace comfortable_swipe::service
|
|||||||
{
|
{
|
||||||
(void) std::system("bash -c \"stdbuf -oL -e0 libinput debug-events 2> >(grep -v 'double tracking')\"");
|
(void) std::system("bash -c \"stdbuf -oL -e0 libinput debug-events 2> >(grep -v 'double tracking')\"");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __COMFORTABLE_SWIPE__service_debug__ */
|
#endif /* __COMFORTABLE_SWIPE__service_debug__ */
|
||||||
|
|||||||
@ -21,8 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include <cstdio> // std::puts, std::printf
|
#include <cstdio> // std::puts, std::printf
|
||||||
|
|
||||||
namespace comfortable_swipe::service
|
namespace comfortable_swipe
|
||||||
{
|
{
|
||||||
|
namespace service
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Shows the help window.
|
* Shows the help window.
|
||||||
*/
|
*/
|
||||||
@ -40,6 +42,7 @@ namespace comfortable_swipe::service
|
|||||||
std::puts("debug - logs raw output from input events taken from libinput");
|
std::puts("debug - logs raw output from input events taken from libinput");
|
||||||
std::puts("status - checks status of program and autostart");
|
std::puts("status - checks status of program and autostart");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __COMFORTABLE_SWIPE__service_help__ */
|
#endif /* __COMFORTABLE_SWIPE__service_help__ */
|
||||||
|
|||||||
@ -21,8 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include "../service/_index.hpp"
|
#include "../service/_index.hpp"
|
||||||
|
|
||||||
namespace comfortable_swipe::service
|
namespace comfortable_swipe
|
||||||
{
|
{
|
||||||
|
namespace service
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Restarts the comfortable-swipe service.
|
* Restarts the comfortable-swipe service.
|
||||||
*/
|
*/
|
||||||
@ -31,6 +33,7 @@ namespace comfortable_swipe::service
|
|||||||
comfortable_swipe::service::stop();
|
comfortable_swipe::service::stop();
|
||||||
comfortable_swipe::service::start();
|
comfortable_swipe::service::start();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __COMFORTABLE_SWIPE__service_restart__ */
|
#endif /* __COMFORTABLE_SWIPE__service_restart__ */
|
||||||
|
|||||||
@ -24,8 +24,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include <cstdlib> // std::system
|
#include <cstdlib> // std::system
|
||||||
#include <unistd.h> // pipe, fork, perror, exit
|
#include <unistd.h> // pipe, fork, perror, exit
|
||||||
|
|
||||||
namespace comfortable_swipe::service
|
namespace comfortable_swipe
|
||||||
{
|
{
|
||||||
|
namespace service
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Starts the comfortable-swipe service by buffering libinput debug-events.
|
* Starts the comfortable-swipe service by buffering libinput debug-events.
|
||||||
* This method is deferred. Please refer to comfortable_swipe::service::buffer()
|
* This method is deferred. Please refer to comfortable_swipe::service::buffer()
|
||||||
@ -58,6 +60,7 @@ namespace comfortable_swipe::service
|
|||||||
}
|
}
|
||||||
comfortable_swipe::service::stop();
|
comfortable_swipe::service::stop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __COMFORTABLE_SWIPE__service_start__ */
|
#endif /* __COMFORTABLE_SWIPE__service_start__ */
|
||||||
|
|||||||
@ -30,8 +30,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include <cstdio> // FILE, std::feof, std::fgets, std::printf
|
#include <cstdio> // FILE, std::feof, std::fgets, std::printf
|
||||||
#include <regex> // std::cmatch, std::regex, std::regex_match
|
#include <regex> // std::cmatch, std::regex, std::regex_match
|
||||||
|
|
||||||
namespace comfortable_swipe::service
|
namespace comfortable_swipe
|
||||||
{
|
{
|
||||||
|
namespace service
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Prints the status of comfortable-swipe.
|
* Prints the status of comfortable-swipe.
|
||||||
*/
|
*/
|
||||||
@ -70,6 +72,7 @@ namespace comfortable_swipe::service
|
|||||||
std::printf("config error: %s\n", e.what());
|
std::printf("config error: %s\n", e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __COMFORTABLE_SWIPE__service_restart__ */
|
#endif /* __COMFORTABLE_SWIPE__service_restart__ */
|
||||||
|
|||||||
@ -29,8 +29,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include <cstdlib> // std::atoi
|
#include <cstdlib> // std::atoi
|
||||||
#include <cstdio> // FILE, std::feof, std::fgets
|
#include <cstdio> // FILE, std::feof, std::fgets
|
||||||
|
|
||||||
namespace comfortable_swipe::service
|
namespace comfortable_swipe
|
||||||
{
|
{
|
||||||
|
namespace service
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Stops all comfortable-swipe instances.
|
* Stops all comfortable-swipe instances.
|
||||||
*/
|
*/
|
||||||
@ -65,6 +67,7 @@ namespace comfortable_swipe::service
|
|||||||
// run "kill {pid1} {pid2}..."
|
// run "kill {pid1} {pid2}..."
|
||||||
(void) std::system(kill.data());
|
(void) std::system(kill.data());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __COMFORTABLE_SWIPE__service_stop__ */
|
#endif /* __COMFORTABLE_SWIPE__service_stop__ */
|
||||||
|
|||||||
@ -4,15 +4,12 @@
|
|||||||
#include <map> // std::map
|
#include <map> // std::map
|
||||||
#include <string> // std::string
|
#include <string> // std::string
|
||||||
|
|
||||||
extern "C"
|
namespace comfortable_swipe
|
||||||
{
|
{
|
||||||
namespace comfortable_swipe
|
|
||||||
{
|
|
||||||
namespace util
|
namespace util
|
||||||
{
|
{
|
||||||
std::map<std::string, std::string> read_config_file(const char*);
|
std::map<std::string, std::string> read_config_file(const char*);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __COMFORTABLE_SWIPE__util_index_hpp__ */
|
#endif /* __COMFORTABLE_SWIPE__util_index_hpp__ */
|
||||||
|
|||||||
@ -22,14 +22,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include <map> // std::map
|
#include <map> // std::map
|
||||||
#include <string> // std::string
|
#include <string> // std::string
|
||||||
#include <fstream> // std::ifstream
|
#include <fstream> // std::ifstream
|
||||||
#include <sstream> // std::ostringstream
|
|
||||||
#include <iostream> // std::endl, std::getline
|
#include <iostream> // std::endl, std::getline
|
||||||
|
#include <sstream> // std::ostringstream
|
||||||
#include <cstdlib> // exit
|
#include <cstdlib> // exit
|
||||||
#include <cctype> // std::isspace
|
#include <cctype> // std::isspace
|
||||||
#include <stdexcept> // std::runtime_error
|
#include <stdexcept> // std::runtime_error
|
||||||
|
|
||||||
namespace comfortable_swipe::util
|
namespace comfortable_swipe
|
||||||
{
|
{
|
||||||
|
namespace util
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* A utility method for reading the config file.
|
* A utility method for reading the config file.
|
||||||
*
|
*
|
||||||
@ -39,7 +41,7 @@ namespace comfortable_swipe::util
|
|||||||
{
|
{
|
||||||
|
|
||||||
std::map<std::string, std::string> conf;
|
std::map<std::string, std::string> conf;
|
||||||
std::ifstream fin(filename);
|
std::ifstream fin(filename, std::ios::in);
|
||||||
|
|
||||||
if (!fin.is_open())
|
if (!fin.is_open())
|
||||||
{
|
{
|
||||||
@ -99,5 +101,7 @@ namespace comfortable_swipe::util
|
|||||||
|
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __COMFORTABLE_SWIPE__util_read_config_file__ */
|
#endif /* __COMFORTABLE_SWIPE__util_read_config_file__ */
|
||||||
|
|||||||
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
psutil==5.6.0
|
||||||
8
setup.py
8
setup.py
@ -54,7 +54,7 @@ try:
|
|||||||
name='{}.cpp.{}'.format(PYTHON_NAME, extension_name),
|
name='{}.cpp.{}'.format(PYTHON_NAME, extension_name),
|
||||||
define_macros=list(cpp_macros.items()),
|
define_macros=list(cpp_macros.items()),
|
||||||
sources=[os.path.join('cpp', '_python.cpp')],
|
sources=[os.path.join('cpp', '_python.cpp')],
|
||||||
extra_compile_args=['-O2', '-Wno-unused-result'],
|
extra_compile_args=['-O2', '-Wno-unused-result', '-std=c++11', '-lstdc++'],
|
||||||
libraries=['xdo']
|
libraries=['xdo']
|
||||||
) for extension_name in extension_names]
|
) for extension_name in extension_names]
|
||||||
|
|
||||||
@ -134,6 +134,10 @@ try:
|
|||||||
bdist_wheel=wrap_command(bdist_wheel)
|
bdist_wheel=wrap_command(bdist_wheel)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# install requiremenh open('requirements.txt', 'r') as requirements:
|
||||||
|
with open('requirements.txt', 'r') as requirements:
|
||||||
|
install_requires = requirements.read().splitlines()
|
||||||
|
|
||||||
# classifiers
|
# classifiers
|
||||||
# https://pypi.org/classifiers/
|
# https://pypi.org/classifiers/
|
||||||
classifiers = [
|
classifiers = [
|
||||||
@ -166,7 +170,7 @@ try:
|
|||||||
entry_points=dict(console_scripts=['{}={}.__main__:main'.format(NAME, PYTHON_NAME)]),
|
entry_points=dict(console_scripts=['{}={}.__main__:main'.format(NAME, PYTHON_NAME)]),
|
||||||
ext_modules=extensions,
|
ext_modules=extensions,
|
||||||
cmdclass=cmdclass,
|
cmdclass=cmdclass,
|
||||||
install_requires=['psutil'],
|
install_requires=install_requires,
|
||||||
classifiers=classifiers
|
classifiers=classifiers
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user