Monday, October 24, 2016

fluxbox



Configuration

[edit]Xsession

If you are using a log-in manager such as GDM, you should be able to select Fluxbox from the appropriate menu. If you want to use the default XDM that comes with X.Org, edit /etc/rc.conf and change the line that reads XSESSION="Xsession" toXSESSION="fluxbox".
If you dont plan on using a graphical login manager then you can configure the global /etc/X11/xinit/xinitrc or the per-user~/.xinitrc file to run it via startx. See Xsession for further instruction.

[edit]Basic Usage

Starting up other applications when you log in to Fluxbox is handled by the ~/.fluxbox/startup file, which will be covered later in this article.
When you first start Fluxbox, you should see a blank background and a little toolbar at the bottom. The interface is fairly intuitive. Right-clicking on the background pops up the Fluxbox menu. The toolbar works as expected, showing the icons of every open window. The screen is divided into four workspaces by default, in a similar way to KDE. This means that applications that are open in one workspace wont show up on the other ones. You can also move applications through workspaces by selecting Send To... in their right-click menus, or by dragging the window to the edge of the screen.
Now that you have a working Fluxbox installation, you will first want to customize the functionality to your needs and work habits. Lets check the files in the ~/.fluxbox directory.
  • init: Main configuration file.
  • menu: File that changes the items in your root menu.
  • keys: Lets you change keybindings and create new ones.
  • apps: Stores information about every application that you want Fluxbox to remember, such as default position, size and decoration.
  • lastwallpaper: Created by fbsetbg, more on that later, this file stores the information about the last wallpaper you used so that you dont have to specify its location again.

[edit]Unicode Support

If you have your system configured to use Unicode, you might want Fluxbox to use Unicode, too. Fluxbox comes with some styles most of which are selecting fonts that are not fully suitable for Unicode. To fix this you will have to edit the style in/usr/share/fluxbox/styles/$YourStyle, where $YourStyle is the style you wish to fix, and add:
File: /usr/share/fluxbox/styles/$YourStyle
...
window.font: -*-*-*-*-*-*-*-*-*-*-*-*-*-u
...
Another solution is to set the locale in ~/.xinitrc. For example, lets say you use English most of the time -- afterall, you are reading this article in English, so.... -- you will want to write this in your ~/.xinitrc:
File: ~/.xinitrc
...
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
...
All window titles will then be in Unicode UTF-8 format and your locale will be English. Obviously, you will want to set this to your appropriate country or native tongue. UTF-8 shows to the system which encoding youll be using by default so you want Unicode you will get Unicode. You may want to add same two lines to ~/.bash_profile. If you have not configured it yet, go to Gentoo Handbook and Gentoo Localization Guide to read about locales.

[edit]Generating Menus

[edit]fluxbox-generate_menu

To keep your menu up to date after merging or unmerging applications, use the menu generator that comes with Fluxbox, simply run it like so:
fluxbox-generate_menu -ds -is
It will search for the applications installed and create a new ~/.fluxbox/menu file. As some applications are still missing in this script you may add them editing /usr/bin/fluxbox-generate_menu (as root).
Also it will install a ~/.fluxbox/menuconfig which you can customize to your liking, for example, to add GNOME or KDE support or to change the default browser or terminal. To enable easy customizing of the menu, fluxbox-generate_menu looks in ~/.fluxbox/usermenufor settings that will appear in a user submenu. The location can be changed by running fluxbox-generate_menu with the "-u <path>" option.

[edit]Menu Maker

Menu Maker is a program meant to integrate the menus of different window managers, in such a way to keep it consistent between them. Since it isnt part of Fluxbox, you must emerge it to run it:
emerge -va menumaker
Once that has finished, you can run it with the following command:
mmaker -v fluxbox
Note that it adds a lot of items to your menu.

[edit]Denu

Denu (x11-misc/denu) is a GUI menu editor for many window managers, including Fluxbox, complete with icons. To install, run:
emerge -av denu
See Denu at Sourceforge.

[edit]Autostart

Edit ~/.fluxbox/startup and add the names of each application that you want to start with Fluxbox on their own lines. If it is an application that runs continuously, be sure to put an ampersand (&) at the end of the command. This is the case for most commands, and it wont hurt anything if you include the ampersand for a command/program that doesnt run continuously. For example:
File: ~/.fluxbox/startup
unclutter -idle 2 &
wmnd &
wmsmixer -w &
idesk &
urxvtd &

[edit]The Desktop

[edit]Setting the Wallpaper

Fbsetbg comes standard with Fluxbox and is a clever wrapper script to set the background using any installed application which supports it, such as xsri, feh, eterm and xv. Not all of these applications support Pseudo-Transparency. feh is a popular choice as it is small, fast and supports transparency. So to start, install feh:
emerge -av feh
Then, to make sure that fbsetbg knows that feh is what you plan on using, run:
fbsetbg -i
It should say, "feh is a nice wallpapersetter. You wont have any problems." If this is the case, then you can go on to set the background. If it says you are using some other application, then run this command to set feh as your setter:
fbsetbg -u feh
This command will set a JPEG image as a fullscreen background:
fbsetbg -f /path/to/image.jpeg
This command will set a random image as a fullscreen background:
fbsetbg -r /path/to/images/directory/
This command will set the background to whichever image you last used. If the last time your ran fbsetbg was with the random option, it will select a random image from the same directory as the image last used.
fbsetbg -l
You can make this happen every time you start Fluxbox by adding the command to the ~/.fluxbox/startup file. You can also use the simplified command fbsetbg -l to load the last wallpaper loaded by fbsetbg, to avoid changing the init file each time you change your wallpaper.
File: .fluxbox/startup
...
# You can set your favourite wallpaper here if you dont want
# to do it from your style.

# Set the defined image to be a fullscreen, stretched, wallpaper
fbsetbg -f /path/to/image/wallpaper.png

# Set the wallpaper to that of the last used
# Will be random if the last time you ran fbsetbg was with the random switch
fbsetbg -l

# Set a solid color as your wallpaper
fbsetroot -solid black

# Set a random image as your wallpaper
fbsetbg -R /path/to/images/directory/
....

[edit]Set the Wallpaper Through the Menu

Another neat thing you can do with feh is to use it with Fluxboxs wallpaper menu option. This option gives you a wallpaper list off your Fluxbox menu, and is implemented as such: