|
I'm finishing up a Raspberry Pi box for a good friend of mine. I've installed Raspbian Jessie, and installed the ONLY program that I want it to run. Nethack. This works fine, I got the controls and things hooked up how I/he wants it. My only problem is, I cannot for the life of me figure out how to get it to boot directly into Nethack without having to go through a login prompt, or enter the "nethack" command to start the game. I want this to feel like a "console" version of nethack. Power it on, and in less than 10 seconds, you are at the prompt to play. Any input would be VERY appreciated, and I'd totally be good with throwing a few bucks at you.
|
# ? Dec 22, 2015 22:54 |
|
|
# ? May 6, 2024 19:48 |
|
There should be a display manager that brings up the login prompt, and it should be possible to set it to auto-login the default user. I'm used to using KDM for KDE, and haven't used the distro you are working with specifically. Assuming it hits a desktop then it should be possible to set Nethack to autostart using the session manager.
|
# ? Dec 23, 2015 04:19 |
|
MrDeSaussure posted:I'm finishing up a Raspberry Pi box for a good friend of mine. This will be one of these things that is actually fairly simple to do, but explaining it will be a huge wall of text. I assume you've already done something similar to: code:
always start the graphical version. If not, substitute your preferred nethack start command to "nethack" in the nethack-forever script below. First, to prevent the default "pi" user from easily undoing our work, we want to make our changes to system-wide settings, which requires being root. So use "sudo -i" to become root. We will need a script that keeps restarting nethack forever. That's easy. code:
code:
"Save your changes?" question, and just press enter to accept the original filename. (Remember this. We will be using nano several more times.) Make the script executable: code:
First, a little bit of background: The component that is responsible for the actual graphical X11 logins is called "display manager", as it also restarts the display server if it dies for any reason. In Raspbian Jessie, the display manager is specified by file /etc/X11/default-display-manager. By default, it is set to "/usr/sbin/lightdm", and lightdm is already configured to auto-login the default user named "pi". The actual login session is handled by a "session manager", which is essentially just a process (or a series of processes) started by the display manager and running as the appropriate user. Once the session manager process dies, the display manager will reset the display server and prepare for a next login. In Raspbian Jessie, the default session manager is /usr/bin/x-session-manager, which is a symlink to /etc/alternatives/x-session-manager, which is a symlink to /usr/sbin/startlxde-pi, which is a script that will prepare the environment and then start the actual session manager process. (The symlinks are part of the so-called "alternatives system": Debian and Raspbian includes several programs that can be used as X11 session managers, and /usr/bin/x-session-manager is the Debian standard name for starting up the system default X11 session manager. The /etc/alternatives/x-session-manager symlink can be changed by the sysadmin to specify the desired default session manager program... the users can optionally override the default using another mechanism if the sysadmin has not forbidden that.) The important part of the /usr/sbin/startlxde-pi script is the last line: code:
Now, where would those be defined? code:
Turns out /etc/xdg/lxsession/LXDE-pi is a directory, which contains three things:
Cool, by removing or commenting out lxpanel and pcmanfm from autostart, we should remove all the desktop icons and the top menu. We can also remove the screensaver here if we want; it's actually a matter of preference. But by pressing the right mouse button on empty desktop background, there is a menu that allows starting a web browser or a terminal. We need to disable those too. After a bit of googling, grepping and experimentation, it turns out this menu is defined in file /etc/xdg/openbox/menu.xml. Edit it so that it contains only the following: code:
Let's do that: code:
As the last (or only, if you remove the screensaver line too) line, write: code:
/usr/bin/startlxde-pi was the "keystone" of the session. Let's make a copy of it, and modify it a little: code:
code:
code:
And that's it! If you run into trouble, you can press Ctrl-Alt-F1 to get a text-mode shell session, which you can use to fix any typos you might have made. If NetHack keeps dying and restarting continuously, you might want to take a look at /home/pi/.xsession-errors and /home/pi/.cache/lxsession/LXDE-nethack/run.log: any error messages from GUI programs run by the "pi" user will go into either of those files.
|
# ? Jan 6, 2016 01:45 |