Tiling Window Management with Fvwm

 

Contents

 

Why

If you have 10+ GUI applications running and spend lots of time
dragging them to the right place, you need a tiling window manager.

On contrary to most modern window systems, which allow you to put one
window on top of another, and mess up your work space, a tiling window
manager will arrange all your windows tiling around your work space,
with no extra space wasted, and no window overlap. Tiling window
managers are good for people who cares more about efficiency, on both
time and screen space assets. The most famous tiling window managers
are ion and wmii.

However, when using a real tiling window manager like the two above,
you lost some freedom: because all the windows are forced to be tiled
around, it is hard to use some multi-window programs, like Gimp. You
can run another window manager inside ion, but you’d quickly get lost
between those two running window managers.

Also the above two both have efficiency and low footprint in mind when
building, so they are not as flexible and there’s not too much options
you can customized and not too much fancy features.

Today we’ll emulate the most part of a tiling window manager with
Fvwm, without losing any flexible and/or fancy stuffs like a
transparent menu system.

 

The target

We’ divide our screen to totally 16 (4×4) blocks, and the goal is to
make any window resize to 1, 2, 3, 4, 6, 8, 9, 12, or 16 blocks with
some simple key strokes, and place it at the upper left corner of any
of these 16 blocks.

And instead of assuming you are using a 1024×768 screen in my
previous article, we’ll make it fit no matter what the screen
resolution is.

 

What we need

We won’t need too much Fvwm commands for this:

Maximize

This is the command we’ll use to resize our windows. If it is
called without any argument, the current window will be toggled
between a maximize and a normal status. If we want to force
it to maximize, we add a True argument, if we want to force
it normal, we pass a False. And if we add two numbers after
that, it will be the percentage of the screen size, horizontal and
vertical, accordingly. For example, if we want to resize a window to
hold three blocks horizontal, and 1 block vertical, we use:

Maximize True 75 25
Move

We’ve talked about this in the previous article. But unlike
specify the absolute point there, we use relative numbers like the
Maximize command above. The trick is easy: Just remove the
post-fix p. So if we want to move the upper left corner of a
window to the middle of the screen, we say:

Move 50 50
Popup
This will pop up a menu with the given name. Very useful when we
want a cascading menu system.

OK, so here’s pretty much all what we need. Easy?

 

Yeal, show me the code!

OK, here’s all the code:

DestroyMenu  QuickWindowMenu
AddToMenu    QuickWindowMenu
+ "&Size"                       Popup size_menu
+ "&Place"                      Popup Place_menu

DestroyMenu size_menu
AddToMenu size_menu
+ "&Small"                     Popup Small_menu
+ "&Half"                      Popup Half_menu
+ "&Big"                       Popup Big_menu
+ "&Quarter"                   Maximize True 50 50

DestroyMenu Half_menu
AddToMenu Half_menu
+ "Half&Big"                   Popup Half_Big_menu
+ "Half&Horizont"              Maximize True 50 100
+ "Half&Quarter"               Maximize True 50 25
+ "Half&Small"                 Popup Half_Small_menu
+ "Half&Vertical"              Maximize True 1024p 50

DestroyMenu Big_menu
AddToMenu Big_menu
+ "Big&Big"                    Maximize True 75 75
+ "Big&Horizont"               Maximize True 75 100
+ "Big&Small"                  Popup Big_Small_menu
+ "Big&Vertical"               Maximize True 100 75

DestroyMenu Small_menu
AddToMenu Small_menu
+ "Small&Big"                  Popup Small_Big_menu
+ "Small&Horizont"             Maximize True 25 100
+ "Small&Small"                        Maximize True 25 25
+ "Small&Vertical"             Maximize True 100 25

# sub-sub menu
DestroyMenu Big_Big_menu
AddToMenu Big_Big_menu
+ "BigBig&Horizont"            Maximize True 75 75
+ "BigBig&Vertical"            Maximize True 75 75

DestroyMenu Big_Small_menu
AddToMenu Big_Small_menu
+ "BigSmall&Horizont"          Maximize True 25 75
+ "BigSmall&Vertical"          Maximize True 75 25

DestroyMenu Place_menu
AddToMenu Place_menu
+ "&1"          Move 0 0
+ "&2"          Move 50 0
+ "&3"          Move 0 25
+ "&4"          Move 50 25
+ "&5"          Move 0 50
+ "&6"          Move 50 50
+ "&7"          Move 0 75
+ "&8"          Move 50 75
+ "" Nop
+ "&Right"      Popup Place_Right_menu

DestroyMenu Place_Right_menu
AddToMenu Place_Right_menu
+ "&1"          Move 25 0
+ "&2"          Move 75 0
+ "&3"          Move 25 25
+ "&4"          Move 75 25
+ "&5"          Move 25 50
+ "&6"          Move 75 50
+ "&7"          Move 25 75
+ "&8"          Move 75 75

Get the idea? I use Small, Big, Half, and Horizont,
Vertical, Quarter to name how to separate the 16 blocks
here. Two more thing: The & creates a shortcut key for the menu
item, and the + “” Nop line makes a separator line in the menu.

Now all you need is binding the function QuickWindowMenu to some key
stroke or mouse click on a window. And as this has been talked in our
previous article, this is left for you as an exercise :)

Tags: , , , ,

Comments 5

  1. boyu wrote:

    maybe the “&” should be ‘&’, though the two are the same somehow

    Posted 04 Oct 2007 at 3:37 pm
  2. dryice wrote:

    Thanks for the notice! I’ve updated accordingly.

    Posted 17 Oct 2007 at 8:07 am
  3. Thomas Adam wrote:

    You neglected to mention FvwmRearrange (which would do what you’ve done, only a little cleaner), and FvwmPartition (which is a non-standard module…)

    Posted 22 Oct 2007 at 8:22 am
  4. dryice wrote:

    Thanks Thomas! I’m aware of FvwmRearrage. It’s cleaner, but less powerful IMO. And thenks for the pointer of FvwmPartition (http://www.imonk.com/baboon/FvwmPartition/). It looks really good, and give “real time” control of the size of the window. I’ll definitely try it out some day :)

    Posted 23 Oct 2007 at 4:14 pm
  5. Air Force One wrote:

    A lot of girls want to make out there with me and that i have fingered practically the entire employees of the Tesco near my condominium. Today is my own day off and that i am using it to look see some displays and maybe get some good cosmetic surgery to ensure things finish effectively for me upward here. I am fired up to see Abundant Fulcher as Eleanor later this week while he is awesome and in addition being a other dirty American and all sorts of one of the few individuals I can realize from the beginning of every sentence right up until the finish minus a couple phrases here and there.
    Talking about language, yesterday My partner and i learned the terms yummy mummy as well as bum chum

    Posted 03 Nov 2010 at 4:18 pm

Post a Comment

You could use <code type="name"> to get your code colorized

Your email is never published nor shared. Required fields are marked *

Close
E-mail It