Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To display only the Electron app or Unity game at boot, you'd typically want to create a systemd service that starts the systemd-nspawn container. You would then configure your display manager to automatically log into a session that only runs that service.

Here is a step-by-step guide:

*Step 1: Create a systemd service*

Create a systemd service file at `/etc/systemd/system/myapp.service` with the following contents:

```ini [Unit] Description=Start My App

[Service] ExecStart=/usr/bin/systemd-nspawn -D /path/to/container /root/launcher.sh Restart=always User=youruser Group=youruser

[Install] WantedBy=multi-user.target ```

Replace `/path/to/container` with the path to your container, and `youruser` with your username.

Enable the service to run at boot with:

```bash sudo systemctl enable myapp.service ```

*Step 2: Configure your display manager*

This step depends on which display manager you're using. If you're using LightDM, for example, you would create a new X session by creating a `.desktop` file at `/usr/share/xsessions/myapp.desktop` with the following contents:

```ini [Desktop Entry] Name=My App Exec=/usr/bin/systemctl start myapp.service Type=Application ```

You would then configure LightDM to automatically log in and start this session. Edit `/etc/lightdm/lightdm.conf` to include these lines:

```ini [Seat:*] autologin-user=youruser autologin-session=myapp ```

Replace `youruser` with your username.

This setup should start your systemd-nspawn container and display your Electron app or Unity game fullscreen at boot.

As for your question about running a Unity game without a full desktop environment: yes, it should be possible. Both Electron and Unity should be able to create their own windows without relying on a desktop environment. The one caveat is that there may be certain features that rely on the desktop environment (such as system notifications), which would not be available.

Note that this setup does not prevent the user from switching to other TTYs or sessions. If you want to restrict the user to your app, you'll need a more comprehensive "kiosk mode" setup that locks down the system at a lower level.



Amazing, thank you (and chatgpt).


Yeah, it's really helpful to prototype these kinds of things.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: