kc9udx
That's probably a better solution, because it tmux
is opening new panes with login shells then what I have make's no difference, they'll be run again.
Cheers for this.
I'm still curious why tmux
insists on opening login shells though. Even after setting:
set -g default-shell /bin/ash
set -g default-command /bin/ash
inside my ~/.tmux.conf
. I even tried set -g default-command "/bin/ash -i"
without success.
EDIT:
I should also just clarify that I'm using Alpine Linux, not BSD (hence no specific BSD tag). So I did some more research, and well, I've been going about this all wrong (not surprised). Apologies for not specifying the OS prior, and given we're on a BSD forum, I've probably made a faux pass.
Anyway...
Alpine uses OpenRC and /etc/local.d/
for startup services. So I'll just add the commands to /etc/local.d/startup.once
and enable it with rc-update add local default
I just thought, there would be a simple, OS agnostic way to do this.
EDIT 2:
This is just for me now..
Because the rbw unlock
command requires an interactive shell for pinentry to activate, that command in particular wont work if executed at boot, before login. SO maybe I'll stick with your method above with something like this
echo 'rm -f /home/$USER/.logged-in' | doas tee /etc/local.d/reset-login.once
doas chmod +x /etc/local.d/reset-login.once
doas rc-update add local default
And just keep the commands wrapped inside ~/.profile
like so.
if ! [ -e ~/.logged-in ]; then
touch ~/.logged-in
brightnessctl -q set 5
amixer -q set Master 7 unmute
setfont /usr/share/consolefonts/ter-114b.psf.gz
rbw unlock
fi
EDIT 3:
Actually, I've moved all other commands to /etc/local.d
to be run with OpenRC at boot and just left the rbw unlock
command inside ~/.profile
. I feel like this it the most sensible.
I'd still prefer a solution that prevents tmux
from opening login shells. That's a mystery that will bug me until I figure it out.