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

configuration file for setting keybindings #7

Open
arbiter0xf opened this issue Jun 22, 2021 · 3 comments
Open

configuration file for setting keybindings #7

arbiter0xf opened this issue Jun 22, 2021 · 3 comments

Comments

@arbiter0xf
Copy link

Read keybindings from a .toml file.

Motivation was to just provide vimlike keybinds, but using a configuration file does serve a broader range of users.

Issue currently in progress, so please assign ticket to me if appropriate.

@arbiter0xf arbiter0xf changed the title Configuration file for setting keybindings configuration file for setting keybindings Jun 22, 2021
@arbiter0xf
Copy link
Author

Noticed that a logfile may be handy. It seems to me that when ncurses clears terminal content in endwin(), this also gets rid of any prints.

Could make another issue for this.

@arbiter0xf
Copy link
Author

I thought that support for reading .toml files would be builtin somehow. It is not. toml crate has a dependency to serde_derive::Deserialize, so not liking this approach as much anymore. Will implement anyways, and see how it looks when done.

@koutoftimer
Copy link

@arbiter0xf IMHO, this needs refactoring. All actions inside getch handling should have it's own names in order to refer to them. Looks like some sort of an API required.

BTW, it feels like @rexim follows suckless approach and simply injecting "config" source code into match body seams fine enough (via std::include!)

srs/main.rs

let nav_up = || match panel {
    Status::Todo => list_up(&mut todo_curr),
    Status::Done => list_up(&mut done_curr),
};
// other API lambda functions
// ...
let key = getch();
match key as u8 as char {
    include!("keys-config.rs")
}

src/keys-config.rs

'k' => nav_up(),
// handling other input

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

No branches or pull requests

2 participants