Use FvwmM4 module to avoid creating env vars. Use -m4-prefix
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 08 Jul 2012 19:23:11 +0300
changeset 484 cf2e6576575c
parent 483 f02dbcb71260
child 485 12264ea1afad
Use FvwmM4 module to avoid creating env vars. Use -m4-prefix -m4-prefix-defines options to avoid name conflict and prevent from substitution of built-in defines (like FVWM_USERDIR).
.fvwm/config
.xinitrc
--- a/.fvwm/config	Sun Jul 08 15:24:33 2012 +0300
+++ b/.fvwm/config	Sun Jul 08 19:23:11 2012 +0300
@@ -1,18 +1,13 @@
 # -*- mode: fvwm; fill-column: 90 -*-
 
-############################
-# Set Environment variables.
-############################
-
-SetEnv fvwm_img  $[FVWM_USERDIR]/images
-SetEnv fvwm_icon $[FVWM_USERDIR]/icons
-SetEnv screenshot_home $[HOME]/.screenshot
-
 ################################################################
 # Set paths.
 
+m4_define(`m4_IMGPATH', `$[FVWM_USERDIR]/images')m4_dnl
+m4_define(`m4_ICONPATH', `$[FVWM_USERDIR]/icons')m4_dnl
+
 ModulePath $[FVWM_USERDIR]:+
-ImagePath $[fvwm_icon];.xpm:$[fvwm_img]:+
+ImagePath m4_ICONPATH;.xpm:m4_IMGPATH:+
 
 # #################
 # Virtual Desktops.
@@ -66,22 +61,27 @@
 # Screenshot Functions (uses ImageMagick).
 ##########################################
 
+m4_define(`m4_SCREENSHOTPATH', `$[HOME]/.screenshot')m4_dnl
+m4_changequote(`<--', `-->')m4_dnl
+
 DestroyFunc FvwmWindowScreenshot
 AddToFunc   FvwmWindowScreenshot
 + I Exec import -window $[w.id] -quality 100 -silent \
-         "$[screenshot_home]/$[w.class]-`date +%F[%R]`.png"
+         "m4_SCREENSHOTPATH/$[w.class]-`date +%F[%R]`.png"
 
 # Remember there is 5 seconds pause before screenshot makes!
 # For alternative screenshot command with delay you may use:  scrot -d <sec> <file>
 DestroyFunc FvwmDesktopScreenshot
 AddToFunc   FvwmDesktopScreenshot
 + I Exec import -window root -quality 100 -pause 5 -silent \
-         "$[screenshot_home]/Desktop-`date +%F-[%H:%M:%S]`.png"
+         "m4_SCREENSHOTPATH/Desktop-`date +%F-[%H:%M:%S]`.png"
 
 DestroyFunc FvwmScreenshot
 AddToFunc   FvwmScreenshot
 + I Exec import -quality 100 -silent \
-         "$[screenshot_home]/App-`date +%F-[%H:%M:%S]`.png"
+         "m4_SCREENSHOTPATH/App-`date +%F-[%H:%M:%S]`.png"
+
+m4_changequote`'m4_dnl
 
 ##################
 # Basic Functions.
@@ -181,10 +181,10 @@
 + I WarpToWindow 50 50
 
 # Prevent show long title.
-SetEnv fvwm_winlist_width 60
+m4_define(`m4_WINLIST_WIDTH', `60')m4_dnl
 # Define switch between aps.
-Key Tab A M WindowList Root c c NoDeskSort, MaxLabelWidth $[fvwm_winlist_width], SelectOnRelease Meta_L
-Key Tab A 3 WindowList Root c c NoDeskSort, MaxLabelWidth $[fvwm_winlist_width]
+Key Tab A M WindowList Root c c NoDeskSort, MaxLabelWidth m4_WINLIST_WIDTH, SelectOnRelease Meta_L
+Key Tab A 3 WindowList Root c c NoDeskSort, MaxLabelWidth m4_WINLIST_WIDTH
 
 # Close window on Alt+F4 (send SIGHUP).
 Key F4 A M Delete
@@ -361,15 +361,15 @@
          StaysOnTop, Sticky, FixedPosition, FixedSize, !Iconifiable, \
          WindowListSkip, CirculateSkip
 
-SetEnv FvwmPager_Inactive rgb:c0/c0/c0
-SetEnv FvwmPager_Active rgb:ef/df/bdc
+m4_define(`m4_PagerInactiveRGB', `rgb:c0/c0/c0')m4_dnl
+m4_define(`m4_PagerActiveRGB', `rgb:ef/df/bdc')m4_dnl
 
 DestroyModuleConfig FvwmPager: *
-*FvwmPager: Back $[FvwmPager_Inactive]
-*FvwmPager: BalloonBack $[FvwmPager_Active]
-*FvwmPager: Hilight  $[FvwmPager_Active]
+*FvwmPager: Back m4_PagerInactiveRGB
+*FvwmPager: BalloonBack m4_PagerActiveRGB
+*FvwmPager: Hilight  m4_PagerActiveRGB
 *FvwmPager: Geometry 80x500-0+0
-*FvwmPager: WindowColors $[FvwmPager_Inactive] $[FvwmPager_Inactive] $[FvwmPager_Active] $[FvwmPager_Active]
+*FvwmPager: WindowColors m4_PagerInactiveRGB m4_PagerInactiveRGB m4_PagerActiveRGB m4_PagerActiveRGB
 *FvwmPager: Font "xft:Sans:Bold:pixelsize=12:minspace=True:antialias=True"
 *FvwmPager: Balloons All
 *FvwmPager: BalloonFont "-Misc-Fixed-Medium-R-Normal-*-13-*-*-*-*-*-ISO10646-1"
--- a/.xinitrc	Sun Jul 08 15:24:33 2012 +0300
+++ b/.xinitrc	Sun Jul 08 19:23:11 2012 +0300
@@ -21,7 +21,8 @@
     xmodmap ~/.xmodmaprc
   fi
   xsetroot -gray
-  fvwm &
+  # To debug FvwmM4 add "-debug" after "FvwmM4".
+  fvwm -cmd "Module FvwmM4 -m4-prefix -m4-prefix-defines $HOME/.fvwm/config" &
 fi
 
 # Last command.