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").wait().unwrap();
19}
20
21#[cfg(test)]
22mod test {
23 use crate::config::Config;
24 use crate::config::KeyboardLayout;
25 #[test]
28 fn create_config() {
29 let mut config: Config = Config::default();
30 let autostart = vec!["waybar -c ~/.config/waybar/riverconfig"];
31 let layout: KeyboardLayout<&str> = KeyboardLayout {
32 rules: None,
33 model: None,
34 variant: None,
35 options: Some("grp:toggle, ctrl:nocaps"),
36 layout: Some("us,ru"),
37 };
38 let keybinds = vec![
39 ["Q", "spawn ghostty"],
40 ["C", "close"],
41 ["J", "focus-view next"],
42 ["K", "focus-view previous"],
43 ["M", "spawn wlogout"],
44 ["B", "spawn zen-browser"],
45 ];
46 let shift_keybinds = vec![["E", "exit"], ["J", "swap next"], ["K", "swap previous"]];
47 config
48 .set_keybinds(keybinds)
49 .set_mouse_keybinds(Some("move-view"), Some("resize-view"), None)
50 .change_super("Super+Shift")
51 .set_keybinds(shift_keybinds)
52 .set_tags("Super", "Super+Shift")
53 .set_keyboard_layout(layout)
54 .autostart(autostart);
55 config.print_keybindings();
56 }
57}