Skip to content

Commit

Permalink
Look for keymapper.conf in an optional keymapper subdirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
houmain committed Jul 28, 2024
1 parent 175c6e2 commit 2718c66
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ Y >> Z
Control{Q} >> Alt{F4}
```

Unless overridden using the command line argument `-c`, the configuration is read from `keymapper.conf`, which is looked for in the common places and in the working directory:
* on Linux and MacOS in `$HOME/.config/` and `/etc/`.
* on Windows in the user's profile, `AppData\Local` and `AppData\Roaming` folders.
Unless overridden using the command line argument `-c`, the configuration is read from `keymapper.conf`, which is looked for in the common places:
* on Linux and MacOS in `$HOME/.config/` and `/etc/`
* on Windows in the user's profile, `AppData\Local` and `AppData\Roaming` folders

each with an optional `keymapper` subdirectory and finally in the working directory.

The command line argument `-u` causes the configuration to be automatically reloaded whenever the configuration file changes.

Expand Down Expand Up @@ -414,7 +416,7 @@ sudo keymapper-launchd add
An installer and a portable build can be downloaded from the [latest release](https://github.com/houmain/keymapper/releases/latest) page.

Most conveniently but possibly not always the very latest version can be installed using a package manager:
```
```bash
# install using winget
winget install keymapper

Expand Down
4 changes: 4 additions & 0 deletions src/client/unix/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ namespace {
auto path = base / filename;
if (std::filesystem::exists(path, error))
return path;

path = base / "keymapper" / filename;
if (std::filesystem::exists(path, error))
return path;
}
// create in profile path when opening for editing
if (!std::filesystem::exists(filename, error))
Expand Down
7 changes: 6 additions & 1 deletion src/client/windows/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,12 @@ namespace {
FOLDERID_LocalAppData,
FOLDERID_RoamingAppData
}) {
auto path = get_known_folder_path(folder_id) / filename;
const auto base = get_known_folder_path(folder_id);
auto path = base / filename;
if (std::filesystem::exists(path, error))
return path;

path = base / "keymapper" / filename;
if (std::filesystem::exists(path, error))
return path;
}
Expand Down

0 comments on commit 2718c66

Please sign in to comment.