-
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
44 changed files
with
1,633 additions
and
562 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[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 = "m", action = "MoveTorrent" }, | ||
{ 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,43 @@ | ||
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, | ||
MoveTorrent, | ||
Pause, | ||
DeleteWithFiles, | ||
DeleteWithoutFiles, | ||
ShowFiles, | ||
ShowStats, | ||
} | ||
|
||
impl UserAction for TorrentsAction { | ||
fn desc(&self) -> &'static str { | ||
match self { | ||
TorrentsAction::AddMagnet => "add a magnet", | ||
TorrentsAction::MoveTorrent => "move torrent download directory", | ||
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::MoveTorrent => Action::MoveTorrent, | ||
TorrentsAction::Pause => Action::Pause, | ||
TorrentsAction::DeleteWithFiles => Action::DeleteWithFiles, | ||
TorrentsAction::DeleteWithoutFiles => Action::DeleteWithoutFiles, | ||
TorrentsAction::ShowFiles => Action::ShowFiles, | ||
TorrentsAction::ShowStats => Action::ShowStats, | ||
} | ||
} | ||
} |
Oops, something went wrong.