Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (3) </ [1] 2 3 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: customizing murgaLua, env variable: LUA_INIT< Next Oldest | Next Newest >
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: April 08 2008,17:08 QUOTE

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)


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
jaapz Offline





Group: Members
Posts: 129
Joined: May 2007
Posted: April 08 2008,17:47 QUOTE

Very cool! And thanks for the link :)
Back to top
Profile PM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: April 25 2008,02:19 QUOTE

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?
Back to top
Profile PM WEB 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: April 25 2008,02:58 QUOTE

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(


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: April 25 2008,11:21 QUOTE

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.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
11 replies since April 08 2008,17:08 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (3) </ [1] 2 3 >/
reply to topic new topic new poll
Quick Reply: customizing murgaLua

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code