I start a process with i3
exec --no-startup-id /op/bin/externalMonitor.sh
script is
#!/bin/bash
intern=eDP1
extern=DP1
while true
do
if xrandr | grep "$extern disconnected"; then
xrandr --output "$extern" --off --output "$intern" --auto
else
xrandr --output "$intern" --off --output "$extern" --auto
fi
sleep1
done
everytime I logout the program is still running though in ps -A
if I logout like 3 times and log back in, I see 3 copies of the program
why isnt it quitting on logout?
>>60903372
Because you're not telling it to quit when you logout.
>>60903599
Aren't all programs launched by the window manager supposed to be terminated when the parent (window manager) is terminated?
>>60903599
how do i do that? isnt this true
>>60903655
>>60903372
it will send a quit message to windowed processes it has up, but wont kill anything else.
check htop in tree mode. processes created by i3 are not children of i3.
>>60904509
ah i see
how do I tell it to quit since its not a child of i3?
make it a systemd service ? or a service in whatever other init system
do you use systemd ?
>>60905128
ok nevermind, thats a bad advice
You need to have it dump a pid file, and at the beginning of the script, an if statement to only run if it isn't running already.
ok i have a usefull advice now
this link teaches you how to run a command at logout:
https://superuser.com/a/65526
and the command you want is:
killall /op/bin/externalMonitor.sh
>>60905151
oh its not, i didnt read the last 3 lines. just make a service !
>>60905050
Ctrl t quits afaik