TL;DR at the bottom.
I am trying to make a simple lock screen for my laptop running Arch / BSPWM. I found a program called cmatrix which has a screensaver flag that causes it to exit when a key is pressed. I am trying to chain together bspc commands with cmatrix and vlock to make a line that can be run to start cmatrix fullscreen, run vlock when keys are pressed, then exit after vlock exits.
My only problem with this is that in order for the lock screen to be effective, I need to quit sxhkd to prevent people from simply closing the window containing cmatrix/vlock. I have added pkill sxhkd to the chain of commands and that works. The broken part is starting sxhkd back up again. Simply tacking sxhkd on to the end doesn't work as the terminal window won't close until sxhkd finishes, which is never. In addition, if the terminal window is closed, sxhkd stops because it was running in it.
I tried using "sxhkd &", but for some reason this causes the whole thing not to run.
Here is the almost working command I have so far:
urxvtc -e bash -c "sleep 0.1; pkill sxhkd; sleep 0.1; bspc window -t fullscreen=on; sleep 0.1; cmatrix -u 9 -s; sleep 0.1; vlock; sleep 0.1; sxhkd"
The sleep commands are so that the programs don't come up in the wrong order (sometimes the vlock password prompt comes up before cmatrix gets to run)
What it currently does is start a new urxvt window (important if I want my terminal font for cmatrix) and it kills sxhkd to prevent anyone from closing the window. It fullscreens it using bspc and runs cmatrix. When a key is pressed, cmatrix exits and the vlock password prompts comes up. When the password is entered correctly, it tries to restart sxhkd, but they remain coupled.
Any help would be greatly appreciated!
TL;DR
How can I, with a command (usually run from a script), open a terminal window that runs other commands, then starts an application (like a gui app), then the terminal window closes but the gui app keeps running?
Simpler command examples:
urxvtc -e bash -c "echo hello!; sleep 3; pavucontrol"
This should print hello!, wait 3 seconds, then launch pavucontrol and close the terminal leaving pavucontrol. Instead, the terminal stays open because pavucontrol is running.
urxvtc -e bash -c "echo hello!; sleep 3; pavucontrol &"
This should print hello!, wait 3 seconds, then launch pavucontrol and close the terminal leaving pavucontrol. When the terminal closes after 3 seconds, however, pavucontrol is nowhere to be seen.