Is there a way to trigger the closing of one program by closing another? A shell script perhaps?
0
votes
2
answers
544
views
So, my situation is this: I have created a launcher, key bindings and an alias that opens GLava and CMus in a drop-down terminal at the same time, using this shell script:
#!/bin/bash
c=$(ps -e | grep -c xfce4-terminal)
if [ $c -gt 0 ]
then
xfce4-terminal --tab --drop-down -x cmus | glava --desktop & $1
else
xfce4-terminal --drop-down -x cmus | glava --desktop & $1
fi
It is perfect and glorious, but for one small problem. I'd very much like for both programs to also CLOSE at the same time. Is there a way to have one programs' termination trigger another? Specifically, if I have CMus and GLava open, I'd like to be able to close CMus (say, by simply pressing 'q' and quitting CMus or by closing the terminal, or killing the program, OR a special key binding, etc.) and have GLava immediately close/terminate as well. As it stands, I have a separate key binding to pkill GLava after I've closed CMus, which works fine, I suppose, but is certainly a little clunkier than I'd like. Maybe there's a way for GLava to only get triggered if CMus is running, a sort of whitelist maybe? A simple shell that closes both programs that I can bind? Or another thought perhaps? I'm open to any suggestions, being the noob that I am. Any help is much appreciated.
Asked by poutingcavity
(71 rep)
May 25, 2021, 08:06 AM
Last activity: May 30, 2021, 10:14 AM
Last activity: May 30, 2021, 10:14 AM