# Redshift and others persisting after end of X session



## hunter0one (Sep 11, 2022)

I've started using x11-wm/ctwm as my main desktop environment, and to autostart applications I now use .xinitrc / .xsession (I have the two symlinked for xdm). While most applications die when I exit ctwm, some stay such as xclock, redshift, and osdmixer and I have to kill these since they are like ghosts in the background of any future sessions. 

My .xsession file:


```
#!/bin/tcsh
exec setenv QT_QPA_PLATFORMTHEME qt5ct &
xrdb -load ~/.Xresources &
exec osdmixer d d d 2 &
exec xclock -d -strftime %r -update 1 -geometry +0+1040 &
exec stalonetray &
exec xeyes -geometry 120x80+0+575 &
exec redshift &
exec xscreensaver -no-splash &
exec parcellite &
exec ctwm
```


----------



## covacat (Sep 12, 2022)

not sure what is the real cause but
 use /bin/sh as the shell for scripting
exec command & is  a weird construct / use command &
exec setenv ...& does not work
xclients will/should die when X server dies, not when the WM dies


----------



## SirDice (Sep 12, 2022)

exec(1) will replace the current process with whatever is being exec(1)'ed. It does NOT return. It doesn't work like you think it does.


```
export QT_QPA_PLATFORMTHEME=qt5ct 
[ -f ~/.Xresources] && xrdb -load ~/.Xresources 
osdmixer d d d 2 
xclock -d -strftime %r -update 1 -geometry +0+1040 &
stalonetray &
xeyes -geometry 120x80+0+575 &
redshift &
xscreensaver -no-splash &
parcellite &
exec ctwm
```

You have xlock(1) and xscreensaver(1). Both are able to lock your screen. Use one or the other, not both.


----------



## covacat (Sep 12, 2022)

exec cmd & works because & (probably)forces a fork before exec is evaluated but it is a weird construct


----------



## SirDice (Sep 12, 2022)

That whole .xsession file is a mess, I very much doubt it actually works. .xinitrc and .xsession don't need a shebang line. They don't even need to be marked as executable.


----------



## hunter0one (Sep 12, 2022)

SirDice said:


> You have xlock(1) and xscreensaver(1). Both are able to lock your screen. Use one or the other, not both.


That's xclock, the clock program, not xlock. But the aforementioned did work, thanks.


----------

