• viy@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      3
      arrow-down
      1
      ·
      3 months ago

      Hmmmmm Its one needed basic function that I needed So I ll wait for that

  • v9CYKjLeia10dZpz88iU@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 months ago

    Are you comfortable with code? I made a repository that tries to simplify it for temporary usage. I needed it for my own personal stuff.

    Defining the shortcuts looks like the following.

    let alt_shift_shortcut = CosmicKeyboardShortcut {
        modifiers: Modifiers::new().alt().shift(),
        keyboard_key: None,
        action: shortcuts::Action::Spawn("cosmic-term".into()),
        description: Some("Write a description".into()),
    };
    
    println!(
        "{:?}",
        add_custom_cosmic_shortcut(alt_shift_shortcut, /* overwrite: */ true)
    );
    
    let win_space_shortcut = CosmicKeyboardShortcut {
        modifiers: Modifiers::new().logo(),
        keyboard_key: Some(Keysym::from_char(' ')),
        action: shortcuts::Action::System(shortcuts::action::System::Launcher),
        description: Some("Write a description".into()),
    };
    
    println!(
        "{:?}",
        add_custom_cosmic_shortcut(win_space_shortcut, /* overwrite: */ true)
    );
    

    The code is available here