summaryrefslogtreecommitdiffstats
path: root/src/keybindings.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/keybindings.rs')
-rw-r--r--src/keybindings.rs24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/keybindings.rs b/src/keybindings.rs
index 155e0e5..5562a51 100644
--- a/src/keybindings.rs
+++ b/src/keybindings.rs
@@ -103,6 +103,7 @@ impl Bindings {
(Key::Alt('l'), ActionMap::Log),
(Key::Alt('o'), ActionMap::TrashOpen),
(Key::Alt('p'), ActionMap::TogglePreviewSecond),
+ (Key::Alt('r'), ActionMap::RemoteMount),
(Key::Alt('x'), ActionMap::TrashEmpty),
(Key::Alt('z'), ActionMap::TreeFoldAll),
(Key::Ctrl('c'), ActionMap::CopyFilename),
@@ -115,6 +116,7 @@ impl Bindings {
(Key::Ctrl('p'), ActionMap::CopyFilepath),
(Key::Ctrl('q'), ActionMap::ResetMode),
(Key::Ctrl('r'), ActionMap::RefreshView),
+ (Key::Ctrl('x'), ActionMap::MocpClearPlaylist),
(Key::AltEnter, ActionMap::MocpGoToSong),
(Key::CtrlUp, ActionMap::MocpAddToPlayList),
(Key::CtrlDown, ActionMap::MocpTogglePause),
@@ -143,9 +145,11 @@ impl Bindings {
/// It may fail (and leave keybinding intact) if the file isn't formated properly.
/// An unknown or poorly formated key will be ignored.
pub fn update_normal(&mut self, yaml: &serde_yaml::value::Value) {
- let Some(mappings) = yaml.as_mapping() else { return };
+ let Some(mappings) = yaml.as_mapping() else {
+ return;
+ };
for yaml_key in mappings.keys() {
- let Some(key_string) = yaml_key.as_str() else {
+ let Some(key_string) = yaml_key.as_str() else {
log::info!("~/.config/fm/config.yaml: Keybinding {yaml_key:?} is unreadable");
continue;
};
@@ -153,8 +157,10 @@ impl Bindings {
log::info!("~/.config/fm/config.yaml: Keybinding {key_string} is unknown");
continue;
};
- let Some(action_str) = yaml[yaml_key].as_str() else { continue; };
- let Ok(action) = ActionMap::from_str(action_str) else {
+ let Some(action_str) = yaml[yaml_key].as_str() else {
+ continue;
+ };
+ let Ok(action) = ActionMap::from_str(action_str) else {
log::info!("~/.config/fm/config.yaml: Action {action_str} is unknown");
continue;
};
@@ -163,10 +169,12 @@ impl Bindings {
}
pub fn update_custom(&mut self, yaml: &serde_yaml::value::Value) {
- let Some(mappings) = yaml.as_mapping() else { return };
+ let Some(mappings) = yaml.as_mapping() else {
+ return;
+ };
let mut custom = vec![];
for yaml_key in mappings.keys() {
- let Some(key_string) = yaml_key.as_str() else {
+ let Some(key_string) = yaml_key.as_str() else {
log::info!("~/.config/fm/config.yaml: Keybinding {yaml_key:?} is unreadable");
continue;
};
@@ -174,7 +182,9 @@ impl Bindings {
log::info!("~/.config/fm/config.yaml: Keybinding {key_string} is unknown");
continue;
};
- let Some(custom_str) = yaml[yaml_key].as_str() else { continue; };
+ let Some(custom_str) = yaml[yaml_key].as_str() else {
+ continue;
+ };
let action = ActionMap::Custom(custom_str.to_owned());
log::info!("custom bind {keymap:?}, {action}");
self.binds.insert(keymap, action.clone());