Fix default URL binding

The default binding for launching the URL hints was documented as
Ctrl+Shift+U, but never actually set. This adds this binding as the
default instead of having URLs only launchable using the mouse.
This commit is contained in:
Christian Duerr 2021-05-10 21:20:09 +00:00 committed by GitHub
parent d94c1e97a8
commit 6d8db6b9df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 8 deletions

View file

@ -118,8 +118,7 @@ pub fn load(options: &Options) -> Config {
config
});
// Override config with CLI options.
options.override_config(&mut config);
after_loading(&mut config, options);
config
}
@ -130,12 +129,20 @@ pub fn reload(config_path: &Path, options: &Options) -> Result<Config> {
let config_options = options.config_options().clone();
let mut config = load_from(config_path, config_options)?;
// Override config with CLI options.
options.override_config(&mut config);
after_loading(&mut config, options);
Ok(config)
}
/// Modifications after the `Config` object is created.
fn after_loading(config: &mut Config, options: &Options) {
// Override config with CLI options.
options.override_config(config);
// Create key bindings for regex hints.
config.ui_config.generate_hint_bindings();
}
/// Load configuration file and log errors.
fn load_from(path: &Path, cli_config: Value) -> Result<Config> {
match read_config(path, cli_config) {
@ -159,9 +166,6 @@ fn read_config(path: &Path, cli_config: Value) -> Result<Config> {
let mut config = Config::deserialize(config_value)?;
config.ui_config.config_paths = config_paths;
// Create key bindings for regex hints.
config.ui_config.generate_hint_bindings();
Ok(config)
}

View file

@ -2,6 +2,7 @@ use std::cell::RefCell;
use std::path::PathBuf;
use std::rc::Rc;
use glutin::event::{ModifiersState, VirtualKeyCode};
use log::error;
use serde::de::Error as SerdeError;
use serde::{self, Deserialize, Deserializer};
@ -238,7 +239,10 @@ impl Default for Hints {
action,
post_processing: true,
mouse: Some(HintMouse { enabled: true, mods: Default::default() }),
binding: Default::default(),
binding: Some(HintBinding {
key: Key::Keycode(VirtualKeyCode::U),
mods: ModsWrapper(ModifiersState::SHIFT | ModifiersState::CTRL),
}),
}],
alphabet: Default::default(),
}