Get off my button bar (2.4 users, EwmhBaseStruts like)

I have a FvwmButtons bar on the top of my screen which I have swallowed all my windows into (icon manager/pager/xcb/cpu meter/clock/xterm buttons/etc) just like most other configurations for FVWM, but I had a problem with it getting covered up when a new window got launched so I needed a fix.

At first I found the EwmhBaseStruts option but quickly learned it would not work for version 2.4 of FVWM. Since I work for a large company and they don’t move to the latest version of FVWM very quickly I could not use the EwmhBaseStruts option. So I had to create a workaround; here is what I came up with for keeping windows from being placed on top of off of the button bar. This workaround allows me to keep the same Placement rules as before, because it only nudges the new windows that pop on top of the button bar off of it.

[code]DestroyFunc InitFunction
AddToFunc InitFunction

  • I Module FvwmEvent

DestroyModuleConfig FvwmEvent: *
*FvwmEvent: add_window NewWindowFunc

DestroyFunc NewWindowFunc
AddToFunc NewWindowFunc

  • I ThisWindow (FvwmButtons) SetEnv b_width $[w.width]
  • I ThisWindow (FvwmButtons) SetEnv b_height $[w.height]
  • I ThisWindow (!Fvwm*) PipeRead ‘if [ $[b_width] -gt $[w.x] ] && [ $[b_height] -gt $[w.y] ] ; then echo Move $[w.x]p $[b_height]p ; fi’
    Here is some of my notes on figuring this workaround out. PipeRead is a cantankerous little thing! It is odd to work with because you’re “echo Echoing” things back to FVWM from the shell. It uses the “sh” Bourne shell which is frankly a strange little shell script language. White space, brackets, and semicolons are required in the Bourne shell. For my system the “test” shell command would only return an empty string so I had to use the “if” shell command instead. I had to build the statement bit-by-bit in a separate shell xterm, practice echoing it from the FVWM function, and then finally change it over to executing code. I excluded FVWM windows from this nudge because most of them I don’t want moved anyways.

Over all this little bit of code works great for my issue. I only see the window get nudged occasionally when the system has a big load on it so there is not a big visual issue with this workaround. I welcome any ideas and feedback, because you never know what one might have overlooked.

Thanks, Mark

No. It uses the value of the “ExecUseShell” setting which defaults to /bin/sh – this might be sh, or indeed a bourne shell (bash), or dash on some systems.


PipeRead `[ $[b_width] -gt $[w.x] ] && [ $[b_height] -gt $[w.y] ] && echo "Move $[w.x]p $[b_height]p"`

Nothing complex about that. Note that (as from: … fhobia.txt) using a delimiter for PipeRead which won’t interefere with the shell when quoting is concerned, is recommended. You’ll note in my example I used backticks to encapsulate the PipeRead command – this then allows you to use " and ’ without escaping in the general case.

How about using 2.5.x? I don’t buy people who say “but I can’t” – yes you can. You can always install to $HOME and export PATH to point to $HOME/bin – and you get the benefit of not jumping through hoops. But fine, I’m willing to entertain this a little.

Something you didn’t mention was the other half of your EWMH endeavours. c.f.:

Maximize 100 -somevalue

Where, “-somevalue” is the height of your FvwmButtons panel.

Some other observations:

DestroyModuleConfig FvwmEvent: *
*FvwmEvent: add_window NewWindowFunc

Use an alias here, beyond *FvwmEvent, in case you ever want to use more than one instance of FvwmEvent.

DestroyFunc NewWindowFunc
AddToFunc NewWindowFunc
+ I ThisWindow (FvwmButtons) SetEnv b_width $[w.width]
+ I ThisWindow (FvwmButtons) SetEnv b_height $[w.height]
+ I ThisWindow (!Fvwm*) PipeRead 'if [ $[b_width] -gt $[w.x] ] && [ $[b_height] -gt $[w.y] ] ; then echo Move $[w.x]p $[b_height]p ; fi'

Your function doesn’t then go on to UnSetEnv b_width and UnSetEnv b_height – when it should since you’re just polluting the environment space unnecessarily with your crap.

Read this:

– Thomas Adam