Fluxbox Deco Bitmasks

PackRat

This was touched on in the fluxbox styles thread, but I'm separating it out.

This is a very hand thread to have bookmarked as a fluxbox HowTo

In the ~/.fluxbox/init file, there are three main lines to define the fluxbox window decorations:

session.screen0.titlebar.left: Shade Stick
session.screen0.titlebar.right: Minimize Maximize Close
session.screen0.defaultDeco: NORMAL


The first two lines define the position of the window buttons you want to use - so you can put them upper right/left, whatever you're comfortable with.

The last line deines the decor to use - NORMAL is the default, and note it's all caps and, I believe, case sensative.

Reading the man page for fluxbox-apps you'll come across this:

[Deco] {value}

           Specify the decoration state. There are several predefined value
           sets:

               NORMAL
                   Standard decorations

               NONE
                   No decorations

               BORDER
                   Like NONE except keep the X window border

               TAB
                   Like BORDER except keep external tabs (if enabled)

               TINY
                   Titlebar with only an iconify button

               TOOL
                   Titlebar only

               The value may also be a bitmask for finer-grained control. The
               bits are, from (1<<0) to (1<<10): Titlebar, Handle/Grips,
               Border, Iconify Button, Maximize Button, Close Button, Menu
               Button, Sticky Button, Shade Button, External Tabs, Focus
               Enabled.


Note there are several options other than NORMAL to use in the ~/.fluxbox/init file for the default decor; or you can override the default decor by setting decor on a per-app basis in the ~/.fluxbox/apps file.

But what exactly does this mean:

The value may also be a bitmask for finer-grained control. The
bits are, from (1<<0) to (1<<10): Titlebar, Handle/Grips,
Border, Iconify Button, Maximize Button, Close Button, Menu
Button, Sticky Button, Shade Button, External Tabs, Focus
Enabled.


That's where the above link comes in handy -

Each bit-property is given a value that's based on a power of 2 in ascending order:
Property                                            Value
titlebar                                                  1
handle/grips                                         2
border                                                   4
minimize button (called iconify)         8
maximize button                                 16
close button                                         32
enable window menu                          64
sticky button                                       128
shade button                                       256
enable tabbing                                    512
enable focus                                       1024


So the user can decide how a particular window shoud be decorated, adds up the values and uses it with [Deco] in the apps file. So if all you want is tab and borders: 512 + 4 = 516, in the ~/.fluxbox/apps file:

[Deco] {516}

Adding in some other window decor and per app settings yields an entry similar to:

[app] (name=win) (class=Xpdf)
  [Dimensions] {80% 90%}
  [Position] (UPPERLEFT) {10% 5%}
  [Deco] {1647}
  [Minimized] {no}
  [Maximized] {no}
  [Fullscreen] {no}
  [Layer] {8}
  [Alpha] {255}
[end]




Note than when you log out/in to fluxbox the deco bitmask gets converted to so code (hex?) so the apps entry changes to:

[app] (name=win) (class=Xpdf)
  [Dimensions] {80% 90%}
  [Position] (UPPERLEFT) {1% 2%}
  [Shaded] {no}
  [Deco] {0x66f}
  [Sticky] {no}
  [Minimized] {no}
  [Maximized] {no}
  [Fullscreen] {no}
  [Layer] {8}
  [Alpha] {255}
[end]


If the user has a preferred Deco it can be used as default in the ~/.fluxbox/init file

session.screen0.defaultDeco: 0x66f

instead of individually in the ~/.fluxbox/apps file.



I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo