1use std::process::Command;
9pub mod colors;
10pub mod config;
11pub mod layout;
12
13pub fn spawn(command: &str) {
15 Command::new("riverctl")
16 .args(["spawn", command])
17 .spawn()
18 .expect("Can't launch program")
19 .wait()
20 .unwrap();
21}
22
23#[cfg(test)]
24mod test {
25 use crate::config::Config;
26 use crate::config::KeyboardLayout;
27 #[test]
30 fn create_config() {
31 let mut config: Config = Config::default();
32 let autostart = vec!["waybar -c ~/.config/waybar/riverconfig"];
33 let layout: KeyboardLayout<&str> = KeyboardLayout {
34 rules: None,
35 model: None,
36 variant: Some("colemak_dh_wide_iso,"),
37 options: Some("grp:toggle,ctrl:nocaps"),
38 layout: Some("us,ru"),
39 };
40 let keybinds = vec![
41 ["Q", "spawn ghostty"],
42 ["C", "close"],
43 ["J", "focus-view next"],
44 ["K", "focus-view previous"],
45 ["M", "spawn wlogout"],
46 ["B", "spawn zen-browser"],
47 ];
48 let shift_keybinds = vec![["E", "exit"], ["J", "swap next"], ["K", "swap previous"]];
49 config
50 .set_keybinds(keybinds)
51 .set_mouse_keybinds(Some("move-view"), Some("resize-view"), None)
52 .change_super("Super+Shift")
53 .set_keybinds(shift_keybinds)
54 .set_tags("Super", "Super+Shift")
55 .set_keyboard_layout(layout)
56 .autostart(autostart);
57 config.print_keybindings();
58 }
59}