Subject: re: Themes

From: Jason Kibblewhite <[email-masked]>
Date: Wed, 16 Jun 1999 02:09:32 -0600

If you have no iterest in themes for fvwm2 in any shape or form please
feel free to rm this e-mail, and sorry for cluttering up your mailbox
with it.

Now I know what your thinking.  Didn't this thread die yet? Haven't we
established that fvwm2 is not very good at themes because the rc file is
too easy to change around.  Gnome themes aren't very well setup.  I like
what Scott Scriven did but the configuration is unwieldy and too hard to
add to my setup.  I hate reading man pages so I just run (insert other
wm name here).  Is fvwm.themes.org still there?

Well I'm here to tell you that I think I've come up with IMHO a good way
to do it.  I know sounds like big words from someone that's only
complained about bugs on the mailing list, but I happen to love fvwm2
and would do just about anything (except give up money) to see more
people using it as it's still the best one out there I think.  I'm an op
on #linuxhelp in efnet and I have people ask me all the time what wm
should I use,  I always reply fvwm2.  Then someone pipes up and use
(insert wm name here).  So I figure I'm always up to try something new,
so I d/l, compile/install and show back up in the channel running it. 
So I play with it's window shading functions (if it has them) poke about
with the docs, search for snap attraction/to, changing functions, how
can I run a menu bar etc. 99% of the time they have almost no features
that I either care to use or have only 1% of the ones I think are the
most important.  So it's back to run good old fvwm2.  So here is how I
plan to make it better.  (Gosh I feel like a used car salesman)

First off I totally believe in the separate rc files and using just the
read function as it makes each file much cleaner and easier to edit. 
Secondly I've hardly cornered the market on the best way to do this,
just the way I came up with after sifting through the man page over a
few days, so if after reading this you think something would be better
setup another way please let me know.  Hopefully together we can all
come up with something that works.

All the rc files are of course split into a few other files.

.fvwm2rc (or I guess system.fvwm2rc):  Basically sets up GlobalOps,
Focus type, starting ImagePath, the basic feel EdgeScroll/Resistance,
Clicktime etc. and reads all the other rc fills in this order.

~/.fvwm/functions: does all the function commands minus init (.fvwm2rc)
and restart (~/.fvwm/modules, as all restart functions I've seen are
only module restarts) It also contains all of the mouse and keyboard
defines

~/.fvwm/menus: simple, defines menu option that appears on every menu.

~/.fvwm/styles: pretty simple aswell, however it also does a few
addtodecor functions.  E.g. you want different styles for
FvwmModules/regular windows/xterm/emacs/foo, all with the use style
function.  the rest of them are all MiniIcons and Icons styles.

~/.fvwm/modules: as of right now it loads all the modules on a restart,
and defines all the module settings for each type.  I thinking about
reads for each module type (is it worth it?).

~/.fvwm/default.theme: this fancy dancy file was actually just a sym
link to ~/.fvwm/themes/themename.theme before I started in on
FvwmScript.  Now when you change themes this file is generated
automagicly by FvwmScript from the settings you want to use, e.g.
borderstyles, icon, but not sound or background,  whatever the theme
contains which is also figured out by the script.

Well that's about it for the basics, but as this is about themes I'll
explain how they work now.

A standard default.theme file contains this.
#theme,somenumbers
#modules 0
#sound 0
#icons 1
#buttons 1
#borderstyle 0
#menu 0
#background 1

1 means this theme has this feature or define, 0 is naturally it
doesn't.  And the first line is auto generated by FvwmScript, as I can't
figure how to turn it off :) non generated themes now have this as a
desc line.

(gosh are we done yet?  Not even close :)

theme files have to have some kind of specific structure to make then
easier to parse so a file can be generated, there for this is what one
must contain.

if #modules = 1 it must only contain settings on what these modules look
like, as FvwmButtons is something completely different in this respect
and subject to something people might not want changed I'm thinking of
making using defines for this selectable on the main theme screen.

if #sound = 1 then it should contain only the extension to use as all
the sound files have the same name and the FvwmEvent path to find them
is in ~/.fvwm/themes/themnamedir/sound/
some kind of of standard sound format should be decided on as play does
some files ok and other it can't do well or at all, and I think this is
what most people will use to play them (or not), and sound it of course
something you can select or not on the theme screen

if #icons = 1 then as with sound no icon names are defined as they will
all have the same name and be installed in
~/.fvwm/themes/themenamedir/icons/,  this way you can have icons for all
kinds of standard stuff like netscape but not have to define any of them
to use, this path is simple added before the base imagepath dir as it
pixmap path.

