This page will explain how to customize Fluxbox to suite your needs.

Introduction

Although Fluxbox seems quite bare, there is many ways to configure it to better suite how you work. The customization of Fluxbox is controlled by simple text files. Each text file controls one component of Fluxbox.

Menu

The first file up is ~/.fluxbox/menu. This file controls the right click menu. By default this file will be hidden. In file manager it is typically found View->Show Hidden Files. If using the terminal type ls -a

A default menu will look like this:

[begin] (fluxbox)
[include] (/etc/X11/fluxbox/fluxbox-menu)
[end]

The first and last lines define the beginning and end of the menu file, so everything goes between them. The include pulls in the file generated in /etc/fluxbox. Its generated when Fluxbox is installed.

So the basic syntax for an executable (normal program entry) is thus

[exec] (Name you want to show up in the menu) {command} <path to icon>

The [exec] says this is an executable entry. The () is the name you want to show up in the menu. Command is what you'd type in the terminal to run this. It's practice to use the absolute path. You can find the absolute path with the which command. Works for most commands.

kyral@NebulaPeace:~$ which gaim
/usr/bin/gaim

If there is an icon to go along with it, then put that in the <>, but its optional. This all goes on one line and ends with a newline (basically hit return)

Here is how to create Submenus.

[submenu]  (Name of submenu) {}
stuff like execs and other submenus
[end]

The [submenu] tells it that you are making a submenu, the name is in (). The {} is just a null command and is included by convention. You can put anything you want in the submenu, just when you are done defining it close it out with the [end].

That is the basics about the Menu. You CAN have duplicate menu entries. If you would like to remove items for your generated menu you will need to copy/paste the contents of the /etc/X11/fluxbox/fluxbox-menu file into your ~/.fluxbox/menu file and removing the entries that you want.

Here is a sample customized menu.

[begin] (Fluxbox) {}
   [exec] (Gaim) {/usr/bin/gaim}
   [exec] (Firefox) {/usr/bin/firefox}
   [exec] (Irssi) { x-terminal-emulator -T "irssi-text" -e /usr/bin/irssi-text}
   [exec] (Bash) { x-terminal-emulator -T "Bash" -e /bin/bash --login}
   [exec] (BMP) {/usr/bin/beep-media-player}
   [exec] (VLC) {/usr/bin/vlc}
   [exec] (F-Spot) {/usr/bin/f-spot}
   [exec] (Acrobat Reader) {/usr/bin/acroread}
   [submenu] (Apps) {}
        [submenu] (Editors) {}
            [exec] (Emacs) {/usr/bin/emacs21}
            [exec] (Nano) { x-terminal-emulator -T "Nano" -e /bin/nano}
        [end]
        [submenu] (Net) {}

            [exec] (Telnet) { x-terminal-emulator -T "Telnet" -e /usr/bin/telnet}
            [exec] (w3m) { x-terminal-emulator -T "w3m" -e /usr/bin/w3m /usr/share/doc/w3m/MANUAL.html}
        [end]
        [submenu] (Programming) {}
            [exec] (Python) { x-terminal-emulator -T "Python (v2.4)" -e /usr/bin/python2.4}
        [end]
        [submenu] (Shells) {}

            [exec] (Dash) { x-terminal-emulator -T "Dash" -e /bin/dash -i}
            [exec] (Sh) { x-terminal-emulator -T "Sh" -e /bin/sh --login}
        [end]
        [submenu] (System) {}
            [exec] (gkrellm) { /usr/bin/gkrellm }
            [submenu] (Admin) {}
                [exec] (alsaconf) { x-terminal-emulator -T "alsaconf" -e /usr/sbin/su-to-root -p root -c /usr/sbin/alsaconf}
                [exec] (pppconfig) { x-terminal-emulator -T "pppconfig" -e /usr/sbin/su-to-root -p root -c /usr/sbin/pppconfig}
            [end]
            [exec] (aptitude) { x-terminal-emulator -T "aptitude" -e /usr/bin/aptitude}
            [exec] (DSL/PPPoE configuration tool) { x-terminal-emulator -T "DSL/PPPoE configuration tool" -e /usr/sbin/pppoeconf}
            [exec] (GDM flexiserver) {gdmflexiserver}
            [exec] (GDM flexiserver in Xnest) {gdmflexiserver -n}
            [exec] (GDM Photo Setup) {gdmphotosetup}
            [exec] (GDM Setup) {gksu gdmsetup}
            [exec] (pstree) { x-terminal-emulator -T "pstree" -e /usr/bin/pstree.x11}
            [exec] (reportbug) { x-terminal-emulator -T "reportbug" -e /usr/bin/reportbug --exit-prompt}
            [exec] (Run as different user) {/usr/bin/gksuexec}
            [exec] (Top) { x-terminal-emulator -T "Top" -e /usr/bin/top}
            [exec] (X-Terminal as root) {/usr/bin/gksu -u root /usr/bin/x-terminal-emulator}
        [end]
    [end]
    [submenu] (Help) {}
        [exec] (Info) { x-terminal-emulator -T "Info" -e info}
    [end]
    [submenu] (WindowManagers) {}
        [restart] (FluxBox) {/usr/bin/fluxbox}
    [end]
    [config] (Configuration) {}
    [submenu] (Styles) {}
        [stylesdir] (/usr/share/fluxbox/styles) {}
        [stylesdir] (~/.fluxbox/styles) {}
    [end]
    [workspaces] (Workspaces) {}
    [reconfig] (Reconfigure) {}
    [restart] (Restart) {}
    [exit] (Exit) {}
[end]

Fluxbox should add a menu entry when installing a new program. In the few instances that it does not, you have two options. First, you can manually add your menu entry before or after the include command. Fluxbox parses the include command inline with the current menu. Secondly, you could copy/paste the contents of the /etc/X11/fluxbox/fluxbox-menu file into your ~/.fluxbox/menu file and add the menu entries that were not automatically added.

Keys

The keyboard shortcut definitions are all stored in ~/.fluxbox/keys

Fluxbox comes with a few shortcuts preset, namely the familier Alt-TAB and mapping Alt+F1 through F12 to the 12 workspaces. Here is the syntax for mapping keys.

<mod> [<mod> <mod>] key [key key] :command <command_options>

<mod> is called a modifier, one of the keys that typically modify another. The typical modifiers are

Mod1    == Alt
Mod4    == Windows key
Control == Ctrl
Shift   == Shift

Most of the other keys are what you expect. However there are a few odd keys. To check, there is a tool called  xev . Call it on the command line and start hitting keys. A LOT of gibberish will come up, like this

KeyPress event, serial 30, synthetic NO, window 0x1800001,
    root 0x3e, subw 0x0, time 3967824504, (728,435), root:(799,525),
    state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

Now most of that is gibberish that we don't need. What we want is the part in  keycode <something> (keysym <something>, Shift_L)  That last part (Shift_L) is what X sees the key as, thus its name. So use it (note the rules above about naming overrule this, so Alt is still Mod1, etc)

The format for the key combo is simple. Alt+F1 would be  Mod1 F1 . After the colon is what the combo does. There are many options, but I am going to go through the ones I think will be most useful.

Action

Description

Close

Closes out the current window

Minimize

Minimizes the current window

MaximizeWindow

Maximizes the window

ShowDesktop

Minimize all windows

Restart

Restart Fluxbox

Quit

Quit Fluxbox and return to the login screen

Exec

Run the specified command. Either give the command or the absolute path to the program (think what you did for the menu file)

Apps

The ~/.fluxbox/apps file controls window features of specific apps. Some of the features include size, locations, and workspace. Most of the time these can be set with the Remember... submenu when right-click on a window's titlebar. To save to the apps file you will also need to click Save on close in the same submenu. After saving, running the app again will invoke the saved specifics in the apps file.

For more detailed guide on editing the apps file that includes advanced features see the Fluxbox wiki apps guide.

Startup

Near the bottom of ~/.fluxbox/startup you will find a section that reads:

# Applications you want to run with fluxbox.
# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN ''&'' AT THE END.

Here put all the programs you want to load with Fluxbox. Some things to consider. XScreensaver (which controls the screensaver and screen locking) is not loaded Fluxbox by default, so you might want to add it to the startup script with  xscreensaver & . The trailing ampersand (&) tells it to run in the background , like it should). This goes the same for other programs like the Beagle daemon,  beagled & . For other programs, like GAIM, GKrellm (which is a REALLY good complement to Fluxbox), and anything else you want starting just put the command.

If you need to wait until Fluxbox is fully loaded before running a command you can add the sleep command. The line you then look like this (sleep Xs && <command>) & where X is the delay in seconds and <command> is the command you want to run.

Gnome Support

Many people like to use Nautilus, Gnome themes, or even the Gnome panel in Fluxbox. In order for this to function smoothly, the following must be added to your startup script:

GSDPID=`pidof gnome-settings-daemon`
if [  "x$GSDPID" == "x" ]; then
gnome-settings-daemon &
fi

Starting Fluxbox

Right at the bottom is the command to start Fluxbox. Notice that here we are running /usr/bin/fluxbox WITHOUT a trailing ampersand (&).

Slit

