I bought this simple ass little macropad that uses real keyboard switches and for like a year I had no idea how to use it. There was no dirt simple file configed little command I can plant in my i3/config and be happy with it so I built it!

It was my first attempt at building a production-level thing out of rust and I’m really happy with it. Now I can finally use my goddamn macropad!!

  • CameronDev
    link
    fedilink
    arrow-up
    1
    ·
    13 days ago
                let c_raw = cmd.to_string();
    
                thread::spawn(move || {
                    let c = Command::new("/bin/sh")
                        .args(["-c", c_raw.as_str()])
                        .output();
    

    Did you try just splitting the c_raw into its command using shlex. Could save the intermediate sh process?

    Edit: I guess you could also be using it for $PATH, in which case fair enough.

    • danhab99OPM
      link
      fedilink
      arrow-up
      2
      ·
      12 days ago

      I have a vague memory that this is how I wrote it but now I’m noticing that I did that in similar projects and got my memory crossed… I need to do this.