DSL Tips and Tricks :: customizing murgaLua



A long time ago I was asking about the possibility of customizing the look and behavior of murgaLua without having to modify individual scripts.  I can't seem to find that particular thread, so I'm making  new one (sue me).

There is of course the .Xdefaults file, in which you can set default FLTK scheme, background colors, and forground color, but thats as far as it goes:

! this is really ugly =o)
fltk*scheme:plastic
fltk*background:gray50
Text.background:gray70
fltk*foreground:yellow
fltk*selectBackground:green

This also doesn't help much because you still have to modify the scripts in order to use these resources.

Now that I've started reading Programming in Lua I found an answer almost immediately.  By using the LUA_INIT environment variable (exported from .bash_profile, for example), you can specify a file that Lua will run before doing anything else.

So, if you have the file /home/dsl/.murgarc, you can do this:
export LUA_INIT="@$HOME/.murgarc"
before running murgaLua (note the '@').
Whatever Lua commands are in that file will be run.

A simple example:
Code Sample
_PROMPT=os.getenv("USER").."> "
Fl:set_boxtype(fltk.FL_UP_BOX,fltk.FL_THIN_UP_BOX)
Fl:set_boxtype(fltk.FL_DOWN_BOX,fltk.FL_THIN_DOWN_BOX)

Very cool! And thanks for the link :)
Maybe I am thinking of Lua/FLtk, but I recall the fonts available were limited to those in Fltk (C - FLTK Enumerations section of the FLTK manual). Is that true with murgaLua? Can I use LUA_INIT to set and use any X font globally for murgaLua scripts?
I assume so, but lemme check....[long pause]

....well...that's odd.
Apparently you can sort of change the fonts this way, but for some reason no matter what font I try ends up displaying as 'fixed'.
The same line, Fl:set_font(0,"-*-terminus-*"), copied directly into the script shows the correct font.

So...I guess I'll have to look further into that.  But it's bed time now =o(

I just got DSL 4.3, and successfully used LUA_INIT to set the font in murgaLua-0.6.8.  Previous versions display the fixed font only, apparently.

I don't know yet if it's possible to set a font for a particular class, but you can change the built-in constants to whatever X font you desire.

Next Page...
original here.