water cooler :: recommend a menu



Quote
Maybe, but I still think it's a window manager issue. 0,0 works for me. I haven't tried it with Fluxbox or JWM yet.
Heh, well this is my first glance at lua/flua/etc... but just trying an actual test run with the changes with the latest release on Fluxbox (some RC on v1.0) seems to allow the WM to take over with 0,0 whereas other values are actually used (I had my WM settings on tiling, so it did that).  Could be a versioning behaviour discrepancy?

I tested it on dwm, swm, jwm, fluxbox 0.1.14, and fluxbox 1.0.0 (final). All of these window managers placed the app in the correct place except for fluxbox 0.1.14 (the one in DSL). I could see forced tiling being a factor, but I never thought to check that.

I made some changes to the script. It now does not cover the whole width of the screen. The width is determined by the number of buttons. The configuration is marked at the top of the file. If you use more or less than three buttons, both the size of the my_menu table and the table_size variable must be equal. I thought it was easier to have the user change table_size rather than traverse the table just to find its length (table.maxn doesn't work on non-numerical tables).

The app now appears in the top-middle of the screen if your window manager supports it. As I said it works as desired with jwm and swm. With fluxbox you will need to either use a newer version or place it manually.

The "X" button has been removed, but the w:callback is still there, so you will need to force it to close with killall or xkill or something similar.

I would like to be able to stop it from creating a toolbar button in fluxbox/jwm, but I don't know if this is possible.

Code Sample

---- CONFIGURATION
-- menu: label="command"
my_menu={
Aterm="aterm -fn proggy",
Dillo="dillo",
DSLpanel="cpanel.lua"
}

size=11 -- text size
bh=16 -- button height
bw=100 -- button width
table_size=3 -- number of table items
---- END CONFIGURATION

barw=table_size*bw
w=fltk:Fl_Window(Fl:w()/2-barw/2,0,barw,bh,"MLmenu")
w:callback(function() end)
butt_pack=fltk:Fl_Pack(0,0,barw,bh)
butt_pack:type(fltk.FL_HORIZONTAL)

butt={}
cnt=1
for k,v in pairs(my_menu) do
butt[cnt]=fltk:Fl_Button(0,0,bw,bh)
butt[cnt]:label(k)
butt[cnt]:labelsize(size)
butt[cnt]:callback(function() os.execute(v.." &") end)
butt[cnt]:box(fltk.FL_BORDER_BOX)
cnt=cnt+1
end

fltk:Fl_End()
w:border(0)
w:show()
Fl:run()

Using the default settings for fluxbox under DSL 4.0 there is no window/frame decoration, although I still had to issue position() to set it in the correct location (with width being the same copied from Fl_Window ... it seems that one is ignored then?)
Nice. I actually want it not to be user-closable.

I will be using it under failsafewm, which doesn't have any decoration at all..

edit:
Hey, can the buttons' text have spaces? If I quote the name?

As far as I know, DSL 4.0 uses Fluxbox 0.1.14, which I already mentioned doesn't properly position the app. Are you saying position() works now? It didn't work for me when I tried it last night (DSL 4.0RC5/Fluxbox), any better than putting the coordinates in Fl_Window did. I wonder if putting them in both places is necessary for some wms that need to be given a second nudge =o)
Next Page...
original here.