hyprshell_windows_lib/
keybinds.rs

1use config_lib::Windows;
2use core_lib::binds::{ExecBind, generate_transfer_socat};
3use core_lib::transfer::{OpenSwitch, TransferType};
4
5#[must_use]
6pub fn generate_open_keybinds(windows: &Windows) -> Vec<ExecBind> {
7    let mut binds = Vec::new();
8    if let Some(overview) = &windows.overview {
9        binds.push(ExecBind {
10            mods: vec![overview.modifier.to_str()],
11            key: overview.key.clone(),
12            exec: generate_transfer_socat(&TransferType::OpenOverview).into_boxed_str(),
13        });
14    }
15    if let Some(switch) = &windows.switch {
16        binds.push(ExecBind {
17            mods: vec![switch.modifier.to_str()],
18            key: Box::from("tab"),
19            exec: generate_transfer_socat(&TransferType::OpenSwitch(OpenSwitch { reverse: false }))
20                .into_boxed_str(),
21        });
22        binds.push(ExecBind {
23            mods: vec![switch.modifier.to_str()],
24            key: Box::from("grave"),
25            exec: generate_transfer_socat(&TransferType::OpenSwitch(OpenSwitch { reverse: true }))
26                .into_boxed_str(),
27        });
28        binds.push(ExecBind {
29            mods: vec![switch.modifier.to_str(), "shift"],
30            key: Box::from("tab"),
31            exec: generate_transfer_socat(&TransferType::OpenSwitch(OpenSwitch { reverse: true }))
32                .into_boxed_str(),
33        });
34    }
35
36    binds
37}