First, there is a hidden file in our home directory called .profile, this is basically a bunch of commands that will run everytime you log in. Why not put just put "startx" at the bottom of that file? Well there is one good reason, what if you are remotely connecting to the box over ssh? Here is another, what if you really botch up your startup or fluxbox config and you need to log into it from another terminal session without launching another instance of the same problem? So the best plan would be to tell Debian that if we are logging into an initial session directly from the attached keyboard and monitor to automatically lauch the gui, but ONLY for the initial local login. Here are the bottom 3 lines from my .profile that does that:
if [ $(tty) == /dev/tty1 ]; then
startx
fi
Second, now what happens if we have other window managers installed, which one do we start? How do we tell linux which window manager to choose? Just like logging into our account triggers .profile to be read, doing a startx will make linux check for a file in the users home directory called .xinitrc to see if you have any preferences you'd like setup when going into graphical mode. Fluxbox has some peculiarities we'll be touching on shortly, but the important thing is that we use the command "startfluxbox" in our .xinitrc to launch it. Here is the LAST LINE in my .xinitrc:
startfluxbox
It's entirely possible that you don't see an .xinitrc file in your home directory yet. If you are in PCManFM and showing hidden files and it's not there, just right click and Create New -> Text File, then change the filename to exactly ".xinitrc".
IMPORTANT - making these types of changes can break lots of stuff, so here is what I'd do if you are worried about recovering to what you currently have. Open up your home directory in PCManFM and copy any file you plan to change and save them back into the same directory with a "-OLD" at the end. Now we can make changes to the config files and IF we have any trouble we can login as root, go to the users home directory, delete the bad/active config files with the rm command, then copy the -OLD files back to the original names with the cp command. We'll be back to square 1 with our normal user account and able to try again. I won't be talking about backing out configs and commands much, but you should always work with a safety net. I do.
OK once we have our original config files backed up as -OLD files, we ca update the active files them with Geany without doing a su to root because they are in our user accounts home directory. We already have full control of these files. It's a good time to break the habbit of switching to root when not really neccessary. We'll need to exit fluxbox and logout of our user account to test this. Once we log back into linux we should go straight to our fluxbox desktop. OK, I just tried it and it worked perfectly. One final note, I like logging in at the cli and having it kick off fluxbox, it's the very leanest way to get the job done. If you search around you'll see a brazillian posts about gdm, xdm, etc. those are all gui front ends for the login process. I think they just slow down boot times and waste system resources. If you're into bloat maybe you should be reading somebody's blog about fluxbuntu or something.
OK, with all the baby crap out of the way, let's actually do something with fluxbox. You've seen we can do all this configuration and customization of fluxbox from the fluxbox menus inside of fluxbox. This is basically there for noobs. All of fluxbox is driven off of configuration files. Let's get a new theme on here. First thing go into the .fluxbox directory and you'll see a styles directory. Open that up and create a new empty file in there, name it whatever you want and open it with geany, then paste in the follow and save it:
# Thom's style
toolbar: flat crossdiagonal gradient
toolbar.color: grey20
toolbar.colorTo: grey10
toolbar.button: parentrelative
toolbar.button.picColor: grey85
toolbar.button.pressed: flat crossdiagonal gradient
toolbar.button.pressed.color: grey50
toolbar.button.pressed.colorTo: grey80
toolbar.label: parentrelative
toolbar.label.textColor: grey85
toolbar.windowLabel: parentrelative
toolbar.windowLabel.textColor: grey85
toolbar.clock: parentrelative
toolbar.clock.textColor: grey85
toolbar.justify: right
toolbar.font: lucidasans-10
menu.title: flat crossdiagonal gradient
menu.title.color: grey50
menu.title.colorTo: grey10
menu.title.textColor: white
menu.title.font: lucidasans-10
menu.title.justify: right
menu.frame: flat crossdiagonal gradient
menu.frame.color: grey50
menu.frame.colorTo: grey80
menu.frame.textColor: grey20
menu.frame.disableColor: grey40
menu.frame.font: lucidasans-10
menu.frame.justify: left
menu.bullet.position: right
menu.bullet: triangle
menu.hilite: flat crossdiagonal gradient
menu.hilite.color: grey50
menu.hilite.colorTo: grey10
menu.hilite.textColor: white
window.title.focus: flat crossdiagonal gradient
window.title.focus.color: grey50
window.title.focus.colorTo: grey10
window.title.unfocus: flat diagonal gradient
window.title.unfocus.color: grey50
window.title.unfocus.colorTo: grey20
window.label.focus: parentrelative
window.label.focus.textColor: white
window.label.unfocus: parentrelative
window.label.unfocus.textColor: grey60
window.button.focus: parentrelative
window.button.focus.picColor: grey85
window.button.unfocus: parentrelative
window.button.unfocus.picColor: grey60
window.button.pressed: flat crossdiagonal gradient
window.button.pressed.color: grey50
window.button.pressed.colorTo: grey80
window.handle.focus: flat crossdiagonal gradient
window.handle.focus.color: grey50
window.handle.focus.colorTo: grey10
window.handle.unfocus: flat diagonal gradient
window.handle.unfocus.color: grey50
window.handle.unfocus.colorTo: grey20
window.grip.focus: parentrelative
window.grip.unfocus: parentrelative
window.frame.focusColor: grey10
window.frame.unfocusColor: grey50
window.font: lucidasans-10
window.justify: right
borderColor: grey20
bevelWidth: 1
borderWidth: 1
handleWidth: 4
*textColor: grey85
*Font: lucidasans-10
rootCommand: fbsetroot -gradient flatcrossdiagonalgradient -from rgb:4/6/8 -to rgb:3/48/6
bbpager.desktop.focus: flat interlaced crossdiagonal gradient
bbpager.desktop.focus.color: grey50
bbpager.desktop.focus.colorTo: grey10
# END
Once that is saved and closed, right click your desktop to pull up your fluxbox menu and go to styles, you should now see your new style there so go ahead and click it. OK there we've got a nice black and dark gray theme. All of the other styles on the menu are all built in and reside elsewhere in the system. Whatever styles you put into your styles directory are only there for you to use. The most important thing to understand is that the fluxbox themes are completely file driven and customizable. Go search around for fluxbox screenshots and see what people have come up with, often you'll find their config files on the same page as their screenshots.
OK, let's put one more peice of happiness on here before we call it a day. Open up Opera and go find a nice jpg or png you'd like for a background image and save it into ~/.fluxbox/backgrounds.
Now open a terminal and su to root so you can run aptitude:
debian:/home/thom# aptitude install eterm
Eterm has a component that fluxbox will need to setup wallpaper. Next we can open up /.fluxbox/startup with geany. Let's look for a line:
/usr/bin/fbsetroot -solid black
and we'll remark that line out like so:
# /usr/bin/fbsetroot -solid black
Now find this line:
# fbsetbg -C /usr/share/fluxbox/splash.jpg
And we'll remove the # and change the path to our personal background directory:
fbsetbg -C ~/.fluxbox/backgrounds/wallpaper.jpg
Now we can exit fluxbox, log out of Debian, and log back into Debian as our normal username. We should have fluxbox auto start, to our slick theme, and display our wallpaper. Little things you can take for granted huh?
No comments:
Post a Comment