Compare commits
3 Commits
main
...
eebd03bb4e
| Author | SHA1 | Date | |
|---|---|---|---|
|
eebd03bb4e
|
|||
|
65bc8e9b18
|
|||
|
6021ec89f5
|
@@ -16,7 +16,7 @@ jobs:
|
|||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- ${{ inputs.runner }}
|
- ${{ inputs.runner }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- run: |
|
- run: |
|
||||||
|
|||||||
@@ -30,22 +30,22 @@ jobs:
|
|||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment@74d41d9bd9c243f295b53762681c714f3d24fd4c # 0.1.31
|
- uses: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment@0.1.22
|
||||||
id: tag
|
id: tag
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITEA_TOKEN }}
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
prerelease: ${{ github.event_name == 'workflow_dispatch' }}
|
prerelease: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
- uses: https://gitea.t000-n.de/t.behrendt/actions/release-git-tag@3925c92fc33f3d2bc87d28d21ab691b7e6dd6cdf # 0.2.1
|
- uses: https://gitea.t000-n.de/t.behrendt/actions/release-git-tag@0.1.0
|
||||||
with:
|
with:
|
||||||
tag: ${{ steps.tag.outputs.new-tag }}
|
tag: ${{ steps.tag.outputs.new-tag }}
|
||||||
- uses: ChristopherHX/gitea-download-artifact@v4
|
- uses: ChristopherHX/gitea-download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: artifacts
|
path: artifacts
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: akkuman/gitea-release-action@fe8e0322804b48e34e3bddbbf6335bd2b1046eb7 # v1
|
uses: akkuman/gitea-release-action@v1
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.tag.outputs.new-tag }}
|
tag_name: ${{ steps.tag.outputs.new-tag }}
|
||||||
name: ${{ steps.tag.outputs.new-tag }}
|
name: ${{ steps.tag.outputs.new-tag }}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ For info that with "EVIOCGRAB" the keyboard events can be consumed exclusively b
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
The configuration can be provided by either specifying a config file path via the `-c` parameter. If no parameter is provided, the default config path under `$HOME/.config/UsbMakroBoard.yaml` is used.
|
The configuration can be provided by either specifying a config file path via the `-c` parameter. If no parameter is provided, the default config path under `$HOME/.config/usbMakroBoard.yaml` is used.
|
||||||
|
|
||||||
Find the config schema in [schemas/config.schema.json](./schemas/config.schema.json) as well as a default config in [config.yaml](./config.yaml).
|
Find the config schema in [schemas/config.schema.json](./schemas/config.schema.json) as well as a default config in [config.yaml](./config.yaml).
|
||||||
|
|
||||||
|
|||||||
23
src/main.cpp
23
src/main.cpp
@@ -7,7 +7,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
#include <spdlog/sinks/stdout_sinks.h>
|
#include <spdlog/sinks/stdout_sinks.h>
|
||||||
#include <yaml-cpp/yaml.h>
|
#include <yaml-cpp/yaml.h>
|
||||||
@@ -58,7 +57,7 @@ std::pair<int, int> mapKeyEventToRowColumn(int keyEventNumber, const std::unorde
|
|||||||
|
|
||||||
std::string getConfigPathFromCliArguments(int argc, char *argv[])
|
std::string getConfigPathFromCliArguments(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
std::string configPath;
|
std::string configPath = "";
|
||||||
int opt;
|
int opt;
|
||||||
while ((opt = getopt(argc, argv, "c:")) != -1)
|
while ((opt = getopt(argc, argv, "c:")) != -1)
|
||||||
{
|
{
|
||||||
@@ -68,30 +67,14 @@ std::string getConfigPathFromCliArguments(int argc, char *argv[])
|
|||||||
configPath = optarg;
|
configPath = optarg;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::cerr << "Usage: " << argv[0] << " [-c config_file_path]\n";
|
std::cout << "No config path provided. Using default config path: $HOME/.config/usbMakroBoard.yaml\n";
|
||||||
exit(EXIT_FAILURE);
|
configPath = "$HOME/.config/usbMakroBoard.yaml";
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configPath.empty()) {
|
|
||||||
const char *home = std::getenv("HOME");
|
|
||||||
if (home != nullptr) {
|
|
||||||
configPath = std::string(home) + "/.config/usbMakroBoard.yaml";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
std::cerr << "HOME environment variable is not set. Exiting.\n";
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return configPath;
|
return configPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
YAML::Node loadConfig(const std::string &configPath)
|
|
||||||
{
|
|
||||||
return YAML::LoadFile(configPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
int openDevice(const std::string &devicePath)
|
int openDevice(const std::string &devicePath)
|
||||||
{
|
{
|
||||||
int fdKeyboard = open(devicePath.c_str(), O_RDONLY);
|
int fdKeyboard = open(devicePath.c_str(), O_RDONLY);
|
||||||
|
|||||||
Reference in New Issue
Block a user