-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
893 additions
and
384 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[general] | ||
keybindings = [ | ||
{ on = "?", action = "ShowHelp" }, | ||
{ on = "F1", action = "ShowHelp" }, | ||
|
||
{ on = "q", action = "Quit" }, | ||
{ on = "Esc", action = "Close" }, | ||
{ on = "Enter", action = "Confirm" }, | ||
{ on = " ", action = "Select" }, | ||
{ on = "Tab", action = "SwitchFocus" }, | ||
{ on = "/", action = "Search" }, | ||
|
||
{ on = "1", action = "SwitchToTorrents" }, | ||
{ on = "2", action = "SwitchToSearch" }, | ||
|
||
{ on = "Home", action = "GoToBeginning" }, | ||
{ on = "End", action = "GoToEnd" }, | ||
{ on = "PageUp", action = "ScrollPageUp" }, | ||
{ on = "PageDown", action = "ScrollPageDown" }, | ||
|
||
{ modifier = "Ctrl", on = "u", action = "ScrollPageUp" }, | ||
{ modifier = "Ctrl", on = "d", action = "ScrollPageDown" }, | ||
|
||
# Arrows | ||
{ on = "Left", action = "Left" }, | ||
{ on = "Right", action = "Right" }, | ||
{ on = "Up", action = "Up"}, | ||
{ on = "Down", action = "Down" }, | ||
|
||
# Vi | ||
{ on = "h", action = "Left" }, | ||
{ on = "l", action = "Right" }, | ||
{ on = "k", action = "Up" }, | ||
{ on = "j", action = "Down" }, | ||
] | ||
|
||
[torrents_tab] | ||
keybindings = [ | ||
{ on = "a", action = "AddMagnet" }, | ||
{ on = "p", action = "Pause" }, | ||
{ on = "f", action = "ShowFiles" }, | ||
{ on = "s", action = "ShowStats" }, | ||
|
||
{ on = "d", action = "DeleteWithoutFiles" }, | ||
{ on = "D", action = "DeleteWithFiles" }, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
use rm_shared::action::Action; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::UserAction; | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] | ||
pub enum GeneralAction { | ||
ShowHelp, | ||
Quit, | ||
Close, | ||
SwitchToTorrents, | ||
SwitchToSearch, | ||
Left, | ||
Right, | ||
Down, | ||
Up, | ||
Search, | ||
SwitchFocus, | ||
Confirm, | ||
Select, | ||
ScrollPageDown, | ||
ScrollPageUp, | ||
GoToBeginning, | ||
GoToEnd, | ||
} | ||
|
||
impl UserAction for GeneralAction { | ||
fn desc(&self) -> &'static str { | ||
match self { | ||
GeneralAction::ShowHelp => "toggle help", | ||
GeneralAction::Quit => "quit Rustmission / a popup", | ||
GeneralAction::Close => "close a popup / task", | ||
GeneralAction::SwitchToTorrents => "switch to torrents tab", | ||
GeneralAction::SwitchToSearch => "switch to search tab", | ||
GeneralAction::Left => "switch to tab left", | ||
GeneralAction::Right => "switch to tab right", | ||
GeneralAction::Down => "move down", | ||
GeneralAction::Up => "move up", | ||
GeneralAction::Search => "search", | ||
GeneralAction::SwitchFocus => "switch focus", | ||
GeneralAction::Confirm => "confirm", | ||
GeneralAction::Select => "select", | ||
GeneralAction::ScrollPageDown => "scroll page down", | ||
GeneralAction::ScrollPageUp => "scroll page up", | ||
GeneralAction::GoToBeginning => "scroll to the beginning", | ||
GeneralAction::GoToEnd => "scroll to the end", | ||
} | ||
} | ||
} | ||
|
||
impl From<GeneralAction> for Action { | ||
fn from(value: GeneralAction) -> Self { | ||
match value { | ||
GeneralAction::ShowHelp => Action::ShowHelp, | ||
GeneralAction::Quit => Action::Quit, | ||
GeneralAction::Close => Action::Close, | ||
GeneralAction::SwitchToTorrents => Action::ChangeTab(1), | ||
GeneralAction::SwitchToSearch => Action::ChangeTab(2), | ||
GeneralAction::Left => Action::Left, | ||
GeneralAction::Right => Action::Right, | ||
GeneralAction::Down => Action::Down, | ||
GeneralAction::Up => Action::Up, | ||
GeneralAction::Search => Action::Search, | ||
GeneralAction::SwitchFocus => Action::ChangeFocus, | ||
GeneralAction::Confirm => Action::Confirm, | ||
GeneralAction::Select => Action::Select, | ||
GeneralAction::ScrollPageDown => Action::ScrollDownPage, | ||
GeneralAction::ScrollPageUp => Action::ScrollUpPage, | ||
GeneralAction::GoToBeginning => Action::Home, | ||
GeneralAction::GoToEnd => Action::End, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use rm_shared::action::Action; | ||
|
||
pub mod general; | ||
pub mod torrents_tab; | ||
|
||
pub trait UserAction: Into<Action> { | ||
fn desc(&self) -> &'static str; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use rm_shared::action::Action; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::UserAction; | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] | ||
pub enum TorrentsAction { | ||
AddMagnet, | ||
Pause, | ||
DeleteWithFiles, | ||
DeleteWithoutFiles, | ||
ShowFiles, | ||
ShowStats, | ||
} | ||
|
||
impl UserAction for TorrentsAction { | ||
fn desc(&self) -> &'static str { | ||
match self { | ||
TorrentsAction::AddMagnet => "add a magnet", | ||
TorrentsAction::Pause => "pause/unpause", | ||
TorrentsAction::DeleteWithFiles => "delete with files", | ||
TorrentsAction::DeleteWithoutFiles => "delete without files", | ||
TorrentsAction::ShowFiles => "show files", | ||
TorrentsAction::ShowStats => "show statistics", | ||
} | ||
} | ||
} | ||
|
||
impl From<TorrentsAction> for Action { | ||
fn from(value: TorrentsAction) -> Self { | ||
match value { | ||
TorrentsAction::AddMagnet => Action::AddMagnet, | ||
TorrentsAction::Pause => Action::Pause, | ||
TorrentsAction::DeleteWithFiles => Action::DeleteWithFiles, | ||
TorrentsAction::DeleteWithoutFiles => Action::DeleteWithoutFiles, | ||
TorrentsAction::ShowFiles => Action::ShowFiles, | ||
TorrentsAction::ShowStats => Action::ShowStats, | ||
} | ||
} | ||
} |
Oops, something went wrong.