this post was submitted on 08 Mar 2025
13 points (100.0% liked)

Linux

6639 readers
329 users here now

A community for everything relating to the GNU/Linux operating system

Also check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS
 

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?

you are viewing a single comment's thread
view the rest of the comments
[โ€“] Hammerheart@programming.dev 1 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

thank you! your command worked like a charm once i prepended it with exec. i even added a final command taking me back to workspace 1. tested it with exec_always and it seems to be good, crossing fingers it will actually work on boot.

maybe you can answer another question for me: is the config file executed asynchronously? What i mean is, does it run through each line, or is there a chance that, say, line 25 might execute before line 13?

[โ€“] DollyDuller@programming.dev 1 points 2 weeks ago

I'm not entirely sure how it works, but I think it's read from top to bottom. If you need to control the order of execution, I'd suggest writing shell scripts and adding them to the config file. It should make things easier to manage.