The KDE - Gnome Challenge: xinit and slock

Continuing the theme from before, i would like to explain how to get started setting up your 'just give me what i need' desktop. Keep in mind that this will only cover a part of getting started, so if you need a fully working desktop and you're not able to figure it all out, you might want to wait a few days until everything's lined up. I'll put together a summary so anyone can get started.

So you want to make up a minimalist desktop. The rule is to use only what you need, nothing more. You also need something to glue it together. I've written before about using xmonad to be precisely that glue. I am assuming you are going to use xmonad, you know how to open up a terminal, use it to start up other programs and can go back to your classic desktop later if you want. We'll also cover one other necessary feature, locking the screen. Obviously you don't want to leave your machine vulnerable while playing around.

The first thing to do is to set up xinit. This will start up a shell script located in ~/.xsession and when the shell script ends, it will stop the graphical environment and logout. In order to make this work, open up a terminal and do the following.

Warning: This will destroy any prexisting file you have located at ~/.xsession, so back it up if you want to first.

sudo yum install xorg-x11-xinit-session xmonad slock -y
echo > ~/.xsession << EOS

chmod +x ~/.xsession

When you log out, you will see a new desktop option called User Session. Log in using that option. The login dialog will go away, and you'll most likely be left with the default background from the login manager. Don't expect any borders or pretty things to happen yet. We will set them up later. Remember, all that's running is xmonad, nothing else. Once xmonad stops, your session ends and you are logged out. That's it.

In order to call up programs, open up a terminal with <Alt>-t. From there, you can open up any other application using it's name. To log out, press <Alt>-q. At the bottom of this post will be a couple of links to xmonad's documentation for reference.

If you need to lock your screen, open a new terminal and run slock at the prompt. Your screen will blank, just type in your password, hit enter, and you can continue working. To suspend your machine, say a laptop, the command pm-suspend will do exactly that. If you want to suspend and lock the screen, the handy snippet pm-suspend; slock at the prompt will suspend and then lock the screen. We will come back to making this easier in a following post.

I've had some criticsm about having to write up your own .xsession file and doing everything by hand. Many of the arguments run along the lines of 'i use this panel, this media player, this browser, this widget, this toolkit, and it does everything for me automatically, so you'll have to pry it out of my cold dead hands'. If this is the case, i encourage you to continue using your tools of choice for the betterment of society. However, if you're left wondering why your computer uses 1GB of memory after logging in, and why there's a mysql instance running in the background that you didn't put there yourself, and all you want to do is get programs up and running and working, then doing this by hand is a very rewarding experience. Were it easier to get a useful minimalist experience without this trouble, life might be better, but we're not yet there.

If you need documentation, check out the following links.

Happy Hacking!

2 flames:

Anoniem zei

Hm...does that start slock after the laptop wakes up again? Because that often causes problems and one of those problems resulting in the screen not being locked would be bad.

Yankee zei

The semicolon does the trick for you. It just means, run pm-suspend, when it's done, run slock. pm-suspend "runs" until you come back from standby, then it's done.