Changing style and icons

Hi!

I´d like to install some styles/colorstes and icons side bye side into my .fvwm folder. so is there an easy way to change the style while running fvwm?

Means i´ like to have a menu, where i can choose a style or colorset that i wanna use.

I´ve seen that pasq did that with linking for ex. his icons folder to the folder where the icons he wanna use are located.

Are there other solutions around?

You want to look at what fvwm-themes does.

Well, I have a menu which will list colorsets for me. Basically, it consists of a textfile called ~/.fvwm/colorsets, which has the following in it:

4 fg white, bg aquamarine4
5 fg white, bg MediumPurple3
6 fg white, bg Orange
7 fg white, bg sandybrown
8 fg white, bg blue1
9 fg white, bg silver
10 fg white, bg cornflowerblue

They’re just standard colorsets declared in the normal way – I start at 4, as I have other colorsets defined in my fvwm2rc file already. As to how you get them in a menu, you can use the DynamicPopupAction to decide an action for a menu, as in:

DestroyMenu "FvwmMenuColorset" AddToMenu "FvwmMenuColorset" DynamicPopupAction FuncFvwmMenuColorset

So that everytime I select the menu item above the function FuncFvwmMenuColorset is called, which will populate the menu with the colors I’d like from the file you saw above:

[code]
AddToFunc FuncFvwmMenuColorset

  • I DestroyMenu recreate FvwmMenuColorset
  • I PipeRead ‘echo “AddToMenu FvwmMenuColorset
    Colorsets Title”’
  • I PipeRead ‘echo + \“Reset\” Function ChangeStyle
    “1 fg white, bg #c06077”; echo \+ \"\" Nop’
  • I PipeRead ‘while read l; do echo +"${l/*bg /\ }" Function
    ChangeStyle “$l”; done < ~/.fvwm/colorsets’[/code]

The final step, is to the define an action to occur when I click on an item in the menu – a means to actually change the color, hence:

DestroyFunc ChangeStyle
AddToFunc   ChangeStyle
+ I ColorSet $* 
+ I Style * HilightColorSet $*
+ I SetEnv DefCS "$0 $*"
+ I UpdateStyles

There’s some – dynamic menus are where I’d start looking, as well at fvwm-themes.

– Thomas Adam

I wrote something to let me change configs on the fly. It’s designed so I can get a menu of possible configs, choose one of them and then have fvwm restart using that configuration. It shouldn’t be too hard to adapt it to read a file that sets colorsets and icon styles.

The code assumes that each config lives in a file called config_THEME_NAME and that resources particular to the config live in directory THEME_NAME. The existing config gets removed and the newly selected one is symlinked into its place. You’ll probably want to modify that, particularly the bit where it deletes your config file :slight_smile:

[code]#

OK: Job One is to provide some way to access the menu

Let’s Bind it to Windows-C

Key C A 4 Popup ConfigMenu

Better define it now

The DynamicPopupAction stuff tells FVWM "if we get here and there’s not

menu in place, call this function"

DestroyMenu ConfigMenu
AddToMenu ConfigMenu

  • DynamicPopupAction Function MakeConfigMenu “-- Select Configuration --”

Adapting this from Sa’s setup - destroy menu or destroy func?

DestroyMenu MakeConfigMenu
AddToFunc MakeConfigMenu

  • I Echo “Make Config”
  • “I” DestroyMenu recreate ConfigMenu
  • “I” AddToMenu ConfigMenu “$0” Title

Pet Peeve: There is NO reason why embedded shell commands have to be all on

a single line! Unless your intent is to obfuscate, why not lay it out in a

readable manner? No one is going to revoke your 1337 status just because they

can understand your bash scripts.

  • “I” PipeRead ’
    for i in ~/.fvwm/config_*;
    do
    echo + $( basename $i | sed s/config_// )
    FuncSwitchConfig $i ;
    done

DestroyFunc FuncSwitchConfig
AddToFunc FuncSwitchConfig

  • I Echo FuncSwitchConfig: $0
  • I PipeRead ’
    if [ ! -L $HOME/.fvwm/config ];
    then
    mv $HOME/.fvwm/config
    $HOME/.fvwm/config.fvwm.save;
    fi;
    echo rm -f $HOME/.fvwm/config;
    echo ln -s $0 $HOME/.fvwm/config;
    echo Nop;
  • I Restart
    [/code]

I’ve taken the liberty of prepending echo to the rm and ln commands, for reasons I hope will be obvious :slight_smile: