Skip to content

Instantly share code, notes, and snippets.

@minhoryang
Last active April 28, 2026 10:34
Show Gist options
  • Select an option

  • Save minhoryang/f08391ca0902d8108c1021147541e5fb to your computer and use it in GitHub Desktop.

Select an option

Save minhoryang/f08391ca0902d8108c1021147541e5fb to your computer and use it in GitHub Desktop.
sudo tee /usr/local/bin/wait-mouse.sh << 'EOF'
#!/bin/bash
logger "Mouse detecting... /tmp/libinput.log"
libinput debug-events --quiet > /tmp/libinput.log 2>&1 &
PID=$!
grep -m 1 "POINTER_MOTION" <(tail -f /tmp/libinput.log)
kill $PID
wait $PID 2>/dev/null
logger "Mouse detected, starting display manager"
EOF
sudo chmod 755 /usr/local/bin/wait-mouse.sh
sudo chown root:root /usr/local/bin/wait-mouse.sh
sudo tee /etc/systemd/system/wait-the-mouse.conf << 'EOF'
[Unit]
Description=Wait for mouse input before starting display manager.
Before=display-manager.service
After=systemd-user-sessions.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/local/bin/wait-mouse.sh
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
# in case of error: CA+F2
# sudo rm -rf /etc/systemd/system/plasmalogin.service.d/
# sudo systemctl daemon-reload
# sudo systemctl restart plasmalogin
# sudo reboot
# sudo systemctl set-default multi-user.target
@minhoryang
Copy link
Copy Markdown
Author

works great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment