Monday, October 17, 2016

A 5 minute guide to Fluxbox

A 5 minute guide to Fluxbox


With all the rage about Unity and Gnome 3, people are sometimes looking for an alternate window manager. While KDE or XFCE are often suggested, Fluxbox is another viable alternate.
The purpose of this guide is to suggest a few tools and "simple" configuration options to get you started with Fluxbox, hopefully within 5-10 minutes.
This guide assumes you are adding Fluxbox to a desktop environment, such as gnome, and not starting with a minimal installation.
Using any method (apt-get, yum, graphical tools) install :
fluxbox
feh (used to set background images)
xcompmgr (used for transparency and other effects)
lxappearance (manages gtk, icons, and mouse themes)
nitrogen (graphical tool to set background images)
dmenu (graphical tool to run commands, uses lists and tab completion)
xscreensaver

Fedora

yum install fluxbox feh xcompmgr lxappearance nitrogen xscreensaver dmenu

Debian/Ubuntu

apt-get install fluxbox feh xcompmgr lxappearance nitrogen xscreensaver dmenu

Generate a menu

Fedora The default Fedora menu is a bit barren, but can be easily remedied with fluxbox-xdg-menu. This python script is quite versatile and has several options, including setting an icon theme and custom paths to background images. see fluxbox-xdg-menu - -help for details
fluxbox-xdg-menu --with-icons --theme /usr/share/icons/Faenza-Dark --with-backgrounds --bg-path=~/Pictures
Debian/Ubuntu users should have a menu configured out of the box. The default menu can be a bit crowded, so if you prefer you can download fluxbox-xdg-menu from Google code.

Customize the menu

This section is to give you a few helpful tips to further customize your menu.
You will need to restart Fluxbox after editing your menu.

Custom title

The title is set at the top of ~/.fluxbox/menu, on the "[begin]" line. Change "Fluxbox" to your desired title
[begin] (bodhi’s menu)

Add favorites

Favorites : Choose a list of your favorite applications and add them to the top of the menu, just under the title.
[include] (~/.fluxbox/fbfav)
Next, using any editor, open a new file ~/.fluxbox/fbfav and add in your applications.
The syntax is :
[exec] (Menu_name) {program} <path_to_icon>
Icons are optional
Example :
[exec] (Firefox) {/usr/bin/firefox} </usr/share/icons/Faenza/apps/32/firefox.png>
[exec] (Midori) {/usr/bin/midori} </usr/share/icons/Faenza/apps/32/midori.png>
[exec] (Audacious) {/usr/bin/audacious2} </usr/share/icons/Faenza/apps/32/audacious.png>
[exec] (Xchat) {/usr/bin/xchat} </usr/share/icons/Faenza/apps/32/xchat.png>
[exec] (Nautilus) {/usr/bin/nautilus -no-desktop} </usr/share/icons/Faenza/apps/48/nautilus.png>
[exec] (Terminal) {/usr/bin/gnome-terminal} </usr/share/icons/Faenza/apps/32/utilities-terminal.png>
[separator]

Backgrounds

Here I will set background images with nitrogen.
Alternately you can set a background from your menu using fbsetbg. The disadvantages of this method are:
  • Your menu tends to look crowded.
  • You will need to manually maintain a list of images.
[include] (~/.fluxbox/fbbg)
Example (change "bodhi" to your user name):
[submenu] (Backgrounds)
[exec] (bodhi) {/usr/bin/nitrogen ~/Pictures}

[exec] (system) {/usr/bin/nitrogen /usr/share/backgrounds}
[end]

Xscreensaver

Menu enteries for xscreensaver.
[submenu] (Screen saver)
[exec] (Enable screensaver) {/usr/bin/xscreensaver}
[exec] (Disable screensaver) {/usr/bin/xscreensaver-command -exit}
[exec] (Lock screen) {/usr/bin/xscreensaver-command -lock}
[exec] (Configure screensaver) {/usr/bin/xscreensaver-command -prefs}
[end]

Switch user

This is an extremely useful feature when sharing your computer.
[exec] (Switch User) {/usr/bin/gdmflexiserver -a}

Graphical tools

1. File managers – If you are migrating from gnome you can use nautilus both to browse your file system and to mount/unmount removable devices. pcmanfmis an alternate to nautilus.
[exec] (Nautilus) {/usr/bin/nautilus --no-desktop}
2. lxdeappearance is a lightweight tool to manage gtk, icon, and mouse themes.
3. nitrogen is a graphical tool to set background images. If you have multiple monitors, nitrogen is capable of setting a different background on each monitor.
4. xcompmanager will add some desktop effects. You may need to add the following to your /etc/X11/xorg.conf :
Section "Extensions"
Option "Composite" "Enable"
Option "RENDER" "Enable"
Option "RenderAccel" "true"
Option "AllowGLXWithComposite" "true"
EndSection
See the Fluxbox wiki for additional information.

Configure applications to start at log in.

Fluxbox uses ~/.fluxbox/startup, simply add in applications above the exec fluxbox
Example :
/usr/bin/nitrogen --restore &
/usr/bin/xscreensaver &
/usr/bin/start-pulseaudio-x11 &
/usr/bin/xcompmgr -f -c -n -C -F &

# Network manager
nm-applet >/dev/null 2>/dev/null &

#Wicd
wicd-client -n
exec fluxbox

Logout

On rare occasions the log out option on the fluxbox menu seems to stop fluxbox, but applications remain open. As a work around I use:
[exec] (Log Out) {killall fluxbox && killall fluxbox}

Fluxbox keys

Fluxbox keys are custom key bindings and add functionality and shortcuts.
Fluxbox uses ~/.fluxbox/keys for configuration :
Mod1 key is the Alt key
Mod4 key is the one with the Windows logo on it. This key is often available for custom key bindings.
The syntax is
key stroke :Command
Example :
Mod4 f :Exec /usr/bin/firefox
Mod1 F2 :Exec ~/bin/dmenu.sh
Note: the dmenu.sh requires you to have installed dmenu and written the dmenu.sh script. My dmenu.sh looks like this:
#!/bin/bash
$(dmenu_path | dmenu -nb #333333 -sb #1E2320 -nf #B3B3A1 -sf #A3CACC)
For additional information see the Fluxbox wiki key bindings page .
You will need to restart Fluxbox after editing your keys file.

Light weight applications

Light weight applications are simply going to give you better performance, at the expense of features. For example, can you use gedit rather then OpenOffice (LibreOffice) .
Arch Linux - Lightweight applications
Some of my personal favorites are gedit, cream, vim, dmenu, and sakura .

Additional information

For additional information see:
Fluxbox wiki
Fedora forums fluxbox guide
Ubuntu forums fluxbox keys
This entry was posted in Linux and tagged Fluxbox. Bookmark the permalink.

Available link for download