# Theming

# Variables for colorsets
# this way they are easier to remember
# Used colorsets
Setenv cs-menu-inactive 0
Setenv cs-menu-active 1
Setenv cs-general-active 2
Setenv cs-general-inactive 3
Setenv cs-panel-active 4
Setenv cs-panel-inactive 5
Setenv cs-iconman 6
Setenv cs-iconman-focus 7
Setenv cs-iconman-focus-select 8
Setenv cs-window-active 9
Setenv cs-window-inactive 10
Setenv cs-window-inactiveborder 11

# Button locations
# Using these variables the button locations
# and functions stay the same over a them change
Setenv tb-button-close 2
Setenv tb-button-maximize 4
Setenv tb-button-minimize 6
Setenv tb-button-menu 1

# Function to change the theme
DestroyFunc ApplyTheme
AddToFunc ApplyTheme
###
# Menu feel settings
###
+ I MenuStyle * Fvwm
+ I MenuStyle * HilightBack, Hilight3DOff, Animation
+ I MenuStyle * PopupOffset 0 100
+ I MenuStyle * TitleWarpOff, TitleUnderlines1
+ I MenuStyle * RemoveSubmenus
+ I MenuStyle * PopupDelay 0
+ I MenuStyle * SeparatorsLong, TrianglesSolid
+ I MenuStyle * ItemFormat "%.4s%.1|%.5i%.5l%.5l%.5r%.5i%.20p%2.3>%1|"
###
# windows feel
###
+ I Style * BorderWidth 3, HandleWidth 3
+ I Style * MWMFunctions, MWMDecor, HintOverride
+ I Style * DecorateTransient, NoPPosition
+ I Style * IconBox 400x80+10-30
+ I Style * ClickToFocus, ClickToFocusRaises
+ I Style * MinOverlapPercentPlacement, WindowShadeSteps 20
# Application specific Style settings
+ I Style xvkbd BorderWidth 0, CirculateSkipIcon, CirculateSkip
+ I Style xvkbd NoTitle, NoHandles, StaysOnTop, NeverFocus, WindowListSkip
+ I Style ZaurusTaskbar NoTitle, NoHandles, BorderWidth 0, Sticky, WindowListSkip, NeverFocus
+ I Style ZaurusTaskbar CirculateSkip, StaysOnTop, FixedPosition, FixedSize, !Iconifiable
+ I Style FvwmForm-QuitVerify StaysOnTop, CenterPlacement, NoTitle, BorderWidth 3
+ I Style * NoButton 0, NoButton 1, NoButton 2, NoButton 3, NoButton 4, \
            NoButton 5, NoButton 6, NoButton 7, NoButton 8, NoButton 9
# read the theme definition
+ I Read themes/$0/config
###
# windows look
###
+ I Style * UseDecor DefaultDecor
+ I Style * HilightBorderColorset $[cs-window-activeborder], \
	BorderColorset $[cs-window-inactiveborder], \
	HilightColorset $[cs-window-active], \
	Colorset $[cs-window-inactive], \
        Font "$[font-title]"
+ I Style * Button $[tb-button-close], \
        Button $[tb-button-maximize], \
        Button $[tb-button-minimize], \
        Button $[tb-button-menu]
+ I Style * GrabFocus
# menus look
+ I MenuStyle * MenuColorset $[cs-menu-inactive], \
            ActiveColorset $[cs-menu-active], \
            Font $[font-menu]

# function to persist a certain theme
DestroyFunc SaveTheme
AddToFunc SaveTheme
+ I Piperead 'echo Setenv CURRENT_THEME $0 > $HOME/.fvwm/personal/.current_theme'

# apply and save a certain theme
# this function should be called from the
# themes menu.
DestroyFunc ApplyThemePersistent
AddToFunc ApplyThemePersistent
+ I ApplyTheme $0
+ I SaveTheme $0

DestroyFunc InitDefaultTheme
AddToFunc InitDefaultTheme
+ I Setenv CURRENT_THEME pdaXrom
+ I SaveTheme pdaXrom

DestroyFunc InitCurrentTheme
AddToFunc InitCurrentTheme
+ I UnSetenv CURRENT_THEME
+ I Read $[HOME]/.fvwm/personal/.current_theme
+ I TestRc (Error) InitDefaultTheme
+ I ApplyTheme $[CURRENT_THEME]

# build the themes menu
# this is delegation based
# each theme should have a file named "description"
# where it adds itself to the themes menu
# e.g.
# AddToMenu ThemeMenu "Winter" ApplyThemePersistent Winter
DestroyFunc BuildThemesMenuFunc
AddToFunc BuildThemesMenuFunc
+ I DestroyMenu recreate ThemesMenu
+ I AddToMenu ThemesMenu "Themes" Title
+ I PipeRead 'cat $HOME/.fvwm/themes/*/description'

# things to do at startup
InitCurrentTheme
BuildThemesMenuFunc
