Skip to content

Commit c102e39

Browse files
feat: add autologin script for greetd
- Create enable-autologin.sh script to configure automatic login - Update README.md with autologin instructions - Update docs/getting-started/installation.md with autologin section This allows users to skip the login prompt on boot, useful for headless setups or ensuring services always start after a reboot.
1 parent 3ddba7d commit c102e39

3 files changed

Lines changed: 62 additions & 0 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,17 @@ sudo reboot
147147

148148
Greetd will launch at startup. Log in with your username and password — Hyprland will start automatically.
149149

150+
### Optional: Enable Auto-Login
151+
152+
If you want your Pi to automatically login and start Hyprland on boot (useful for headless setups or ensuring services always start), run:
153+
154+
```bash
155+
cd ~/.local/share/pimarchy
156+
sudo bash enable-autologin.sh
157+
```
158+
159+
This configures `greetd` to skip the login prompt and automatically start the desktop. To disable auto-login later, re-run the Pimarchy installer.
160+
150161
---
151162

152163
## Keybinds

docs/getting-started/installation.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ sudo reboot
7676

7777
After rebooting, you will be greeted by the **Tuigreet** login manager. Log in with your username and password, and **Hyprland** will start automatically.
7878

79+
## Optional: Enable Auto-Login
80+
81+
If you want your Pi to automatically login and start Hyprland on boot (useful for headless setups or ensuring services always start after a reboot), run:
82+
83+
```bash
84+
sudo bash enable-autologin.sh
85+
```
86+
87+
This configures `greetd` to skip the login prompt and automatically start the desktop environment for your user. To disable auto-login later, re-run the Pimarchy installer.
88+
7989
---
8090

8191
## Managing Pimarchy (CLI Tool)

enable-autologin.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# enable-autologin.sh - Configure greetd for automatic login
3+
# Usage: sudo bash enable-autologin.sh [username]
4+
5+
set -e
6+
7+
# Get username - use $SUDO_USER if running with sudo, otherwise $USER or first argument
8+
USERNAME="${1:-${SUDO_USER:-$USER}}"
9+
10+
if [ "$USERNAME" = "root" ] || [ -z "$USERNAME" ]; then
11+
echo "Error: Please specify a non-root username"
12+
echo "Usage: sudo bash enable-autologin.sh [username]"
13+
exit 1
14+
fi
15+
16+
echo "Enabling auto-login for user: $USERNAME"
17+
18+
# Create greetd config with auto-login
19+
cat << EOF | sudo tee /etc/greetd/config.toml > /dev/null
20+
[terminal]
21+
# Use vt7 to avoid systemd boot messages bleeding into the greeter
22+
vt = 7
23+
24+
[initial_session]
25+
# Auto-login this user on boot
26+
command = "/usr/local/bin/start-hyprland"
27+
user = "$USERNAME"
28+
29+
[default_session]
30+
# Fallback if initial_session fails - allows manual login
31+
command = "tuigreet --time --remember --remember-session --cmd /usr/local/bin/start-hyprland"
32+
user = "_greetd"
33+
EOF
34+
35+
echo "Auto-login configured!"
36+
echo ""
37+
echo "The system will now automatically login as '$USERNAME' on boot."
38+
echo "If you need to login as a different user, you can:"
39+
echo " - Hold Shift during boot to skip auto-login (if tuigreet supports it)"
40+
echo " - Or temporarily disable greetd: sudo systemctl disable greetd"
41+
echo " - Or restore getty: sudo systemctl unmask getty@tty1 && sudo systemctl enable getty@tty1"

0 commit comments

Comments
 (0)