if buttons = 1 this one gets a touch complex though.  It calls a
function called nobuttons which removes all the buttons on all the
windows and uses the themes config for them.  Seriously thinking about
taking this one out as many people point out this might constitute a
feel rather then a theme, (new spin off here feel?)

if borderstyle = 1 then the file must contain all the boarder defines to
use without addtoborderstyle, just borderstyle the add is placed in
there automagicly, same with titlestyle.  I suppose this one can be
taken out as it's the basis of themes, I was just looking for things to
fill up the window with and never took it out :),   Also all borderstyle
titlestyles and/or buttonstyles created under a decor called default,
that title is static and will never change no matter what theme you
choose, I saw no reason to change this as the styles file decorates most
windows with this decor

if background = 1 all it has to contain is the word background (so the
script can file the line) .xpm, jpg .gif .foo. and the way it's
displayed, max title maxspec or whatever.

if menu = 1 then it should have a menustyle line(s)

Additional comments: I'm pretty sure all the pixmaps icons and sounds
can just go into the themedir rather then separate sub dirs with only a
minor change to the script if that is more preferred.  people use just
about everything to do root window decor so figuring out which one they
use and what it's options are might present a bit of a challenge.  I'm
toying with the idea of adding a font style to choose from, so if say
someone only has the minimum X fonts installed they aren't forced to use
fixed when fvwm2 can't find font name foo.  If the theme file doesn't
contain any *FvwmModule lines then the script try's to generate some for
most of the common modules people use from the info contained in the
theme file, it's hardly perfect though, this can also be turned off

And naturally all the themes can be applied, committed to change or
canceled.

Ok advantages over any of the other themes setups I've seen on the net. 
Scott's is pretty good he has a nice setup and some neat themes but you
can't select what to change, and basically the only thing that changes
is the window decor.  The gnome one has some pretty neat ones also but I
didn't care for them myself and again the only that changes is the
window styles, no provisions for sound or icons and is rather hard to
tailor to your setup.  I won't comment too much on fvwm.themes.org style
as it was a good idea at the time but just isn't implemented well.  That
an I believe he monitors this list :).  And this system is pretty easy
to write themes for and tailor to your system.  And new features or an
updated script can be dropped in with little or no change (at least
that's the way I designed it)

Problems.  Well first is if someone's fvwm2rc file is a mess it has to
be cleaned up some what to work at all.  There may be some editing of
the script file required for paths, but they are right at the top in
variables so that should be minor if it's need at all.  Fvwm2 doesn't
come with a standard root window background program other then xpmroot
which only does xpm and using xv isn't always the best solution as many
people may not have it installed.  My scripting ability is very limited
as I've just learned FvwmScript (sorta) this past week so the script
file my be unnessacarly complicated.  The themes can't be selected from
a menu as the format doesn't allow fvwm2 to handle it properly.  Then
theme file should be rather structured and if it's not e.g. if someone
creates one by hand and doesn't follow the format very well the script
will have a hard time with it.  Currently you can't select that only
certain windows get certain decors as Scott's system can.  It doesn't
work with the fvwm2 versions that don't have the ImagePath statement yet
as it uses some features that only came out after that.  And it's only
been tested on Linux,  There should be no problem with any *nix that
contains the gnu tools, only thing that it uses is grep tr and cat, but
then I'm no shell expert but I believe | commands work the same on all
of them.

Well enhancements I'd like to add but can think of how to do them:
Sound, if someone unchecks the sound button then applies the theme I'd
like it to ask them if they just don't want to use sound from this theme
or turn off sound.   an AddToFunc soundplay exec cat $1 > /dev/null
doesn't seem like a very good way to go for turning off sound, having
FvwmEvent spit out a billion soundplay commands not found is not good, 
and just killing FvwmEvent is not a good idea either.

Modules: I don't believe there is any other way to send module restart
commands other then killing then running the restart func so the style
changes for them take effect.

I can't think of the best way to implement global themes and $HOME dir
themes as I think this might greatly increase the size of the script.

Well that's about it (finally) any questions about anything I may not
have explained well enough or any suggestions on how to do something or
features to add are greatly welcome.  I'm sure they might be flood of
messages about this on the list once I send this out so feel free to
send me private e-mail and I'll forward some of them to the list.\

I also apologize for the size of this messages but as it's not quite
finished yet I really want feedback on it so I can change things before
I release my creation to the real world.
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]