Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9deaf2da2c | ||
|
|
6bd7603694 | ||
|
|
57a6e4f217 | ||
|
|
404e8febcc | ||
|
|
b2d1674ba4 | ||
|
|
548199bc38 | ||
|
|
cb018bf335 |
No files matched your search
@@ -11,7 +11,7 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
|
||||
|
||||
## Installation
|
||||
|
||||
1. Install git and g++
|
||||
1. Install git and g++ ≥ 7.5
|
||||
|
||||
```bash
|
||||
sudo apt install git g++
|
||||
@@ -50,7 +50,7 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
|
||||
|
||||
## List of Commands
|
||||
|
||||
1. Start the Program
|
||||
1. **Start the Program**
|
||||
|
||||
```
|
||||
comfortable-swipe start
|
||||
@@ -63,78 +63,13 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
|
||||
Comfortable swipe is RUNNING in the background
|
||||
```
|
||||
|
||||
1. List configurations
|
||||
|
||||
```bash
|
||||
comfortable-swipe config list
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
$ comfortable-swipe config list
|
||||
threshold = 1.0
|
||||
left4 = ctrl+super+shift+Right
|
||||
right3 = ctrl+super+Left
|
||||
right4 = ctrl+super+shift+Left
|
||||
up3 = ctrl+F12
|
||||
up4 = super+d
|
||||
down3 = ctrl+F12
|
||||
down4 = super+d
|
||||
mouse4 = button1
|
||||
left3 = ctrl+super+Right
|
||||
```
|
||||
|
||||
1) Get config
|
||||
1. **Stop the Program**
|
||||
|
||||
```
|
||||
comfortable-swipe <PROPERTY>
|
||||
comfortable-swipe stop
|
||||
```
|
||||
|
||||
Examples:
|
||||
|
||||
```bash
|
||||
$ comfortable-swipe left3
|
||||
ctrl+alt+Right
|
||||
```
|
||||
|
||||
```bash
|
||||
$ comfortable-swipe left4
|
||||
ctrl+alt+shift+Right
|
||||
```
|
||||
|
||||
```bash
|
||||
$ comfortable-swipe threshold
|
||||
1.0
|
||||
```
|
||||
|
||||
1) Set config
|
||||
|
||||
```bash
|
||||
comfortable-swipe <PROPERTY> [=] <VALUES>
|
||||
```
|
||||
|
||||
Examples:
|
||||
|
||||
```bash
|
||||
comfortable-swipe left3 super+Right
|
||||
comfortable-swipe right3 super+Left
|
||||
comfortable-swipe right4 ctrl alt + Left
|
||||
comfortable-swipe down4 super+d
|
||||
comfortable-swipe up3 = ctrl+shift+Up
|
||||
```
|
||||
|
||||
1) Show path to config file:
|
||||
|
||||
```bash
|
||||
$ comfortable-swipe config path
|
||||
/home/hikari9/.config/comfortable-swipe.conf
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Other Commands</summary>
|
||||
|
||||
1. Autostart
|
||||
1. **Toggle Autostart** (optional)
|
||||
|
||||
```bash
|
||||
comfortable-swipe autostart
|
||||
@@ -145,7 +80,72 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
|
||||
comfortable-swipe autostart path
|
||||
```
|
||||
|
||||
1. Configurations
|
||||
1. **Program status**
|
||||
|
||||
```bash
|
||||
comfortable-swipe status
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
$ comfortable-swipe status
|
||||
|
||||
Autostart is ON
|
||||
Program is RUNNING
|
||||
--------------------
|
||||
Configuration: /home/user/.config/comfortable-swipe.conf
|
||||
left3 is VALID (ctrl+super+Right)
|
||||
left4 is VALID (ctrl+super+shift+Right)
|
||||
right3 is VALID (ctrl+super+Left)
|
||||
right4 is VALID (ctrl+super+shift+Left)
|
||||
up3 is VALID (ctrl+F12)
|
||||
up4 is VALID (super+d)
|
||||
down3 is VALID (ctrl+F12)
|
||||
down4 is VALID (super+d)
|
||||
threshold is VALID (1.0)
|
||||
mouse3 is NOTSET
|
||||
mouse4 is NOTSET
|
||||
```
|
||||
|
||||
1. **Get config**
|
||||
|
||||
```
|
||||
comfortable-swipe <PROPERTY>
|
||||
```
|
||||
|
||||
```bash
|
||||
comfortable-swipe left3
|
||||
comfortable-swipe left4
|
||||
comfortable-swipe right3
|
||||
comfortable-swipe right4
|
||||
comfortable-swipe up3
|
||||
comfortable-swipe up4
|
||||
comfortable-swipe down3
|
||||
comfortable-swipe down4
|
||||
comfortable-swipe threshold
|
||||
comfortable-swipe mouse3
|
||||
comfortable-swipe mouse4
|
||||
```
|
||||
|
||||
1. **Set config**
|
||||
|
||||
```bash
|
||||
comfortable-swipe <PROPERTY> [=] <VALUES>
|
||||
```
|
||||
|
||||
```bash
|
||||
comfortable-swipe left3 = super+Right
|
||||
comfortable-swipe right3 = super+Left
|
||||
comfortable-swipe right4 = ctrl+alt+Left
|
||||
comfortable-swipe down4 = super+d
|
||||
comfortable-swipe up3 = ctrl+shift+Up
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><b>Other Commands</b></summary>
|
||||
|
||||
1. All Configuration commands
|
||||
|
||||
```bash
|
||||
comfortable-swipe config list
|
||||
@@ -175,26 +175,60 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
|
||||
...
|
||||
```
|
||||
|
||||
You can also pass `--bare` to attach without actually swiping.
|
||||
1. Test output with `--bare` to attach without actually swiping
|
||||
|
||||
```bash
|
||||
$ comfortable-swipe start --bare
|
||||
SWIPE left3
|
||||
SWIPE left4
|
||||
SWIPE right3
|
||||
SWIPE up3
|
||||
...
|
||||
```
|
||||
|
||||
1. Debug
|
||||
|
||||
```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
|
||||
...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Swipe Gesture Configurations
|
||||
## Gesture Configurations
|
||||
|
||||
The default configuration file is located at `~/.config/comfortable-swipe.conf`.
|
||||
Comfortable swipe makes use of **keyboard shortcuts** to perform swipes, through `xdotool`.
|
||||
|
||||
Edit the configuration file by running:
|
||||
Set a property directly with:
|
||||
|
||||
```
|
||||
comfortable-swipe <PROPERTY> [=] <VALUE>
|
||||
```
|
||||
|
||||
Or edit the configuration file manually:
|
||||
|
||||
```
|
||||
gedit ~/.config/comfortable-swipe.conf
|
||||
```
|
||||
|
||||
After making changes, make sure to restart the program:
|
||||
|
||||
```
|
||||
comfortable-swipe start
|
||||
```
|
||||
After editing, make sure to restart with `comfortable-swipe start`.
|
||||
|
||||
> **Warning**: For v1.1.0 below, the configuration file is located at
|
||||
> `/usr/local/share/comfortable-swipe/comfortable-swipe.conf`
|
||||
@@ -203,19 +237,19 @@ comfortable-swipe start
|
||||
|
||||
## Configuration Reference
|
||||
|
||||
| Key | Value | Defaults |
|
||||
| --------- | :--------------------------------------------------------------------: | ----------------------------------------------------------------- |
|
||||
| left3 | 3-finger swipe left | ctrl+alt+Right |
|
||||
| left4 | 4-finger swipe left | ctrl+alt+shift+Right |
|
||||
| right3 | 3-finger swipe right | ctrl+alt+Left |
|
||||
| right4 | 4-finger swipe right | ctrl+alt+shift+Left |
|
||||
| up3 | 3-finger swipe up | ctrl+alt+Down |
|
||||
| up4 | 4-finger swipe up | ctrl+alt+shift+Down |
|
||||
| down3 | 3-finger swipe down | ctrl+alt+Up |
|
||||
| down4 | 4-finger swipe down | ctrl+alt+shift+Up |
|
||||
| threshold | mouse movement pixels that trigger a swipe (can be as large as 1000.0) | 0.0, 240.0, 1000.0 |
|
||||
| mouse3 | mouses a mouse button when 3 fingers are down | button1 <br> (see [Mouse Gestures](#mouse-gestures-experimental)) | |
|
||||
| mouse4 | mouses a mouse button when 4 fingers are down | button1 <br> (see [Mouse Gestures](#mouse-gestures-experimental) |
|
||||
| Property | Value | Examples |
|
||||
| --------- | :--------------------------------------------------------------------: | ---------------------------------------------------------------------------------- |
|
||||
| left3 | 3-finger swipe left | ctrl+alt+Right |
|
||||
| left4 | 4-finger swipe left | ctrl+alt+shift+Right |
|
||||
| right3 | 3-finger swipe right | ctrl+alt+Left |
|
||||
| right4 | 4-finger swipe right | ctrl+alt+shift+Left |
|
||||
| up3 | 3-finger swipe up | ctrl+alt+Down |
|
||||
| up4 | 4-finger swipe up | ctrl+alt+shift+Down |
|
||||
| down3 | 3-finger swipe down | ctrl+alt+Up |
|
||||
| down4 | 4-finger swipe down | ctrl+alt+shift+Up |
|
||||
| threshold | mouse movement pixels that trigger a swipe (can be as large as 1000.0) | 0.0 / 240.0 / 1000.0 |
|
||||
| mouse3 | mouses a mouse button when 3 fingers are down | button1 / move / scroll<br> _(see [Mouse Gestures](#mouse-gestures-experimental))_ | |
|
||||
| mouse4 | mouses a mouse button when 4 fingers are down | button1 / move / scroll <br> _(see [Mouse Gestures](#mouse-gestures-experimental)_ |
|
||||
|
||||
### Keystrokes
|
||||
|
||||
@@ -235,11 +269,11 @@ Taken from `man xdotool`:
|
||||
|
||||
Refer to https://www.linux.org/threads/xdotool-keyboard.10528/ for a complete list of keycodes you can use.
|
||||
|
||||
Keyboard shortcuts:
|
||||
|
||||
- [DEFKEY - All Linux keyboard shortcuts](https://defkey.com/)
|
||||
- [Unity Keyboard Shortcuts](https://cheatography.com/sapemeg/cheat-sheets/ubuntu-unity-16-04/)
|
||||
- [GNOME Keyboard Shortcuts](https://wiki.gnome.org/Design/OS/KeyboardShortcuts)
|
||||
- [KDE Keyboard Shortcuts](https://community.linuxmint.com/tutorial/view/47)
|
||||
- [PopOS Keyboard Shortcuts](https://support.system76.com/articles/pop-keyboard-shortcuts/)
|
||||
|
||||
## Example Configurations
|
||||
|
||||
@@ -248,92 +282,118 @@ This section includes some example configurations which you can use for your swi
|
||||
1. Switch workspace (horizontal)
|
||||
|
||||
```bash
|
||||
comfortable-swipe config set left3 = ctrl+alt+Right
|
||||
comfortable-swipe config set right3 = ctrl+alt+Left
|
||||
# Ubuntu flavors + GNOME
|
||||
comfortable-swipe left3 = ctrl+alt+Right
|
||||
comfortable-swipe right3 = ctrl+alt+Left
|
||||
```
|
||||
|
||||
1. Switch workspace (vertical)
|
||||
|
||||
```
|
||||
up3 = ctrl+alt+Down
|
||||
down3 = ctrl+alt+Up
|
||||
```bash
|
||||
# Ubuntu flavors + GNOME
|
||||
comfortable-swipe up3 = ctrl+alt+Down
|
||||
comfortable-swipe down3 = ctrl+alt+Up
|
||||
```
|
||||
|
||||
```bash
|
||||
up3 = super+PgDown
|
||||
down3 = super+PgUp
|
||||
# GNOME alt.
|
||||
comfortable-swipe up3 = super+PgDown
|
||||
comfortable-swipe down3 = super+PgUp
|
||||
```
|
||||
|
||||
```bash
|
||||
# Pop OS
|
||||
comfortable-swipe up3 = ctrl+super+Down
|
||||
comfortable-swipe down3 = ctrl+super+Up
|
||||
```
|
||||
|
||||
1. Move window to workspace (horizontal)
|
||||
|
||||
```bash
|
||||
left4 = ctrl+alt+shift+Right
|
||||
right4 = ctrl+alt+shift+Left
|
||||
# Ubuntu flavors + GNOME + Kali
|
||||
comfortable-swipe left4 = ctrl+alt+shift+Right
|
||||
comfortable-swipe right4 = ctrl+alt+shift+Left
|
||||
```
|
||||
|
||||
```bash
|
||||
# Elementary OS
|
||||
comfortable-swipe left4 = super+alt+Right
|
||||
comfortable-swipe right4 = super+alt+Left
|
||||
```
|
||||
|
||||
1. Move window to workspace (vertical)
|
||||
|
||||
```bash
|
||||
up4 = ctrl+alt+shift+Down
|
||||
down4 = ctrl+alt+shift+Up
|
||||
# Ubuntu flavors + GNOME + Kali
|
||||
comfortable-swipe up4 = ctrl+alt+shift+Down
|
||||
comfortable-swipe down4 = ctrl+alt+shift+Up
|
||||
```
|
||||
|
||||
```bash
|
||||
up4 = super+shift+PgDown
|
||||
down4 = super+shift+PgUp
|
||||
# GNOME alt.
|
||||
comfortable-swipe up4 = super+shift+PgDown
|
||||
comfortable-swipe down4 = super+shift+PgUp
|
||||
```
|
||||
|
||||
1. Move window to other monitor
|
||||
|
||||
```bash
|
||||
left4 = super+shift+Right
|
||||
right4 = super+shift+Left
|
||||
# Ubuntu flavors + GNOME
|
||||
comfortable-swipe left4 = super+shift+Right
|
||||
comfortable-swipe right4 = super+shift+Left
|
||||
```
|
||||
|
||||
1. Toggle workspace overview
|
||||
|
||||
```bash
|
||||
up3 = super+s
|
||||
# Ubuntu flavors + Elementary OS
|
||||
comfortable-swipe up3 = super+s
|
||||
```
|
||||
|
||||
```bash
|
||||
# Elementary OS (all workspaces)
|
||||
comfortable-swipe up4 = super+a
|
||||
```
|
||||
|
||||
1. Show desktop
|
||||
|
||||
```bash
|
||||
down3 = super+d
|
||||
# Ubuntu flavors
|
||||
comfortable-swipe down3 = ctrl+super+d
|
||||
```
|
||||
|
||||
```bash
|
||||
down3 = ctrl+super+d
|
||||
# Linux Mint
|
||||
comfortable-swipe down3 = super+d
|
||||
```
|
||||
|
||||
```bash
|
||||
down3 = ctrl+alt+d
|
||||
# Kali
|
||||
comfortable-swipe down3 = ctrl+alt+d
|
||||
```
|
||||
|
||||
```bash
|
||||
# KDE
|
||||
comfortable-swipe down3 = ctrl+F12
|
||||
```
|
||||
|
||||
1. Snap windows to the left/right
|
||||
|
||||
```bash
|
||||
left3 = super+Left
|
||||
right3 = super+Right
|
||||
comfortable-swipe left3 = super+Left
|
||||
comfortable-swipe right3 = super+Right
|
||||
```
|
||||
|
||||
1. Toggle maximize
|
||||
|
||||
```bash
|
||||
up3 = super+Up
|
||||
comfortable-swipe up3 = super+Up
|
||||
```
|
||||
|
||||
1. Toggle minimize
|
||||
|
||||
```bash
|
||||
down3 = super+Down
|
||||
```
|
||||
|
||||
1. Alt+Tab switch application (experimental)
|
||||
|
||||
```bash
|
||||
left3 = alt+Tab
|
||||
right3 = alt+shift+Tab
|
||||
comfortable-swipe down3 = super+Down
|
||||
```
|
||||
|
||||
## Mouse Gestures (Experimental)
|
||||
@@ -359,46 +419,49 @@ Possible Values:
|
||||
- scroll - 3/4 finger natural 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:
|
||||
|
||||
- 3/4-finger drag
|
||||
```bash
|
||||
mouse3 = button1
|
||||
```
|
||||
```bash
|
||||
mouse4 = button1
|
||||
```
|
||||
- 3/4-finger natural scroll
|
||||
✔️ swipes OK
|
||||
⭕ swipes DISABLED
|
||||
|
||||
- 3/4-finger drag ⭕
|
||||
|
||||
```bash
|
||||
mouse3 = scroll
|
||||
comfortable-swipe mouse3 = button1
|
||||
comfortable-swipe mouse4 = button1
|
||||
```
|
||||
|
||||
You can also use `button2` for middle click and `button3` for right click.
|
||||
|
||||
- 3/4-finger natural scroll ⭕
|
||||
|
||||
```bash
|
||||
mouse4 = scroll
|
||||
comfortable-swipe mouse3 = scroll
|
||||
comfortable-swipe mouse4 = scroll
|
||||
```
|
||||
|
||||
- 3/4-finger reverse scroll
|
||||
- 3/4-finger reverse scroll ⭕
|
||||
|
||||
```bash
|
||||
mouse3 = scroll_reverse
|
||||
comfortable-swipe mouse3 = scroll_reverse
|
||||
comfortable-swipe mouse4 = scroll_reverse
|
||||
```
|
||||
|
||||
- Move 3/4-fingers with the cursor ✔️
|
||||
|
||||
```bash
|
||||
mouse4 = scroll_reverse
|
||||
comfortable-swipe mouse3 = move
|
||||
comfortable-swipe mouse4 = move
|
||||
```
|
||||
|
||||
- Move 3/4-fingers with the cursor
|
||||
|
||||
```bash
|
||||
mouse3 = move
|
||||
```
|
||||
|
||||
```bash
|
||||
mouse4 = move
|
||||
```
|
||||
|
||||
**Note**: Applying any mouse-mouse configuration may disable up/left/right/down behavior to avoid gesture conflicts. The logic of this will be improved in the future.
|
||||
> **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.
|
||||
|
||||
## Debugging
|
||||
|
||||
@@ -457,7 +520,9 @@ done with the default bash tools.
|
||||
Running shell commands our **NOT** part of the core features of comfortable-swipe,
|
||||
but through the default bash tools you can _mimic_ this functionality via our program output.
|
||||
|
||||
**Use Case**: _"I want to run `gnome-terminal` if I swipe up with 3 fingers."_
|
||||
<details>
|
||||
<summary> <b>Use Case</b>: <i>"I want to run <code>gnome-terminal</code> if I swipe up with 3 fingers."</i>
|
||||
</summary>
|
||||
|
||||
1. Attach the program to the shell:
|
||||
|
||||
@@ -559,6 +624,8 @@ but through the default bash tools you can _mimic_ this functionality via our pr
|
||||
|
||||
Substitute `<COMMAND>` with the shell command of your choice.
|
||||
|
||||
</details>
|
||||
|
||||
## Uninstall
|
||||
|
||||
Run the following script:
|
||||
|
||||
+45
-9
@@ -173,15 +173,53 @@ function buffer {
|
||||
##########
|
||||
|
||||
|
||||
function _program_running {
|
||||
pgrep -f "$BASENAME" | fgrep -v $$ > /dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
# verbosely show comfortable-swipe status
|
||||
function status {
|
||||
# TODO: show configuration status as well
|
||||
# show autostart status
|
||||
echo "Autostart is $("$BASENAME" autostart status)"
|
||||
if pgrep -f "$BASENAME" | fgrep -v $$ > /dev/null 2>&1; then
|
||||
# show program status
|
||||
if _program_running; then
|
||||
echo "Program is RUNNING"
|
||||
else
|
||||
echo "Program is STOPPED"
|
||||
fi
|
||||
# show configuration status
|
||||
echo --------------------
|
||||
echo "Configuration: $(config path)"
|
||||
mouse3="$(config get mouse3)"
|
||||
mouse4="$(config get mouse4)"
|
||||
for key in $(config keys); do
|
||||
value="$(config get "$key")"
|
||||
if [[ -z "$value" ]]; then
|
||||
vstatus="NOTSET"
|
||||
else
|
||||
vstatus="VALID"
|
||||
if [[ "$key" != mouse* ]]; then
|
||||
if [[ "$key" == *3 && -n "$mouse3" && "$mouse3" != move ]]; then
|
||||
vstatus="DISABLED"
|
||||
elif [[ "$key" == *4 && -n "$mouse4" && "$mouse4" != move ]]; then
|
||||
vstatus="DISABLED"
|
||||
fi
|
||||
fi
|
||||
if [[ "$key" == threshold ]]; then
|
||||
if ! [[ "$value" =~ ^[+-]?[0-9]+\.?[0-9]*$ ]]; then
|
||||
# not a float
|
||||
vstatus="INVALID"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo "$key $vstatus" | awk '{printf "%9s is %7s", $1, $2}'
|
||||
if [[ ! -z "$value" ]]; then
|
||||
echo " ($value)"
|
||||
else
|
||||
echo
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
@@ -291,8 +329,7 @@ function config {
|
||||
local RESULT="$(egrep -v "^\\s*($(echo "$DELETE" | awk '{print $1}' | paste -s -d '|'))\\s*=" "$CONFIG")"
|
||||
echo "$RESULT" > "$CONFIG"
|
||||
# restart comfortable-swipe if it is running
|
||||
if [[ "$(status)" == ON ]]; then
|
||||
stop > /dev/null 2>&1
|
||||
if _program_running; then
|
||||
start > /dev/null
|
||||
fi
|
||||
fi
|
||||
@@ -378,8 +415,7 @@ function config {
|
||||
# show newly set value
|
||||
echo "$KEY = $(get "$KEY")"
|
||||
# restart comfortable-swipe if it is running
|
||||
if [[ "$(status)" == ON ]]; then
|
||||
stop > /dev/null 2>&1
|
||||
if _program_running; then
|
||||
start > /dev/null
|
||||
fi
|
||||
}
|
||||
@@ -451,7 +487,7 @@ function autostart {
|
||||
#####################################
|
||||
# toggle to opposite autostart status
|
||||
function toggle {
|
||||
[[ $(status) = ON ]] && off || on
|
||||
[[ $(status) == ON ]] && off || on
|
||||
}
|
||||
|
||||
######################
|
||||
@@ -495,9 +531,9 @@ else
|
||||
# try to invoke config set / get depending on number of arguments
|
||||
if [[ $# -eq 1 ]]; then
|
||||
# one argument, use shorthand get
|
||||
"$BASENAME" config get "$1" || abort
|
||||
config get "$1" || abort
|
||||
else
|
||||
# multiple arguments, use shorthand set
|
||||
"$BASENAME" config set "$@" 2> /dev/null || abort
|
||||
config set "$@" 2> /dev/null || abort
|
||||
fi
|
||||
fi
|
||||
@@ -92,7 +92,7 @@ int main(int argc, char *argv[]) {
|
||||
float threshold = 0.0f;
|
||||
try {
|
||||
threshold = stof(config["threshold"]);
|
||||
} catch (std::invalid_argument) {
|
||||
} catch (...) {
|
||||
}
|
||||
// create swipe handler
|
||||
gesture_swipe_xdokey keyswipe(commands, threshold);
|
||||
|
||||
@@ -97,14 +97,10 @@ function install_configuration_file {
|
||||
#
|
||||
function install_main_program {
|
||||
# copy source to target with executable permissions
|
||||
TRYSUDO=
|
||||
if ! touch "$TARGET" 2> /dev/null; then
|
||||
TRYSUDO=sudo
|
||||
fi
|
||||
# install to target, with hardcoded version
|
||||
$TRYSUDO sed -E "s/^VERSION=.*/VERSION=$VERSION/" "$SOURCE" > "$TARGET"
|
||||
trysudo sed -E "s/^VERSION=.*/VERSION=$VERSION/" "$SOURCE" > "$TARGET"
|
||||
# allow execute permissions
|
||||
$TRYSUDO chmod +x "$TARGET"
|
||||
trysudo chmod +x "$TARGET"
|
||||
echo "Installed: $TARGET"
|
||||
}
|
||||
|
||||
@@ -119,13 +115,8 @@ function install_cpp_program {
|
||||
TMP_TARGET="$(mktemp)"
|
||||
$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
|
||||
# eheck permissions maybe if will need sudo
|
||||
TRYSUDO=
|
||||
if ! touch "$COMPILE_TARGET" 2> /dev/null; then
|
||||
TRYSUDO=sudo
|
||||
fi
|
||||
# move executable to target
|
||||
$TRYSUDO mv "$TMP_TARGET" "$COMPILE_TARGET"
|
||||
# check permissions maybe if will need sudo
|
||||
trysudo mv "$TMP_TARGET" "$COMPILE_TARGET"
|
||||
echo "Installed: $COMPILE_TARGET"
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user