Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keybind configuration #4

Merged
merged 12 commits into from
May 31, 2023
Merged

Add keybind configuration #4

merged 12 commits into from
May 31, 2023

Conversation

dxrcy
Copy link
Contributor

@dxrcy dxrcy commented May 28, 2023

Keybinds (control) can be configured in ~/.config/tui-chan/keybinds.conf.
Default controls are the same.
Configuration file is parsed at the start of program execution, and file is created if not already existing, with default controls.

Added keybinds module, and updated main.rs and README.md.
Changes have been tested and linted.

Fixes #3

Reference:

  • keybinds/key.rs for parsing single keybind definitions
  • keybinds/mod.rs for definition of Keybinds struct, and parsing of file
  • keybinds/file.rs for .conf file reading and writing

Possible issues:

  • Config folder only works for Linux. Could be solved with dirs-next crate
  • Only one keybind per action allowed currently: cannot use both WASD and arrow keys for instance

@tuqqu
Copy link
Owner

tuqqu commented May 30, 2023

Thank you for this PR. The PR looks tidy and clean, great job!

A few comments:

  1. Please, take a look at the Clippy error.
  2. app.rs has a help menu to look up the keys, which should be updated accordingly. The simplest way to address this would be to pass keybinds to App::new as an argument to build the message.
  3. Let's not fail upon not being able to find the config name folder, but rather log this error to stderr and continue execution.

@dxrcy
Copy link
Contributor Author

dxrcy commented May 31, 2023

All problems should be patched now :)

@tuqqu tuqqu merged commit 353f70d into tuqqu:master May 31, 2023
@tuqqu
Copy link
Owner

tuqqu commented May 31, 2023

Thank you for the contribution!

@tuqqu tuqqu mentioned this pull request May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vim keybinds?
2 participants