Introduction to Fluxbox


Recommended Posts

Introduction to Fluxbox

What is Fluxbox: http://fluxbox.sourceforge.net

Fluxbox is a lightweight Window Manager. It provides a simple, clean user interface. So clean, in fact, that it does not include desktop icons (though these can be added in, if you wish). You will have a toolbar and a desktop. Your menu is called up by right-clicking on the desktop, and it will appear at your mouse cursor location. Just navigate the menu in standard fashion, and click on the action you wish to take, or the application you wish to start.

Install Fluxbox

I will assume that you have used the appropriate tool for your distro to install fluxbox, or have installed it. If you have tried installing fluxbox, but cannot get it to work and need assistance, please post it as a separate thread.

Basic Options

Fluxbox puts the basic configuration tools for fluxbox in the ?fluxbox menu?. From here you can select many different operating features and themes. Most of these are pretty basic, and are easy to understand what they do. For example, the toolbar (taskbar) location, dimensions and transparency (if you have your X configured to support transparency). The application menu is not accessed by using a "start" button, but by clicking the right mouse button on the desktop. My menu happens to look like this:

post-36818-1118283960_thumb.jpg

I have also added an item to my menu called ?Text Edit?. This has shortcut commands to open a text editor with either my menu, keys or startup file. Yes, that's right; to make many changes to fluxbox, you will need to get your hands dirty and edit a text file. If this has you concerned that fluxboxtoo>too minimalistic, then perhaps fluxbox is not the Window Manager for The ~/.fluxbox/menu FileFile

The menu file, contained in the hidden .fluxbox directory in your home directory, is a marked-up file that ceverythinghing that will be the contents of your right-click application menu. The format allows nesting, and even icons. Here is a sample of the first few lines in mine:

[begin] (Fluxbox)
  [exec] (xterm) {xterm}
  [exec] (firefox) {firefox}
  [exec] (thunderbird) {thunderbird}
  [exec] (Run...) {fbrun }
  [submenu] (Terminals)
	[exec] (xterm) {xterm}
	[exec] (gnome-terminal) {gnome-terminal}
	[exec] (konsole) {konsole}
  [end]

Each line starts with a fluxbox keyword in square brackets. For the most part they are pretty simple. [begin] starts the fluxbox menu. [exec] indicates an executable item is being inserted at that location. [submenu] starts the definition of a submenu. Both the [submenu] and the single [begin] keyword require an [end] keyword to indicate when that section is complete. The keyword [separator] will add a thin horizontal line separator into the menu.

After the [begin] and the [submenu] items, you can add the text label to be displayed for that item. It is enclosed in parentheses, like (this). So, you can see in the code example above, my fluxbox menu is called ?Fluxbox?. Not terribly creative, but it is descriptive. You can also see that the submenu I have defined is called ?Terminals?, and it contains several [exec]utable apps. And, as the clever among us may have surmised, that the parentheses set after each [exec] contains the label that the user will see in the menu. This is not commande command that is issued. The command to be executed is enclosed in curly braces, like {this}. And, yes, you can pass arguments within the curly braces. The line [exec] (Awesome Site) {firefox www.neowin.net} would display ?Awesome Site? in the menu, and when clicked, would open up firefox to the Neowin home page.

If you want to get fancy with your menus, you can even add icons to your items (including [submenu]s). To do this, put the path to the image in between a set of less-than and greater-than symbols, like this:

[submenu] (fluxbox menu) <~/.fluxbox/pixmaps/fluxbox.png>

The icon will be resized to fit your menu, and will appear on the left The ~/.fluxbox/keys Fileluxbox/keys File

This file contains shortcut key combinations to execute functions you wish. You can use these to do the obvious task of application launching. You also have a healthy amount of fluxbox-specific commands to affect your environment or active window, such as close, minimize, shade, resize and so forth. A sample of my current keys file is here:

# Control, Shift, Mod1 (Alt), Mod4 (Windows)
# are valid modifiers to key commands
#
Mod1 Tab :NextWindow
Mod1 Shift Tab :PrevWindow
Mod1 F4 :KillWindow
Mod1 Print :Exec import -window root ~/print.png
Mod4 k :Exec xterm
Mod4 e :Exec xfe
Mod4 Shift e :Exec konqueror ~
Mod4 r :Exec fbrun
Mod4 l :Exec xscreensaver-command -lock
Mod4 d :ToggleDecor
Mod4 Print :Exec import ~/print.png
Control Mod1 x :Exec oocalc
Control Mod1 w :Exec oowriter
Mod4 Left :Exec 3ddesk --gotoleft
Mod4 Right :Exec 3ddesk ?gotoright

