I’ve been struggling with getting a wezterm window running cmus on a specific workspace upon start up for a while now. I can’t use assign because the only eligible criteria differentiating it from a generic wezterm window is the pid, and my attempts to get the pid from get_tree and use that have been unsuccessful. I thought I had figured it out, when I put these lines in a another file:

#! /bin/bash
sway workspace 10 && sway 'exec wezterm -e cmus'

then in my config file I have this: exec ./start_cmus.sh

But it doesn’t work. If I run start_cmus from the shell, the expected behavior ensues (a wezterm window running cmus is opened on workspace 10).

Any tips?

  • just_another_person@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    2 days ago

    Many things wrong here, but you’re going to have issues using ‘&&’ in something like this. Remove that and see if you get any useful output.

    If you still don’t get useful output, then your exec is being swallowed up. Generally you need to very explicit in Sway: create workspace, switch to it, start script. Seems like you’re intentionally skipping steps, and you’re gonna have a bad time.

    If anything, to help debug, try the above, and explicitly create a class of window to start something in, then run something to know works, like calculator. Make sure these types of things work first before trying to chain scripts together.