Today I will write a Linux article for a change. Windows fans, don't worry I am not ditching Windows. As you know I use Linux too alongside Windows to keep an eye on the best distros and best window managers. Fluxbox is one such awesome window manager for Linux, my favorite one. It is extremely lightweight, blazingly fast, easily configurable and very feature rich. You can use it without any Desktop Environment and still manage windows comfortably and productively. By default, Fluxbox places newly opened windows ordered in a row until the screen width allows them. I did not find this behavior very useful and would like to share with you how it is possible to place newly opened Fluxbox windows at the center of the screen.
In Fluxbox, there is an option in the ~/fluxbox/init file to define the default location of new windows. In most cases it looks like this:
session.screen0.windowPlacement: strategy
The strategy value specifies where to place new windows when not specified otherwise (by the program or the "apps" file, for example).
Available 'strategies' are as follows:
- RowSmartPlacement: tries to place windows in rows without overlapping
- ColSmartPlacement: tries to place windows in columns without overlapping
- CascadePlacement: places windows below the titlebar of the previous one
- UnderMousePlacement: places new windows underneath the mouse
In my OS, which is Arch Linux, the default value is RowSmartPlacement.
As you see, there no option to place newly opened windows at the center of the screen. But we can override this behavior by using the apps file.
Open this file in your favorite editor. The editor I use is Geany:
geany ~/.fluxbox/apps
Add the following lines to the end of the file:
[app] (name!=gimp) [Position] (WINCENTER) {0 0} [end]
This will force all windows to be located at the center of the screen, exactly what we need! The line (name!=gimp) disables the window centering for the GIMP application. I use an older version of GIMP, version 2.6, which does not have a single window user interface so centering its windows completely messes them up.
That's it. Restart Fluxbox or re-read its configuration. Now open something, e.g. Terminal or VLC or any other app:
Voila, it will be located at the center of the screen.
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
are there any other options besides WINCENTER? thank you.
UPPERLEFT
UPPERRIGHT
LOWERLEFT
LOWERRIGHT
CENTER
WINCENTER
These.