Skip to content

Commit 2c6f74a

Browse files
Release v0.0.5 (#18)
* Update README.md to reflect version bump * Update to README.md, new shields Added AUR Package shield Changed gitter.im shield * Added support for oblique gesture swipes. To add the support the config class was modified to include the new gestures types: left_up, right_up, left_down, right_down. Also changed the way the commands are saved in the config class, so there won't be a need for a lot of if statements to handle 4 finger swipes and 3 finger swipes. Finally, the handle_swipe_event_without_coords was modified to detect the oblique swipes. * Commenting the code a bit and some minor cosmetic and semantic changes - Added comments to each function - Increased string array size to 10 in config.h even though we only need 9 slots, I'm being a bit pedantic about this - Adding some build flags to CMakeLists.txt to show every error, preferably we'd get clean output eventually - Renamed find_gesture_device to gesture_device_exists in Input class - Renamed find_config_file to config_file_exists as this actually describes the logic of this function in Config class - Renamed find_home_folder to find_config_file in Config class in preparation to adding /etc/gebaar/gebaard.toml to list of possible config file locations * Prepare for release by bumping up version in README.md * Let warnings be warnings, release v0.0.4 * Goodbye Gitter, Hello Discord. * Fix config location (#13) If XDG_CONFIG_HOME is set, .config will be appended a second time resulting in /home/example/.config/.config/gebaar/gebaard.toml This is fixed by only appending .config, when the HOME directory workaround is used. Fixes #12 * Fix nullptr conversion to std::string (#16) Instead of using the result of getenv directly, we must check first, if getenv returned a nullptr, otherwise the program will crash. Regression from 41c7c05 * Add the build directory to gitignore (#15) The README build instructions use this directory. * Add a desktop file (#14) Users can copy this desktop file to $XDG_CONFIG_HOME/autostart to enable autostart on most desktop environments.
1 parent ca51681 commit 2c6f74a

File tree

7 files changed

+84
-9
lines changed

7 files changed

+84
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ cmake_install.cmake
1111
install_manifest.txt
1212
compile_commands.json
1313
CTestTestfile.cmake
14+
/build/*
1415
### C template
1516
# Prerequisites
1617
*.d

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ add_executable(gebaard
1212
src/config/config.cpp
1313
src/config/config.h
1414
src/daemonizer.cpp
15-
src/daemonizer.h)
15+
src/daemonizer.h
16+
src/util.cpp
17+
src/util.h)
1618

1719
find_package(PkgConfig)
1820
if (PKG_CONFIG_FOUND)

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
Gebaar
22
=========
3-
[![](https://img.shields.io/gitter/room/gebaar-libinput/community.svg?style=flat)](https://gitter.im/gebaar-libinput/community)
43

54
WM Independent Touchpad Gesture Daemon for libinput
65

@@ -15,6 +14,9 @@ Run any command by simply gesturing on your touchpad!
1514
Gebaar directly interfaces with libinput to receive and react to the events.
1615
This is more stable, faster, and more efficient as it **does not parse the output of a program** like the aforementioned projects do.
1716

17+
### Getting support (or talking about the project's future)
18+
19+
Click to join: [![Discord](https://img.shields.io/discord/548978799136473106.svg?label=Discord)](https://discord.gg/9mbKhFR)
1820

1921
### How to build and install
2022

gebaar-libinput.desktop

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Desktop Entry]
2+
Name=gebaar-libinput
3+
Comment=Touchpad Gesture Daemon for libinput
4+
Exec=/usr/bin/gebaard -b
5+
StartupNotify=false
6+
Terminal=false
7+
Type=Application
8+
X-GNOME-Autostart-enabled=true

src/config/config.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <zconf.h>
2121
#include "config.h"
22+
#include "../util.h"
2223

2324
/**
2425
* Check if config file exists at current path
@@ -68,17 +69,21 @@ void gebaar::config::Config::load_config()
6869
*/
6970
bool gebaar::config::Config::find_config_file()
7071
{
71-
const char* temp_path;
72-
temp_path = getenv("XDG_CONFIG_HOME");
73-
if (temp_path==nullptr) {
74-
temp_path = getenv("HOME");
75-
if (temp_path==nullptr) {
72+
std::string temp_path = gebaar::util::stringFromCharArray(getenv("XDG_CONFIG_HOME"));
73+
if (temp_path.empty()) {
74+
// first get the path to HOME
75+
temp_path = gebaar::util::stringFromCharArray(getenv("HOME"));
76+
if (temp_path.empty()) {
7677
temp_path = getpwuid(getuid())->pw_dir;
7778
}
79+
// then append .config
80+
if (!temp_path.empty()) {
81+
temp_path.append("/.config");
82+
}
7883
}
79-
if (temp_path!=nullptr) {
84+
if (!temp_path.empty()) {
8085
config_file_path = temp_path;
81-
config_file_path.append("/.config/gebaar/gebaard.toml");
86+
config_file_path.append("/gebaar/gebaard.toml");
8287
return true;
8388
}
8489
return false;

src/util.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
gebaar
3+
Copyright (C) 2019 coffee2code
4+
5+
This program is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
#include "util.h"
20+
21+
/**
22+
* @brief Safely converts a char array to a std::string
23+
* @param charArr The char array to convert
24+
* @return charArr or an empty string, if charArr is a nullptr
25+
*/
26+
std::string gebaar::util::stringFromCharArray(char* charArr)
27+
{
28+
return charArr == nullptr ? "" : charArr;
29+
}

src/util.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
gebaar
3+
Copyright (C) 2019 coffee2code
4+
5+
This program is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
#ifndef UTIL_H
20+
#define UTIL_H
21+
22+
#include <string>
23+
24+
namespace gebaar::util {
25+
std::string stringFromCharArray(char* charArr);
26+
}
27+
28+
#endif // UTIL_H

0 commit comments

Comments
 (0)