You are not logged in.
Pages: 1
I want to create custom bash logout command for exiting i3 and logging out from tty.
I put relevant commands into the function:
logout() {
i3-msg exit # exit i3
exit # log out from tty
}However the exit command is not executed.
I'm not sure if I can do it like this.
Can you point out the corrent direction to achieve this?
Offline
Where do you put those?
The exit command exits the current shell which in doubt is not your tty login.
Also: is there a specific reason for the active tty? Why don't you "exec i3" from there - what will replace the tty shell and thus exiting i3 will "exit" the (replaced) tty as well.
Edit: otherwise you want to kill i3's parenting shell.
Last edited by seth (2021-06-04 07:23:27)
Online
Thanks for your answer, the resulting function looks like this:
logout() {
PID=$(who -la | awk '{$1="user_name"; printf $7}')
sudo kill $PID
}I put the function in my .bashrc file.
Please set this topis as solved.
Offline
You should do that by editing the title in your first post.
Offline
Pages: 1