pub struct Config { /* private fields */ }Expand description
The heart of the River configuration, holding values for default and mouse-related keybinds, colors and modifier
Each value can only be changed with methods, because it is Rust, baby! For more info, check associated structs and implemented methods.
Implementations§
Source§impl Config
impl Config
pub fn print_keybindings(&self)
Source§impl Config
impl Config
Sourcepub fn set_keybind(&mut self, keys: &str, command: &str) -> &mut Self
pub fn set_keybind(&mut self, keys: &str, command: &str) -> &mut Self
Sets the single keybind
§Example
use river_rs::config::Config;
let mut config = Config::default();
let key = String::from("Q");
let command = String::from("spanw foo");
config.set_keybind(&key, &command);Sourcepub fn set_keybinds(&mut self, keybinds: Vec<[&str; 2]>) -> &mut Self
pub fn set_keybinds(&mut self, keybinds: Vec<[&str; 2]>) -> &mut Self
Sets keybinds based on the vector of lists with 2 values
Second command can be written with spaces, no need to define every argument separatly.
Takes the ownership of the vector and modifies it to supply riverctl
§Examples
use river_rs::config::Config;
let mut config = Config::default();
let keybinds = vec![
["Q", "spawn foo"],
["E", "exit"],
["M", "spawn bruh"]
];
config.set_keybinds(keybinds);Sourcepub fn set_mouse_keybinds(
&mut self,
left: Option<&str>,
right: Option<&str>,
middle: Option<&str>,
) -> &mut Self
pub fn set_mouse_keybinds( &mut self, left: Option<&str>, right: Option<&str>, middle: Option<&str>, ) -> &mut Self
Every keybind is optional, so you can just provide it with None keyword
§Example
use river_rs::config::Config;
let mut config = Config::default();
config.set_mouse_keybinds(Some("move-view"), Some("resize-view"), None);Source§impl Config
impl Config
Sourcepub fn set_repeat(&mut self, repeat_rate: u32, repeat_delay: u32) -> &mut Self
pub fn set_repeat(&mut self, repeat_rate: u32, repeat_delay: u32) -> &mut Self
Sets xkb settings related to repeat_rate and repeat_delay.
The typematic delay indicates the amount of time (typically in milliseconds) a key needs to be pressed and held in order for the repeating process to begin.
After the repeating process has been triggered, the character will be repeated with a certain frequency (usually given in Hz) specified by the typematic rate.
(Taken from the Arch Wiki)
pub fn set_layout_generator(&mut self, layout: Layout) -> &mut Self
Sourcepub fn set_keyboard_layout(&mut self, layout: KeyboardLayout<&str>) -> &mut Self
pub fn set_keyboard_layout(&mut self, layout: KeyboardLayout<&str>) -> &mut Self
Set xkb settings for window manager. To check available settings, look at KeyboardLayout
struct.
Sourcepub fn change_super(&mut self, key: &str) -> &mut Self
pub fn change_super(&mut self, key: &str) -> &mut Self
Changes the River Modifier key.
Useful when chaining set_keybinds with different modifiers.
§Example
use river_rs::config::Config;
let mut config = Config::default();
let keybinds = vec![
["C", "close"],
["J", "focus-view next"],
["K", "focus-view previous"],
];
let shift_keybinds = vec![
["E", "exit"],
["J", "swap next"],
["K", "swap previous"],
];
config
.set_keybinds(keybinds)
.change_super("Super+Shift")
.set_keybinds(shift_keybinds)
.apply()
.unwrap();Sets tags from 1 to 9 based on passed modifiers