You can see that the left-hand side declares the keyboard combination, followed by a colon, then the command (or fluxbox-specific keyword). You can see that I mapped Windows+E to my xfe application (my preferred GUI filesystem explorer), and Windows+L to lock my display. These actions match the keys used in Windows, so I can quickly do these things on either OS I am working with. You can also see I have ALT+Tab and ALT+F4 mapped to mimic their Windows counterparts, as well.

The "Exec" (or "ExecCommand") keyword is used to denote that the text immediately following is a command (app or script) to be executed, just as if it were started from a terminal. Without the "Exec", flux will assume you are using a built-in keyword.

Do you have "special keys" on your keyboard? Ones that don't have normal ascii codes, like buttons to increase/lower volume? Or to open your email client and such? Even without an X keybinding, you can bind these mystery keys to apps or functions in your keys file! First, you need to open a termxevfire up the xev app to display X events. Press one of your mystery keys, and you will see output like the following.

KeyPress event, serial 32, synthetic NO, window 0x2000001,
	root 0x13a, subw 0x0, time 3204054097, (867,651), root:(868,673),
	state 0x0, keycode 161 (keysym 0x0, NoSymbol), same_screen YES,
	XLookupString gives 0 bytes: 
	XmbLookupString gives 0 bytes: 
	XFilterEvent returns: False

KeyRelease event, serial 32, synthetic NO, window 0x2000001,
	root 0x13a, subw 0x0, time 3204054097, (867,651), root:(868,673),
	state 0x0, keycode 161 (keysym 0x0, NoSymbol), same_screen YES,
	XLookupString gives 0 bytes: 
	XFilterEvent returns: False

Skeycode 161ays keycode 161? That is the code associated with the button on my keyboard with an icon of a calculator on it. To make it run a simple calculator, I add the following into my ~/.fluxbox/keys file:

None 161 :Exec xcalc

And, of course, I can repeat this for any of my other keys, too, and fire up firefox or thunderbird, or make a call raise the audio volume 5%. You can use the shift and other Mod keys to have different functions. My browser key can open a blank page when pressed by itself, but open up Neowin.net when I The ~/.fluxbox/startup File: one possibilitye: one possibility

