Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Gebaar
=========

WM Independent Touchpad Gesture Daemon for libinput

_Gebaar means Gesture in Dutch_
Expand Down Expand Up @@ -55,8 +54,20 @@ right_down = ""
down = ""
left = ""
right = ""

[commands.pinch]
in = ""
out = ""

[settings]
pinch.distance = ""
swipe.threshold = ""
```

* `settings.pinch.distance` key sets the distance between fingers where it shold trigger.
Defaults to `0.5` which means fingers should travel exactly half way from their initial position.
* `settings.swipe.threshold` sets the limit when swipe gesture should be executed. Defaults to 100.

### Repository versions

![](https://img.shields.io/aur/version/gebaar.svg?style=flat)
Expand All @@ -67,7 +78,7 @@ right = ""

_~/.config/gebaar/gebaard.toml_
```toml
[commands.swipe.three]
[swipe.commands.three]
left_up = ""
right_up = ""
up = "bspc node -f north"
Expand All @@ -77,7 +88,8 @@ down = "bspc node -f south"
left = "bspc node -f west"
right = "bspc node -f east"

[commands.swipe.four]

[swipe.commands.four]
left_up = ""
right_up = ""
up = "rofi -show combi"
Expand All @@ -86,16 +98,33 @@ right_down = ""
down = ""
left = "bspc desktop -f prev"
right = "bspc desktop -f next"

[pinch.commands.two]
in = "xdotool key Control_L+equal"
out = "xdotool key Control_L+minus"

[pinch.settings]
threshold=0.25
one_shot=false

[swipe.settings]
threshold = 0.5
one_shot = true
trigger_on_release = true
```

Add `gebaard -b` to `~/.config/bspwm/bspwmrc`

### State of the project

- [x] Receiving swipe events from libinput
- [ ] Receiving pinch/zoom events from libinput
- [x] Swipe gesture have trigger treshold
- [x] Receiving pinch/zoom events from libinput
- [x] Support continous pinch
- [ ] Support pinch-and-rotate gestures
- [ ] Receiving rotation events from libinput
- [x] Converting libinput events to motions
- [x] Running commands based on motions
- [x] Refactor code to be up to Release standards, instead of testing-hell


54 changes: 34 additions & 20 deletions src/config/config.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
gebaar
Copyright (C) 2019 coffee2code

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
Expand Down Expand Up @@ -43,23 +43,37 @@ void gebaar::config::Config::load_config()
std::cerr << e.what() << std::endl;
exit(EXIT_FAILURE);
}
swipe_three_commands[1] = *config->get_qualified_as<std::string>("commands.swipe.three.left_up");
swipe_three_commands[2] = *config->get_qualified_as<std::string>("commands.swipe.three.up");
swipe_three_commands[3] = *config->get_qualified_as<std::string>("commands.swipe.three.right_up");
swipe_three_commands[4] = *config->get_qualified_as<std::string>("commands.swipe.three.left");
swipe_three_commands[6] = *config->get_qualified_as<std::string>("commands.swipe.three.right");
swipe_three_commands[7] = *config->get_qualified_as<std::string>("commands.swipe.three.left_down");
swipe_three_commands[8] = *config->get_qualified_as<std::string>("commands.swipe.three.down");
swipe_three_commands[9] = *config->get_qualified_as<std::string>("commands.swipe.three.right_down");

swipe_four_commands[1] = *config->get_qualified_as<std::string>("commands.swipe.four.left_up");
swipe_four_commands[2] = *config->get_qualified_as<std::string>("commands.swipe.four.up");
swipe_four_commands[3] = *config->get_qualified_as<std::string>("commands.swipe.four.right_up");
swipe_four_commands[4] = *config->get_qualified_as<std::string>("commands.swipe.four.left");
swipe_four_commands[6] = *config->get_qualified_as<std::string>("commands.swipe.four.right");
swipe_four_commands[7] = *config->get_qualified_as<std::string>("commands.swipe.four.left_down");
swipe_four_commands[8] = *config->get_qualified_as<std::string>("commands.swipe.four.down");
swipe_four_commands[9] = *config->get_qualified_as<std::string>("commands.swipe.four.right_down");

/* Swipe Settings */
swipe_three_commands[1] = *config->get_qualified_as<std::string>("swipe.commands.three.left_up");
swipe_three_commands[2] = *config->get_qualified_as<std::string>("swipe.commands.three.up");
swipe_three_commands[3] = *config->get_qualified_as<std::string>("swipe.commands.three.right_up");
swipe_three_commands[4] = *config->get_qualified_as<std::string>("swipe.commands.three.left");
swipe_three_commands[6] = *config->get_qualified_as<std::string>("swipe.commands.three.right");
swipe_three_commands[7] = *config->get_qualified_as<std::string>("swipe.commands.three.left_down");
swipe_three_commands[8] = *config->get_qualified_as<std::string>("swipe.commands.three.down");
swipe_three_commands[9] = *config->get_qualified_as<std::string>("swipe.commands.three.right_down");

swipe_four_commands[1] = *config->get_qualified_as<std::string>("swipe.commands.four.left_up");
swipe_four_commands[2] = *config->get_qualified_as<std::string>("swipe.commands.four.up");
swipe_four_commands[3] = *config->get_qualified_as<std::string>("swipe.commands.four.right_up");
swipe_four_commands[4] = *config->get_qualified_as<std::string>("swipe.commands.four.left");
swipe_four_commands[6] = *config->get_qualified_as<std::string>("swipe.commands.four.right");
swipe_four_commands[7] = *config->get_qualified_as<std::string>("swipe.commands.four.left_down");
swipe_four_commands[8] = *config->get_qualified_as<std::string>("swipe.commands.four.down");
swipe_four_commands[9] = *config->get_qualified_as<std::string>("swipe.commands.four.right_down");

settings.swipe_threshold = config->get_qualified_as<double>("swipe.settings.threshold").value_or(0.5);
settings.swipe_one_shot = config->get_qualified_as<bool>("swipe.settings.one_shot").value_or(true);
settings.swipe_trigger_on_release = config->get_qualified_as<bool>("swipe.settings.trigger_on_release").value_or(true);

/* Pinch settings */
pinch_commands[PINCH_IN] = *config->get_qualified_as<std::string>("pinch.commands.two.out");
pinch_commands[PINCH_OUT] = *config->get_qualified_as<std::string>("pinch.commands.two.in");

settings.pinch_threshold = config->get_qualified_as<double>("pinch.settings.threshold").value_or(0.25);
settings.pinch_one_shot = config->get_qualified_as<bool>("pinch.settings.one_shot").value_or(false);


loaded = true;
}
Expand Down
22 changes: 19 additions & 3 deletions src/config/config.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
gebaar
Copyright (C) 2019 coffee2code

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
Expand All @@ -33,16 +33,32 @@ namespace gebaar::config {

void load_config();


struct settings {
bool pinch_one_shot;
double pinch_threshold;

bool swipe_one_shot;
double swipe_threshold;
bool swipe_trigger_on_release;
} settings;

enum pinch {PINCH_IN, PINCH_OUT};
std::string swipe_three_commands[10];
std::string swipe_four_commands[10];
std::string pinch_commands[10];

private:

bool config_file_exists();

bool find_config_file();


std::string config_file_path;
std::shared_ptr<cpptoml::table> config;


};
}
#endif //GEBAAR_CONFIG_H
Loading