Paul King wrote:
> Hi
>
> I wasn't planning to spend a lot of time on this, but what I had was a large
> directory of graphics files (jpegs) that I wanted as screen backgrounds on an
> X-Windows desktop running fvwm-2 somewhere on my PC.
>
> I was handy with making menu entries in fvwm-2, but I was not too crazy about
> making separate individual entries for each file by hand, so I created a perl
> script that did this for me. It sends it to standard output, which I can
> always
> redirect into a file and read into the ~/.fvwm/menus file later. Then, it
> takes
> only a few minutes to make the submenus of about 20 files each.
>
> I offer the script to this list for what it's worth, and feel that most
> people
> here are handy with languages like Perl they can tweak values in the script
> to
> their liking. I've tailored the script so that you need only a casual perl
> skill and casual UNIX skill.
>
> It's at: http://pjk.scripts.mit.edu/lab/src/index.html
>
> If you find it useful, go ahead and use it!
>
> Paul King
>
There's also another approach by Taviso to create menu entrys with
fvwm-menu-directory
on the fly:
It creates at first scan (when user opens the menu) a .thumbs directory with
thumb icons
of the files and shows them then.
The only problem of the current listed solution is, that the wallpaper
directory should
be writable by the user. But it can be changed easily in function
WallpaperBrowser that
the .thumbs will be created at another location.
Needed applications: ImageMagick, xv
#-----------------------------------------------------------------------
# wallpaper directory path.
#-----------------------------------------------------------------------
InfoStoreAdd wallpaper_dir $[FVWM_USERDIR]/wallpapers
#-----------------------------------------------------------------------
# actual wallpaper
#-----------------------------------------------------------------------
InfoStoreAdd fvwm_wallpaper $[FVWM_USERDIR]/.wallpaper
#***********************************************************************
# 8.1.1 Start
#***********************************************************************
# The StartFunction is used at start and restart with or without a Session
# Manager.
DestroyFunc StartFunction
AddToFunc StartFunction
#-----------------------------------------------------------------------
# set the root background image with feh if available
+ I Test (I $[infostore.fvwm_wallpaper]) Exec exec feh --bg-scale
$[infostore.fvwm_wallpaper]
#-----------------------------------------------------------------------
# Dynamic Configuration sub menu for setting a background with
# a picture realized with MissingSubmenuFunction (for the pictures)
#-----------------------------------------------------------------------
AddToMenu MenuWallpaperConfiguration DynamicPopupAction
FuncMenuWallpaperConfiguration
DestroyFunc FuncMenuWallpaperConfiguration
AddToFunc FuncMenuWallpaperConfiguration
+ I DestroyMenu MenuWallpaperConfiguration
+ I AddToMenu MenuWallpaperConfiguration "Backgrounds" Title
+ I AddToMenu MenuWallpaperConfiguration DynamicPopupAction
FuncMenuWallpaperConfiguration
+ I AddToMenu MenuWallpaperConfiguration MissingSubmenuFunction WallpaperBrowser
+ I AddToMenu MenuWallpaperConfiguration "Set &Wallpaper background" Popup
$[infostore.wallpaper_dir]
#-----------------------------------------------------------------------
# Wallpaper Browser by Taviso.
#-----------------------------------------------------------------------
DestroyFunc WallpaperBrowser
AddToFunc WallpaperBrowser
+ I PipeRead 'test ! -d "${FVWM_USERDIR}/wallpapers" && mkdir
"${FVWM_USERDIR}/wallpapers"; \
test ! -d "${FVWM_USERDIR}/wallpapers/.thumbs" && mkdir
"${FVWM_USERDIR}/wallpapers/.thumbs"; \
for i in "$0/"*; do \
test -f "${FVWM_USERDIR}/wallpapers/.thumbs/${i##*/}" -a "${i}" -ot
"${FVWM_USERDIR}/wallpapers/.thumbs/${i##*/}" || { \
convert -quality 0 -sample 42 "${i}"
"png:${FVWM_USERDIR}/wallpapers/.thumbs/${i##*/}" 2>/dev/null \
|| continue; \
}; \
done; \
fvwm-menu-directory --icon-title menu/folder-open.xpm --icon-file
__PIXMAP__ --links \
--icon-dir menu/folder.xpm \
--dir "$0" --command-file="FuncNewWallpaper \\"%f\\"" \
--exec-t="^xv -wait 2 *" --func-name WallpaperBrowser | sed \
"s#__PIXMAP__\\(.*\\)\\\"\\(.*/\\)\\(.*\\)\\\"#\\$[FVWM_USERDIR]/wallpapers/.thumbs/\\3\\1\\2\\3#g"'
#-----------------------------------------------------------------------
# switch to chosen wallpaper picture
#-----------------------------------------------------------------------
DestroyFunc FuncNewWallpaper
AddToFunc FuncNewWallpaper
+ I PipeRead 'ln -sf $* $[FVWM_USERDIR]/.wallpaper'
+ I Exec exec feh --bg-scale $[infostore.fvwm_wallpaper]
-- Thomas --
--
--
"Two things are infinite: the universe and human stupidity; and I'm not sure
about the the universe." -- Albert Einstein