11 Nov 2023
Let's say all we want to do when our laptop boots up is to input the password for unlocking the disk and be straight away taken to your wayland or X11 desktop. Well then, let's go!
We are not going to be using a display manager like gdm3 or lightdm. So,
when a user logs in into
tty1, normally one would run
startx shortly after.
We can the use the shell the automate this for
# automatically login into sway if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then exec sway # exec startx fi
Put this snippet at the very end of your
$HOME/.bash_profile. Now when you log out and log back in,
you should be presented with your desktop.
sudo systemctl edit getty@tty1 and then add the following
snippet between the indicated comment lines in the file.
In my case, there was a line that said
Anything between here and the comment below will become the new
contents of the file. Paste the snippet there.
[Service] ExecStart= ExecStart=-/sbin/agetty --autologin joe --noclear %I 38400 linux
Remember to replace
joe with the username that you'd want to
use for autologin.
This step is optional. If you dont want to see the GRUB boot
screen everytime your computer boots up, open up
/etc/default/grub as root and then change the value of
GRUB_TIMEOUT to something less than 5. I have it set to
... GRUB_TIMEOUT=1 ...
Then proceed to apply the change with
Reboot and enjoy!. If you've put
0 for the timeout, pressing
Shift key(for BIOS) or
Esc key(for UEFI)
when the system boots will bring up the GRUB menu.
Happy Hacking & have a great day!