Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4706164f4 | ||
|
|
3cceef39a9 | ||
|
|
cf96a92e09 | ||
|
|
b83b01c0ca | ||
|
|
c399f3d72b | ||
|
|
a485cb133e | ||
|
|
9aa11635d2 | ||
|
|
c7eeb66dfa | ||
|
|
f3de83fb83 | ||
|
|
de3f88c83c | ||
|
|
ffe664c7d8 | ||
|
|
45ab9f9c16 | ||
|
|
759934e665 | ||
|
|
4509b57f8f | ||
|
|
a4089a80ba | ||
|
|
66926f7cea | ||
|
|
4ccf85bed5 | ||
|
|
0077544985 | ||
|
|
e2ab722e71 | ||
|
|
0e6c509781 |
No files matched your search
@@ -20,7 +20,7 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
|
|||||||
1. Install libinput-tools and C libraries
|
1. Install libinput-tools and C libraries
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt install libinput-tools libinih-dev libxdo-dev
|
sudo apt install libinput-tools libconfuse-dev libxdo-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Clone this repository
|
1. Clone this repository
|
||||||
@@ -63,13 +63,80 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
|
|||||||
Comfortable swipe is RUNNING in the background
|
Comfortable swipe is RUNNING in the background
|
||||||
```
|
```
|
||||||
|
|
||||||
|
1. Autostart (this is turned on by default)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
comfortable-swipe autostart [on|off|toggle|status|path]
|
||||||
|
```
|
||||||
|
|
||||||
1. List configurations
|
1. List configurations
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
comfortable-swipe config list
|
If you want to list down configurations, you can run:
|
||||||
|
|
||||||
|
comfortable-swipe config list
|
||||||
|
|
||||||
|
Configuration:
|
||||||
|
|
||||||
|
comfortable-swipe <PROPERTY> gets configuration property
|
||||||
|
comfortable-swipe <PROPERTY> [=] <VALUE> sets configuration to a value
|
||||||
|
|
||||||
|
Valid props: left3, left4, right3, right4, up3, up4, down3, down4, threshold, mouse3, mouse4
|
||||||
```
|
```
|
||||||
|
|
||||||
Example:
|
1. Get config (examples)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ comfortable-swipe left3
|
||||||
|
ctrl+alt+Right
|
||||||
|
|
||||||
|
$ comfortable-swipe left4
|
||||||
|
ctrl+alt+shift+Right
|
||||||
|
|
||||||
|
$ comfortable-swipe right3
|
||||||
|
ctrl+alt+Left
|
||||||
|
|
||||||
|
$ comfortable-swipe right4
|
||||||
|
ctrl+alt+shift+Left
|
||||||
|
|
||||||
|
$ comfortable-swipe up3
|
||||||
|
ctrl+alt+Down
|
||||||
|
|
||||||
|
$ comfortable-swipe up4
|
||||||
|
ctrl+alt+shift+Down
|
||||||
|
|
||||||
|
$ comfortable-swipe down3
|
||||||
|
ctrl+alt+Up
|
||||||
|
|
||||||
|
$ comfortable-swipe down4
|
||||||
|
ctrl+alt+shift+Up
|
||||||
|
|
||||||
|
$ comfortable-swipe threshold
|
||||||
|
1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Set config (examples)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ comfortable-swipe left3 = super+Right
|
||||||
|
left3 = super+Right
|
||||||
|
|
||||||
|
$ comfortable-swipe right3 = super+Left
|
||||||
|
right3 = super+Left
|
||||||
|
|
||||||
|
$ comfortable-swipe right4 = super + Left + alt
|
||||||
|
right4 = super+Left+alt
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Delete config
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ comfortable-swipe config delete mouse3
|
||||||
|
Deleted:
|
||||||
|
mouse3 = button1
|
||||||
|
```
|
||||||
|
|
||||||
|
1. List all cofigurations
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ comfortable-swipe config list
|
$ comfortable-swipe config list
|
||||||
@@ -85,84 +152,14 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
|
|||||||
left3 = ctrl+super+Right
|
left3 = ctrl+super+Right
|
||||||
```
|
```
|
||||||
|
|
||||||
1) Get config
|
1. Show path to config file:
|
||||||
|
|
||||||
```
|
|
||||||
comfortable-swipe <PROPERTY>
|
|
||||||
```
|
|
||||||
|
|
||||||
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
|
```bash
|
||||||
$ comfortable-swipe config path
|
$ comfortable-swipe config path
|
||||||
/home/hikari9/.config/comfortable-swipe.conf
|
/home/hikari9/.config/comfortable-swipe.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
1. (Advanced) Show output with `--attach`
|
||||||
<summary>Other Commands</summary>
|
|
||||||
|
|
||||||
1. Autostart
|
|
||||||
|
|
||||||
```bash
|
|
||||||
comfortable-swipe autostart
|
|
||||||
comfortable-swipe autostart on
|
|
||||||
comfortable-swipe autostart off
|
|
||||||
comfortable-swipe autostart toggle
|
|
||||||
comfortable-swipe autostart status
|
|
||||||
comfortable-swipe autostart path
|
|
||||||
```
|
|
||||||
|
|
||||||
1. Configurations
|
|
||||||
|
|
||||||
```bash
|
|
||||||
comfortable-swipe config list
|
|
||||||
comfortable-swipe config get <PROPERTY>
|
|
||||||
comfortable-swipe config set <PROPERTY> [=] <VALUE>
|
|
||||||
comfortable-swipe config path
|
|
||||||
comfortable-swipe config keys
|
|
||||||
```
|
|
||||||
|
|
||||||
1. Help and Version
|
|
||||||
|
|
||||||
```bash
|
|
||||||
comfortable-swipe --version
|
|
||||||
comfortable-swipe --help
|
|
||||||
```
|
|
||||||
|
|
||||||
1. Show output with `--attach`
|
|
||||||
|
|
||||||
Example output of 3-finger left, 4-finger left, 3-finger right, 3-finger up:
|
Example output of 3-finger left, 4-finger left, 3-finger right, 3-finger up:
|
||||||
|
|
||||||
@@ -177,8 +174,6 @@ Comfortable, seamless, and fast 3-finger (and 4-finger) touchpad swipe gestures
|
|||||||
|
|
||||||
You can also pass `--bare` to attach without actually swiping.
|
You can also pass `--bare` to attach without actually swiping.
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## Swipe Gesture Configurations
|
## Swipe Gesture Configurations
|
||||||
|
|
||||||
The default configuration file is located at `~/.config/comfortable-swipe.conf`.
|
The default configuration file is located at `~/.config/comfortable-swipe.conf`.
|
||||||
|
|||||||
+9
-45
@@ -173,53 +173,15 @@ function buffer {
|
|||||||
##########
|
##########
|
||||||
|
|
||||||
|
|
||||||
function _program_running {
|
|
||||||
pgrep -f "$BASENAME" | fgrep -v $$ > /dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# verbosely show comfortable-swipe status
|
# verbosely show comfortable-swipe status
|
||||||
function status {
|
function status {
|
||||||
# show autostart status
|
# TODO: show configuration status as well
|
||||||
echo "Autostart is $("$BASENAME" autostart status)"
|
echo "Autostart is $("$BASENAME" autostart status)"
|
||||||
# show program status
|
if pgrep -f "$BASENAME" | fgrep -v $$ > /dev/null 2>&1; then
|
||||||
if _program_running; then
|
|
||||||
echo "Program is RUNNING"
|
echo "Program is RUNNING"
|
||||||
else
|
else
|
||||||
echo "Program is STOPPED"
|
echo "Program is STOPPED"
|
||||||
fi
|
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" ]]; then
|
|
||||||
vstatus="IGNORED"
|
|
||||||
elif [[ "$key" == *4 && -n "$mouse4" ]]; then
|
|
||||||
vstatus="IGNORED"
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -329,7 +291,8 @@ function config {
|
|||||||
local RESULT="$(egrep -v "^\\s*($(echo "$DELETE" | awk '{print $1}' | paste -s -d '|'))\\s*=" "$CONFIG")"
|
local RESULT="$(egrep -v "^\\s*($(echo "$DELETE" | awk '{print $1}' | paste -s -d '|'))\\s*=" "$CONFIG")"
|
||||||
echo "$RESULT" > "$CONFIG"
|
echo "$RESULT" > "$CONFIG"
|
||||||
# restart comfortable-swipe if it is running
|
# restart comfortable-swipe if it is running
|
||||||
if _program_running; then
|
if [[ "$(status)" == ON ]]; then
|
||||||
|
stop > /dev/null 2>&1
|
||||||
start > /dev/null
|
start > /dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -415,7 +378,8 @@ function config {
|
|||||||
# show newly set value
|
# show newly set value
|
||||||
echo "$KEY = $(get "$KEY")"
|
echo "$KEY = $(get "$KEY")"
|
||||||
# restart comfortable-swipe if it is running
|
# restart comfortable-swipe if it is running
|
||||||
if _program_running; then
|
if [[ "$(status)" == ON ]]; then
|
||||||
|
stop > /dev/null 2>&1
|
||||||
start > /dev/null
|
start > /dev/null
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -487,7 +451,7 @@ function autostart {
|
|||||||
#####################################
|
#####################################
|
||||||
# toggle to opposite autostart status
|
# toggle to opposite autostart status
|
||||||
function toggle {
|
function toggle {
|
||||||
[[ $(status) == ON ]] && off || on
|
[[ $(status) = ON ]] && off || on
|
||||||
}
|
}
|
||||||
|
|
||||||
######################
|
######################
|
||||||
@@ -531,9 +495,9 @@ else
|
|||||||
# try to invoke config set / get depending on number of arguments
|
# try to invoke config set / get depending on number of arguments
|
||||||
if [[ $# -eq 1 ]]; then
|
if [[ $# -eq 1 ]]; then
|
||||||
# one argument, use shorthand get
|
# one argument, use shorthand get
|
||||||
config get "$1" || abort
|
"$BASENAME" config get "$1" || abort
|
||||||
else
|
else
|
||||||
# multiple arguments, use shorthand set
|
# multiple arguments, use shorthand set
|
||||||
config set "$@" 2> /dev/null || abort
|
"$BASENAME" config set "$@" 2> /dev/null || abort
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -92,7 +92,7 @@ int main(int argc, char *argv[]) {
|
|||||||
float threshold = 0.0f;
|
float threshold = 0.0f;
|
||||||
try {
|
try {
|
||||||
threshold = stof(config["threshold"]);
|
threshold = stof(config["threshold"]);
|
||||||
} catch (...) {
|
} catch (std::invalid_argument) {
|
||||||
}
|
}
|
||||||
// create swipe handler
|
// create swipe handler
|
||||||
gesture_swipe_xdokey keyswipe(commands, threshold);
|
gesture_swipe_xdokey keyswipe(commands, threshold);
|
||||||
|
|||||||
@@ -97,10 +97,14 @@ function install_configuration_file {
|
|||||||
#
|
#
|
||||||
function install_main_program {
|
function install_main_program {
|
||||||
# copy source to target with executable permissions
|
# copy source to target with executable permissions
|
||||||
|
TRYSUDO=
|
||||||
|
if ! touch "$TARGET" 2> /dev/null; then
|
||||||
|
TRYSUDO=sudo
|
||||||
|
fi
|
||||||
# install to target, with hardcoded version
|
# 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
|
# allow execute permissions
|
||||||
trysudo chmod +x "$TARGET"
|
$TRYSUDO chmod +x "$TARGET"
|
||||||
echo "Installed: $TARGET"
|
echo "Installed: $TARGET"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,8 +119,13 @@ function install_cpp_program {
|
|||||||
TMP_TARGET="$(mktemp)"
|
TMP_TARGET="$(mktemp)"
|
||||||
$COMPILE "$COMPILE_SOURCE" -o "$TMP_TARGET" -DCOMFORTABLE_SWIPE_VERSION="\"$VERSION\"" -DCOMFORTABLE_SWIPE_CONFIG="\"$CONF_TARGET\"" -DCOMFORTABLE_SWIPE_AUTOSTART="\"$AUTOSTART_TARGET\""
|
$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
|
# compilation ok, now try to install
|
||||||
# check permissions maybe if will need sudo
|
# eheck permissions maybe if will need sudo
|
||||||
trysudo mv "$TMP_TARGET" "$COMPILE_TARGET"
|
TRYSUDO=
|
||||||
|
if ! touch "$COMPILE_TARGET" 2> /dev/null; then
|
||||||
|
TRYSUDO=sudo
|
||||||
|
fi
|
||||||
|
# move executable to target
|
||||||
|
$TRYSUDO mv "$TMP_TARGET" "$COMPILE_TARGET"
|
||||||
echo "Installed: $COMPILE_TARGET"
|
echo "Installed: $COMPILE_TARGET"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user