Dockapps are small "dockable" applications which reside in a small "Dock" (which, in Fluxbox's terminology, is called "the slit") on one corner of your screen. They can be informative (clocks, calendars, system info), functional (volume controls, drive mounting utilities), convenient (controls for other applications), or even merely entertaining (minigames, fortune cookie displays, etc.). The vast majority of dockapps seem to have been originally developed for the WindowMaker and AfterStep window-managers, but work fine within Fluxbox. A good selection of them is available in the Ubuntu repositories (if you want to have a look, execute sudo apt-cache search dockapp in a terminal window), and many more can be found and compiled should you wish to do so.

You can load your dockapps when Fluxbox starts up by including them in ~/.fluxbox/startup the same way you start any other program in the startup file: simply type the command, followed by a trailing ampersand (&).

Some popular dockapps can be found in the Universe repositories and can be installed using apt-get or Synaptic:

wmxmms: used to control XMMS (play, pause, next, previous, volume, position)
wmcpuload: displays the CPU load in percentage
wmmemload: displays how much memory is used 
wmweather, wmweather+: displays the weather
wmclockmon: displays the date and time
docker: displays gnome-applets (like nm-applet and gnome-power-manager) without gnome panel
wmmount: mount/unmount/open volumes such as cdrom drives and harddisks
wmmatrix: shows the matrix screensaver just for fun
wmtop: shows the current running processes that use most resources at the moment

Setting the Background

Now playing around with menus and keybinds is all well and good, but you want to set a background right? Easy!

fbsetbg -f /path/to/image_file

Tip: "fbsetbg -l" sets the last used wallpaper as the desktop and could be added to ~.fluxbox/init as: session.screen0.rootCommand: fbsetbg -l

Note: fbsetbg is just a wrapper for other things that set wallpapers, such as Esetroot and feh. If you have one of those installed fbsetbg will determine the best one to use and use it. To find out what fbsetbg is using run  fbsetbg -i 

Feh can be found in the feh package.

Esetroot comes with ETerm, which can be found in the eterm package.

To set the background (overriding the style!) uncomment the fbsetbg line and place the location of the image as the argument to fbsetbg. Then comment out the part about setting a black background.

Styles

You can set the background just fine, but what about the theme. Well there is good news and bad news. The good news is that Fluxbox ships with a lot of themes (called Styles) by default. The bad news is that they only affect the windows themselves, not the "interior". That means if you are running GTK apps, then they will use the default grayish theme. Now thats good on its own, but it can really mess up a colorscheme. You can change it though, but first how to install and use Styles themselves.

Changing Styles is quite easy. Just to go the Styles submenu and click on it. Be warned though, some styles will override your background with their own, so you will have to change it back. Now what if you want to install a new style? Well first you have to know where to FIND them.

Here are some websites to get themes from:

Tenner's site is the site for fluxbox styles. You will find of 500 styles there available for individual download --or-- you can download his nightly build tarball containing ALL styles. This site also provides tutorials and specifications for fluxbox theme design.

Once you find one you like, download the tarball to ~/.fluxbox and extract it. One of two things will happen. It will be a good tarball and just put its files into ~/.fluxbox/styles, or it will put them someplace else in ~/.fluxbox. If the former occurs, then you are all set, the theme is in the Styles menu now. In the case of the latter you will have to find its style directory and move the file in it to ~/.fluxbox/styles. Fortunately 99% of the time it will make its own directory and the style dir will be in that (this is why we extracted in ~/.fluxbox, there aren't many dirs in there to begin with so its obvious when a new one is made).

Now thats all well and good, but I mentioned being able to apply GTK Themes. Yes you can. Install GTK Theme Switch with gtk-theme-switch and run it with  switch2 . A little dialog will pop up with a dropdown of all the GTK Themes installed. Just select and apply. Keep in mind that the Style will still be in control of the Window Decorations (Titlebar, window borders, etc), so if the GTK Theme normally sets those, it won't, but the rest of it will work. A good source of GTK Themes is GNOME-Look. Stay away from the Metacity themes though. Those flat out won't work. Also if you need to install a new GTK theme, just download the tarball to ~/.themes and extract it.

Suppose you want to ensure that the background you set last stays there even after you reboot, just go find the *.cfg file for your theme. Look around for a line that goes like this;  rootCommand: ## 

Simply edit that line to read as follows;

 rootCommand: fbsetbg -l 

or you can plainly edit the ~/.fluxbox/init file and place the following line there;

 session.screen0.rootCommand: fbsetbg -l 

Customizing Colors for GTK Applications

To customize colors for GTK Applications, use alt-f2 to open gnome-panel, then go to system -> preferences -> appearance and set the colors as you normally would in a gnome environment. you can then kill gnome-panel by typing pkill gnome-panel in a shell or from alt-f2.


CategorySystem

Fluxbox/customize (last edited 2011-04-07 17:29:59 by jdmcclung)