For testing pusposes I need to get an overwiev of what types of
commands people use in fvwm. Could everybody please look through
1) That contain whitespace, quoting characters or variables
(e.g. $[foo] or $w) in the first word of the line.
PipeRead "echo InfoStoreAdd ratio `perl -e 'printf \"%.1f\",log($[vp.width]*$[vp.height])/log(10)-log(1024*768)/log(10)+1'`"
=> calculates a ratio for resolution dependent things
*************************************************************
#-----------------------------------------------------------------------
# replacement for iconify. Creates a small thumb with little app icon
# on the upper right and the name of the app at the bottom
#-----------------------------------------------------------------------
DestroyFunc FuncThumbnail
AddToFunc FuncThumbnail
+ I Raise
+ I ThisWindow (!Iconic) PipeRead "echo SetEnv app_name `xprop -id $[w.id] WM_CLASS |cut -d',' -f2 |cut -d'\"' -f2`"
+ I PipeRead "echo SetEnv Icon-$[w.id] `fns-find-icon -i $[w.id]`"
+ I PipeRead 'test ! -d "${FVWM_USERDIR}/temp" && mkdir "${FVWM_USERDIR}/temp"'
+ I ThisWindow (!Shaded, Iconifiable, !Iconic) PipeRead \
"sleep 0.001; xwd -silent -id $[w.id] | convert -scale 128x72! -frame 1x1 \
-mattecolor black -quality 0 xwd:- png:$[FVWM_USERDIR]/temp/icon.tmp.$[w.id].png \
&& echo WindowStyle IconOverride, Icon $[FVWM_USERDIR]/temp/icon.tmp.$[w.id].png \
|| echo Nop"
+ I TestRc (Match) Test (f $[Icon-$[w.id]], f $[FVWM_USERDIR]/temp/icon.tmp.$[w.id].png) PipeRead \
"convert $[FVWM_USERDIR]/temp/icon.tmp.$[w.id].png \\\( $[Icon-$[w.id]] -scale 24x24 \\\) \
-gravity northeast -geometry +10+10 -compose multiply -composite \
-fill white -undercolor '#00000080' -gravity south -annotate +0+5 \" $[app_name] \" \
$[FVWM_USERDIR]/temp/icon.tmp.$[w.id].png; echo Nop"
+ I Iconify
#-----------------------------------------------------------------------
# replacement for deiconify.
#-----------------------------------------------------------------------
DestroyFunc FuncDeThumbnail
AddToFunc FuncDeThumbnail
+ I Test (i $[Icon-$[w.id]]) WindowStyle Icon $[Icon-$[w.id]]
+ I TestRc (NoMatch) WindowStyle NoIconOverride, Icon
+ I Exec rm -f $[FVWM_USERDIR]/temp/icon.tmp.$[w.id].png
+ I All (Iconic, CurrentPage) PlaceAgain icon
+ I PipeRead 'if [ -O $[Icon-$[w.id]] ]; then rm -f $[Icon-$[w.id]];fi'
+ I UnsetEnv Icon-$[w.id]
+ I UnsetEnv app_name
*************************************************************
#-----------------------------------------------------------------------
# Shows a FvwmForm Infobox with one or multiple message line(s)
# realized with shell commands over PipeRead
#-----------------------------------------------------------------------
# Example:
# FuncShowMessage "<title>" "<message_1>" ... "<message_n>"
DestroyFunc FuncShowMessage
AddToFunc FuncShowMessage
+ I PipeRead `echo 'DestroyModuleConfig FvwmForm-Messages: *' > ${FVWM_USERDIR}/FvwmForm-Messages; \
echo '*FvwmForm-Messages: Font 8x13' >> ${FVWM_USERDIR}/FvwmForm-Messages; \
echo '*FvwmForm-Messages: WarpPointer' >> ${FVWM_USERDIR}/FvwmForm-Messages; \
echo "*FvwmForm-Messages: Title \\"\\$\[gt.$0\]\\"" >> ${FVWM_USERDIR}/FvwmForm-Messages `
+ I PipeRead `start=0; for i in $*; do \
if [ "$start" -gt "0" ]; then \
echo '*FvwmForm-Messages: Line left' >> ${FVWM_USERDIR}/FvwmForm-Messages; \
msg=$i; \
echo "*FvwmForm-Messages: Text \\"\\$\[gt.$msg\]\\"" >> ${FVWM_USERDIR}/FvwmForm-Messages; \
fi; \
start=$(($start+1)); \
done `
+ I PipeRead `echo '*FvwmForm-Messages: Line center' >> ${FVWM_USERDIR}/FvwmForm-Messages; \
echo '*FvwmForm-Messages: Button quit \"\$\[gt. Ok \]\" ^M' >> ${FVWM_USERDIR}/FvwmForm-Messages; \
echo '*FvwmForm-Messages: Command !(rm -f ${FVWM_USERDIR}/FvwmForm-Messages)' >> ${FVWM_USERDIR}/FvwmForm-Messages `
+ I Schedule 100 Module FvwmForm FvwmForm-Messages
Example:
# Button Context Modifi Function
Mouse 0 T SCM FuncShowMessage "Mouse Bindings for Titlebar" \
"Mouse 1: Drag moves window" \
" Maximize on double click" \
"Mouse 2: Drag moves window" \
" Raise or lower with click" \
"Mouse 3: WindowOpsTrimmed menu with click" \
" WindowOpsFull menu with ALT + click" \
"Mouse 4/5: Shade/unshade window" \
" with rolling wheel up/down"
*************************************************************
#-----------------------------------------------------------------------
# Wallpaper Browser by Taviso.
#-----------------------------------------------------------------------
DestroyFunc FuncWallpaperBrowser
AddToFunc FuncWallpaperBrowser
+ I PipeRead 'test ! -d "${FVWM_USERDIR}/wallpapers" && mkdir "${FVWM_USERDIR}/wallpapers"; \
test ! -d "${FVWM_USERDIR}/wallpapers/.thumbs" && mkdir "${FVWM_USERDIR}/wallpapers/.thumbs"'
+ I FuncCreateWpDirLinks
+ I PipeRead '_dir_path=`basename "$0"`; \
sep=`test "$_dir_path" != "wallpapers" && echo /`; \
echo SetEnv dir_path "${sep}`echo \\"\\$_dir_path\\" | sed \\"s#\\.#/#g;s#//#/\\.#g\\"`${sep}"'
+ I PipeRead ' \
for i in "$0/"*; do \
test -f "${FVWM_USERDIR}/wallpapers/.thumbs/${i##*/}" -a "${i}" -ot "${FVWM_USERDIR}/wallpapers/.thumbs/${i##*/}" || { \
convert -define jpeg:size=200 -strip -quality 0 -thumbnail 42 "${i}" "png:${FVWM_USERDIR}/wallpapers/.thumbs/${i##*/}" 2>/dev/null \
|| continue; \
}; \
done; \
fvwm-menu-directory --title "$[dir_path]" \
--icon-file __PIXMAP__ --links \
--icon-dir folder-images.svg:$[infostore.MenuIconSize] \
--dir "$0" --command-file="FuncNewWallpaper \\"%f\\"" \
--exec-t="^xv -wait 2 *" --func-name FuncWallpaperBrowser | sed \
"s#__PIXMAP__\\(.*\\)\\\"\\(.*/\\)\\(.*\\)\\\"#\\$[FVWM_USERDIR]/wallpapers/.thumbs/\\3\\1\\2\\3#g"'
+ I UnsetEnv dir_path
#-----------------------------------------------------------------------
# Create links in wallpaper directory to additional directories
#-----------------------------------------------------------------------
DestroyFunc FuncCreateWpDirLinks
AddToFunc FuncCreateWpDirLinks
+ I PipeRead 'for _dir in `echo $[infostore.additional_wp_dirs] | sed "s#:# #g"`; do \
if [ -d "$_dir" ]; then \
_dir_name=`echo "$_dir" | sed "s#^/##;s#/#.#g"`; \
if [ ! -L "${FVWM_USERDIR}/wallpapers/$_dir_name" ]; then \
ln -s "$_dir" "${FVWM_USERDIR}/wallpapers/$_dir_name"; \
fi; \
fi; \
done'
+ I FuncRemoveWpDirLinks
#-----------------------------------------------------------------------
# Remove links of obsolete additional directories in wallpaper directory
#-----------------------------------------------------------------------
DestroyFunc FuncRemoveWpDirLinks
AddToFunc FuncRemoveWpDirLinks
+ I PipeRead ' \
_wp_dirs=`echo "$[infostore.additional_wp_dirs]" | sed "s#^/\\|/\\\\$##g;s#:/#:#g;s#/:#:#g;s#/#\\.#g"`; \
for _link in `find "${FVWM_USERDIR}/wallpapers" -maxdepth 1 -type l`; do \
if [ -d "$_link" ]; then \
_basename=`basename "$_link"`; \
if [ -n "${_wp_dirs##*$_basename*}" ]; then \
rm -f "$_link"; \
fi; \
fi; \
done'
Example:
#-----------------------------------------------------------------------
# Dynamic Configuration sub menu for setting a background with
# a picture or FvwmBaker (default background)
# realized with MissingSubmenuFunction (for the pictures)
#-----------------------------------------------------------------------
AddToMenu MenuWallpaperConfiguration DynamicPopupAction FuncMenuWallpaperConfiguration
DestroyFunc FuncMenuWallpaperConfiguration
AddToFunc FuncMenuWallpaperConfiguration
+ I DestroyMenu MenuWallpaperConfiguration
+ I AddToMenu MenuWallpaperConfiguration "$[gt.Background Configuration]" Title
+ I AddToMenu MenuWallpaperConfiguration DynamicPopupAction FuncMenuWallpaperConfiguration
+ I Test (EnvMatch DesktopIconsOn 0) Test (I $[infostore.fvwm_wallpaper]) \
AddToMenu MenuWallpaperConfiguration "$[gt.Set &Default background]%delete.svg:$[infostore.MenuIconSize]%" FuncDelWallpaperlink
+ I AddToMenu MenuWallpaperConfiguration MissingSubmenuFunction FuncWallpaperBrowser
+ I AddToMenu MenuWallpaperConfiguration "$[gt.Set &Wallpaper background]%background.svg:$[infostore.MenuIconSize]%" Popup $[FVWM_USERDIR]/wallpapers
*************************************************************
#-----------------------------------------------------------------------
# Restore the previous state of a window
#-----------------------------------------------------------------------
DestroyFunc FuncRestore
AddToFunc FuncRestore
+ I ThisWindow (!Iconic !Shaded Maximized) Maximize false
+ I ThisWindow (!Iconic Shaded ) WindowShade false
+ I ThisWindow ( Iconic ) Iconify false
*************************************************************
3) Fvwm allows to start modules without using the "Module" command,
e.g. with just "FvwmButtons" instead of "Module FvwmButtons".
Do you use this? Did you know that's possible?
No, no. Even though it is inconsistent. Better is to use "Module" infront
all the time to see that it is a module and not a function.
-- Thomas --
--