Some distros use a "startup" file to handle the first actions of Fluxbox when you log in. This contains the instructions that fluxbox executes on startup. You will probably have a default file included that will start up fluxbox successfully. If you would like to have apps like kmix and pidgin start up (they will iconize to your toolbar), you just add them in. Remember to put an ampersand ("&") after the command, so that the command will be started, then execution will continue to the next item without waiting for your commanded application to finish. Here are the additional apps I choose to start with fluxbox (it varies somewhat, depending on my mood, and I will add a '#' to the front to comment out items when I don't want them any more, that way I may remove the '#' and re-add the application in the future.

fbsetbg -f ~/.fluxbox/backgrounds/Orange_Bed_1600.jpg &
# fbsetbg -f ~/.fluxbox/backgrounds/OS-Tux-1600x1200.png &
kmix &
pidgin &
krandrtray &
# gkrellm -w &
xscreensaver -nosplash &

The fbsetbg sets the desktop background to the image I specify. The others are launching some fairly common apps. The xscreensaver command is important, as it starts the daemon up, so that my desktop will timeout and lock after a period of inactivity. This is important, as my three year old likes to use any computer that he sees unlocked, and I have found that he is quite capable of annoyances like starting apps, changing desktops, and even altering some of my preferred usThe ~/.fluxbox/init File.fluxbox/init File

Fluxbox has an "init" file that is used when you log in with Fluxbox as your Window Manager. The init file works with another file named ~/.fluxbox/apps that contains information about different apps, such as their workspace, location and geometry.

A sample of this file is here:

[startup]	{pidgin &}
[startup]	{juk &}
[startup]	{firefox &}
[startup]	{mozilla-thunderbird &}
[app] (xterm)
 [Workspace] {0}
 [Close] {yes}
[end]
[app] (konsole)
 [Workspace] {0}
 [Dimensions] {713 436}
[end]
[app] (gedit)
 [Workspace] {2}
 [Dimensions] {796 534}
[end]

You can see that you can set specific applications to start when you start Fluxbox, by using the [startup] keyword. Again, using the ampersand ("&") is important, so execution can continue. The keyword [app] can be used to set the [Workspace], [Position], and [Dimensions] of apps that you would prefer to start up in Fluxbox Window Manipulationindow Manipulation

Fluxbox windows are very basic. They don't even have to have the usual titlebar. They may have a short tab just containing the application name. These tabs can be grouped, if you wish. An example of this (with tabs on the side) is on the fluxbox page here. You may find this feature useful, and they show it used to group GIMP windows together.

Tabs may also be incorporated into the titlebar, itself. You can middle-drag any titlebar/tab into another window's space, and it will be added to that window. The titlebar will be segmented, with the different titles displayed in their respective sections. This is very useful, and not as obtrusive as the side-tabs.

Windows can be moved around by the titlebar or tab, and have a resize widget only in the lower corners (at least, so I find). However there are some keyboard modifiers that may be used to move or resize without requiring you to move the mouse to a specific area of your window. Use ALT in combination with dragging your left mouse button to move the window, and use ALT in combination with your right mouse button to resize the window (just as if you were draggingSelecting a Style>Selecting a Style

Fluxbox comes with several "Sytem Styles" that will show you some of the variety of alterations that can be done with the visual styles presented. The more basic styles use the built-in property definitions (colors, border widths, etc.), while more advanced options allow using small pixelmapped images to use as decorations. The system styles are usually loaded somewhere like /usr/share/fluxbox/, where you (as a normal user) will not be able to alter them. However, fluxbox also provides for a location for user-defined and alterable styles. Typically this will be in your home directory at ~/.fluxbox/styles<More Information than Imaginableon than Imaginable

Want to learn more details on what I have covered so far? It is all in the fluxbox man file! Now, theonebe at least one person surprised by this, right? Well, the man page for fluxbox is very complete. It may not be a good read the first time around, but there is a TON of useful bits and pieces of information in there that I just don't have the time or space to cover in this quick introduction to flux. Once you have the above concepts down, reading the man page wMaking your own Styleing your own Style

I will present a sample of a user-created style, and will show you how to make a style like this:

post-36818-1119484092.png

The regular windows, the fluxbox menu and the titlebar will have this theme.

Take this "tutor.txt" file, and copy it into your ~/.fluxbox/styles directory (you can remove the irritating .txt extension that the forum requires for me to upload). This file will supply all the basics for your color theme. Go ahead and try it! It should be under Fluxbox Menu > User Styles. Look through the file and see where each color can be defined (and you can have everything use different color schemes for a chaotic-looking style, if you wanted). I have also defined some images to use (in .png format, but other formats such as .xbm will work fine) but these don't yet exist on your system.

Ok, the colors are there, but no fancy pixmapped widgets or customized titlebar blends. For this, we will add in the images that I drew up and put into a tarball here:

tutor.tgz.zip

You will need to untar this to your ~/.fluxbox/pixmaps directory, because that is where I told it to look in the ~/.fluxbox/styles/tutor file. The tarball should create a "tutor" directory filled with images, all directly under your pixmaps directory. Reload your tutor style, and you should have the hand-drawn images as your widgets. It should be noted, if you are making your own pixmap window buttons (close, minimize, etc) that fluxbox requires these to be square. Images will be scaled to be square, if you have made them rectangular. This may have an undesirable distortion effect.

Our final exploration on Fluxbox customization is back to the ~/.fluxbox/init file. Search for some lines that look like

session.titlebar.left:	Close Stick Shade 
session.titlebar.right:	Minimize Maximize Close

this is where you can define where you place your window action gadgets. You can put these items on either side, and if you don't want to have a pin or shade icon, you can not include them on the list and they will not be there.

Looking through the init file you can see other items, like the number of workspaces, and their names, whether or not window moves are made opaque or outlined. Feel free to modify items in here to see what they do (good idea to make a backup, just in case). If you have any favorite modifications you like to make, post them in this threadNext...?!

Next...?

One final item I would like to cover is the fbdesk add-on (even though I don't like it, personally) that allows you to add desktop icons to fluxbox. I will try to get to this at a later date.

I hope that this basic first look at what fluxbox is, and how to set it up proves itself to be interesting and helpful to the new fluxbox user.

Thanks go to contributions by:

LechioPT

theotherdave

Edited by markjensen
Link to comment
Share on other sites

hrm... how strange. I was just about to ask you about fluxbox.

I'm getting sick of Gnome. I want more! (or less... as it may be :p)

Can we get some more of these articles, about different window managers?

That would be cool.

Link to comment
Share on other sites

If you run fluxbox under Debian then there is no need to write your own menu. Whatever you install via apt-get will be added/removed automatically.

Isn't there a fluxbox GUI menu editor too?

Link to comment
Share on other sites

fluxconf?

also... can we see your menu file, mark?

And... is there any way that you can make it so that when you maximize a window, it doesn't cover the bar at the bottom? Like a standard window setup? - done.

Edited by shrike
Link to comment
Share on other sites

Can we get some more of these articles, about different window managers?

586039490[/snapback]

If anyone would like to write up something on the Window Manager that they prefer and post it in the Customizing section, I am sure it would be appreciated by the others here that are looking to try other options to their current WM/DE. As for me, there is more I need to add to this fluxbox intro, so I am tied up (plus I have only used Gnome, KDE, XFCE(briefly) and flux).
If you run fluxbox under Debian then there is no need to write your own menu.  Whatever you install via apt-get will be added/removed automatically.

Isn't there a fluxbox GUI menu editor too?

586039547[/snapback]

I don't add in a lot of new apps. Having any apps added automatically is nice, but I think it is good to know how to edit and change things to your liking.

As for the GUI menu editor, one probably exists (the menu file is very simple and would be easy to create with a simple app) but I haven't heard of one. There is a fluxconf app that allows you to set things like toolbar location and size by a GUI interface. It doesn't edit menus. It is crude and simple, but it is more fun to see all the options in the text files, anyhow. ;)

can we see your menu file, mark?

586039551[/snapback]

I'll post the whole thing later, when I get back home. The add-ins I put for "Text Edit" of important flux files is very useful, but it is easy enough to add yourself now, if you want:

[submenu] (Text Edit)
  [exec] (menu) {kedit ~/.fluxbox/menu}
  [exec] (keys) {kedit ~/.fluxbox/keys}
  [exec] (startup) {kedit ~/.fluxbox/startup}
[end]

and place that where ever you want that submenu to appear in your menu. I like kedit as my editor, but you can have it use any editor you prefer.

Link to comment
Share on other sites

I must say I'm liking Fluxbox much more than I thought I would.

I tried it out a few months ago, but because I didn't have anywhere decent to go to, I got lost.. and gave up.

These tutorials on Neowin are much more helpful that the howtos on the web. Go figure :s

Link to comment
Share on other sites

also... can we see your menu file, mark?

586039551[/snapback]

Posted

menu.txt

Nice job Mark.  Thank you.

586039881[/snapback]

Thank you.
Link to comment
Share on other sites

Sweet guide! I've been using fluxbox for the past 2 weeks, and really like it. The only problem I'm having is that gtk apps don't look as good under fluxbox.

post-40659-1118362091_thumb.jpg

Link to comment
Share on other sites

The only thing that looks out of place in your screenie is xfe (which I have decided to dump - started hogging all my resources and made my box sluggish.  I started it either last night or in the morning, but it never died and kept gobbling up memory and CPU cycles, so when I got back home in the evening, I could barely run top to see what was killing me.  Eventually a killall fixed that.

I probably should do a writeup on fluxbox styles, and how to create your own and use pixmaps...  But not today, I'm exhausted.

586042506[/snapback]

No, Firefox and Gaim are all using the the default gray gtk theme which is ugly.

Link to comment
Share on other sites

Sweet guide! I've been using fluxbox for the past 2 weeks, and really like it. The only problem I'm having is that gtk apps don't look as good under fluxbox.

586042359[/snapback]

The only thing that looks out of place in your screenie is xfe (which I have decided to dump - started hogging all my resources and made my box sluggish. I started it either last night or in the morning, but it never died and kept gobbling up memory and CPU cycles, so when I got back home in the evening, I could barely run top to see what was killing me. Eventually a killall fixed that.

I probably should do a writeup on fluxbox styles, and how to create your own and use pixmaps... But not today, I'm exhausted.

Link to comment
Share on other sites

Anyway to change that GTK theme? I'm not using Fluxbox (e17) but I'm annoyed by it. :pinch:

586043280[/snapback]

I have found the solution, install the qt-gtk theme engine, and start KDE in kctontrol you can change what theme to use for GTK apps.

Link to comment
Share on other sites

I have found the solution, install the qt-gtk theme engine, and start KDE in kctontrol you can change what theme to use for GTK apps.

586047707[/snapback]

Nah I used the 'switch2' command. Dont even have KDE installed lol. ;)

Link to comment
Share on other sites

  • 2 weeks later...

I've been on this board for a week and I've been trying out a few WMs... it's flux's turn :)

I have something I'm not able to do so far..

The ~/.fluxbox/startup File

The final file I want to cover is the startup file. This contains the instructions that fluxbox executes on startup. You will probably have a default file included that will start up fluxbox successfully. If you would like to have apps like kmix and gaim start up (they will iconize to your toolbar), you just add them in.

Where can I find the 'default file that start fluxbox up successfully? It's not ~/.fluxbox/startup, that didn't exist till I created it. Any ideas, people?

Link to comment
Share on other sites

What distro are you using?

Are your ~/.fluxbox/menus and ~/.fluxbox/keys files present?

We might need to dig in and see how your fluxbox is started, as I could not find an alternate location for the startup file in a quick google.

Link to comment
Share on other sites

Sorry, I should have mentioned distro in the first place :blush: I'm on Ubuntu

Both ~/.fluxbox/menu and ~/.fluxbox/keys are present, and have been (successfully) edited.

-edit-

I didn't actualy remove or add any items in the menu file, just changed the order and the submenus.

Edits to the keys file shouldn't have done anything, should it?

~/.fluxbox/init remains unchanged

Edited by theotherdave
Link to comment
Share on other sites

Hmmm... It appears that Debian (and children, like Ubuntu) use ~/.fluxbox/init

http://ubuntuforums.org/archive/index.php/t-8907.html

See if that thread helps. If so, let me know how the init file works, and I will modify the first post to reflect the two different methods. (Y)

Link to comment
Share on other sites

Thanks, mark, that thread has been very useful.

It seems that there is a file, ~/.fluxbox/apps which holds various details about various apps (apptly enough :p) such as default size, workspace and positioning etc.

To add startup programs what I had to was [startup] {app-name} eg mine looks like this:

[startup]    {gaim &amp;}
[startup]    {juk &amp;}
[startup]    {firefox &amp;}
[startup]    {mozilla-thunderbird &amp;}
[app] (xterm)
  [Workspace]	{0}
  [Close]	{yes}
[end]
[app] (konsole)
  [Workspace]	{0}
  [Dimensions]	{713 436}
[end]
[app] (gedit)
  [Workspace]	{2}
  [Dimensions]	{796 534}
[end]
[app] (Gecko)
  [Workspace]	{1}
  [Dimensions]	{1019 746}
  [Position]	(UPPERLEFT)	{3 0}
  [Close]	{yes}
[end]
[app] (konqueror)
  [Workspace]	{0}
[end]

I haven't had much luck using this to set by bg however.

 [startup] {fbsetbg ~/.fluxbox/backgrounds/bg.jpg}

What seems to happen when I place that at the beginning of the file is I get my background, then flux loads up with a blank backgrund (the DevArt pic in question effectively makes a pretty splash :p)

Link to comment
Share on other sites

Put this entry on yor ~/.fluxbox/init file :

session.screen0.rootCommand: ~/.fluxbox/autostart.sh

then create a file named autostart.sh and make it executable ( chmod +x autostart.sh), move it to the ~/.fluxbox folder.

The file should contain something like this:

#!/bin/bash

~/.fluxbox/mybg.sh

create another file named mybg.sh and make it executable ( chmod +x mybg.sh) , move it to the ~/.fluxbox folder.

The file should contain something like this:

#!/bin/sh
fbsetbg ~/.wallpaper &amp;

Now make a symbolic link of an image you want as background to the ~/.wallpaper file:

ln -sf /PathToSomeImageFromDevArt ~/.wallpaper

Whenever you want to change the background you just alter the ~/.wallpaper file,

this makes it allot easier.

Oh, and you can put other commands in there, just be sure

to put an & at the end of each command.

Link to comment
Share on other sites

heyhey! Thanks for that. It's a lot nicer than the hack I was using to get the backgroud up - I was loading xterm (which saves commands from previous sessions when you use the up key) to quickly load my Background and exit, and use Konsole for everything else - ugly bit it worked :p

This will let me do it properly, so thanks again :D

Mark, I guess with this info you can add to the guide for Debian etc..

Thanks again, people!

Link to comment
Share on other sites

Ah wish I had this thread when I was trying to get flux running a month or so ago... :pinch: would have made things alot faster and easier.

Link to comment
Share on other sites

^^^ :p This thread didn't exist a month ago, silly!

I will integrate LechioPT's and theotherdave's additional info when I get home and have the free time to do so. Thanks for the detailed info. (Y)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.