config: allow configuring the pointer-revert-key
This commit is contained in:
parent
7b62909bb4
commit
599f0a8ae5
12 changed files with 98 additions and 4 deletions
|
|
@ -23,7 +23,7 @@ use {
|
|||
jay_config::{
|
||||
Axis, Direction, Workspace,
|
||||
input::{SwitchEvent, acceleration::AccelProfile},
|
||||
keyboard::{Keymap, ModifiedKeySym, mods::Modifiers},
|
||||
keyboard::{Keymap, ModifiedKeySym, mods::Modifiers, syms::KeySym},
|
||||
logging::LogLevel,
|
||||
status::MessageFormat,
|
||||
theme::Color,
|
||||
|
|
@ -478,6 +478,7 @@ pub struct Config {
|
|||
pub max_action_depth: u64,
|
||||
pub client_rules: Vec<ClientRule>,
|
||||
pub window_rules: Vec<WindowRule>,
|
||||
pub pointer_revert_key: Option<KeySym>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use {
|
|||
Action, Config, Libei, Theme, UiDrag,
|
||||
context::Context,
|
||||
extractor::{Extractor, ExtractorError, arr, bol, int, opt, recover, str, val},
|
||||
keysyms::KEYSYMS,
|
||||
parser::{DataType, ParseResult, Parser, UnexpectedDataType},
|
||||
parsers::{
|
||||
action::ActionParser,
|
||||
|
|
@ -129,6 +130,7 @@ impl Parser for ConfigParser<'_> {
|
|||
max_action_depth_val,
|
||||
client_rules_val,
|
||||
window_rules_val,
|
||||
pointer_revert_key_str,
|
||||
),
|
||||
) = ext.extract((
|
||||
(
|
||||
|
|
@ -174,6 +176,7 @@ impl Parser for ConfigParser<'_> {
|
|||
recover(opt(int("max-action-depth"))),
|
||||
opt(val("clients")),
|
||||
opt(val("windows")),
|
||||
recover(opt(str("pointer-revert-key"))),
|
||||
),
|
||||
))?;
|
||||
let mut keymap = None;
|
||||
|
|
@ -444,6 +447,13 @@ impl Parser for ConfigParser<'_> {
|
|||
Err(e) => log::warn!("Could not parse the window rules: {}", self.0.error(e)),
|
||||
}
|
||||
}
|
||||
let mut pointer_revert_key = None;
|
||||
if let Some(value) = pointer_revert_key_str {
|
||||
match KEYSYMS.get(value.value) {
|
||||
Some(s) => pointer_revert_key = Some(*s),
|
||||
None => log::warn!("Unknown keysym: {}", self.0.error3(value.span)),
|
||||
}
|
||||
}
|
||||
Ok(Config {
|
||||
keymap,
|
||||
repeat_rate,
|
||||
|
|
@ -480,6 +490,7 @@ impl Parser for ConfigParser<'_> {
|
|||
max_action_depth,
|
||||
client_rules,
|
||||
window_rules,
|
||||
pointer_revert_key,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1235,6 +1235,9 @@ fn load_config(initial_load: bool, persistent: &Rc<PersistentState>) {
|
|||
set_show_float_pin_icon(show);
|
||||
}
|
||||
}
|
||||
if let Some(key) = config.pointer_revert_key {
|
||||
persistent.seat.set_pointer_revert_key(key);
|
||||
}
|
||||
}
|
||||
|
||||
fn create_command(exec: &Exec) -> Command {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue