# FullScreen recipe for Fvwm-Crystal
# Written by Dominique Michel <dominique_libre@users.sourceforge.net>, 2013
# The multimedia menu is from Tavis Ormandy <taviso@gentoo.org> configuration 
# http://dev.gentoo.org/~taviso/fvwm2rc.html (dead link, too bad!)
#
# This recipe is a derivative of the Amiga recipe. When the Amiga recipe
# is over complicated, this FullScreen recipe is over simplified and will
# show only a fullscren wallpaper
#
# You can use folding to navigate this file

Echo Fullscreen recipe loading from $.

# ImagePath {{{1
InfoStoreAdd Icon_Theme "Default"
ImagePath $FVWM_USERDIR/icons/$[infostore.Icon_Theme]:$FVWM_SYSTEMDIR/icons/$[infostore.Icon_Theme]

# Includes and FVWM modules {{{1
Module FvwmCommandS

# Default FVWM-Crystal functions, initialization {{{2
Include components/functions/Clear-FVWM-Settings
Include components/desktop/FVWM-Crystal_Functions
Include components/desktop/FVWM-Crystal_Preferences
Include components/functions/Window-Autohide
Include components/functions/Fullscreen
Include components/functions/FocusOnGotoPage
Append preferences/Startup

# Preferred applications {{{2
Include components/functions/Screenshot-import
Include components/apps/XScreenSaver
Include components/apps/FvwmMiniConsole
Include components/apps/QuakeConsole
Include components/apps/OpenOffice.org
Include components/functions/Xephyr

# Various styles {{{2
Include components/desktop/FVWM-Crystal_Styles
Include components/styles/CursorStyle-Border
##Include components/styles/CursorStyle

# Must be after the styles.
Include components/functions/NotificationAreaManager-$[infostore.NotificationAreaManager]
Include preferences/NotificationArea-Width
Include components/functions/Music-$[infostore.MusicPlayer]

# Desktop manager
LoadPreferences DefaultDesktopManager

# Nust be after the Music functions
# Keyboard bindings {{{2
Include components/desktop/Keyboard
Include components/desktop/Keyboard_NumLock
Include components/desktop/Numpad
# Multimedia bindings {{{2
Include components/bindings/Multimedia_Keys
Include components/bindings/Multimedia_Keys_NumLock
# Desktop & window bindings {{{2
Include components/bindings/Desktop-RMB-OpenTerminal
Include components/bindings/Desktop-MMB-TogglePanels
Include components/bindings/Desktop-MMB-ToggleTopBar
Include components/bindings/Window-Basic-Amiga
Include components/bindings/Window-Border
Include components/bindings/Window-Transparency

# Use window thumbnails instead of simple icons on the desktop {{{2
Include components/desktop/Icon-Thumbnails

# Desktop settings {{{1
EdgeScroll			100000	100000
EdgeResistance			-1
Style * EdgeMoveDelay		250
Style * EdgeMoveResistance	20

HideGeometryWindow		Move, Resize
OpaqueMoveSize			100

# Change desktop with mouse wheel
Include components/bindings/Desktop-PageSwitch-Horizontal

# Pager {{{1
All (FvwmPager) Close
DestroyModuleConfig FvwmPager: *

# pager's dimension {{{2
InfoStoreAdd Desk_Pages_X "8"
InfoStoreAdd Desk_Pages_Y "1"
DesktopSize $[infostore.Desk_Pages_X]x$[infostore.Desk_Pages_Y]

# Desktop panel {{{1
EWMH-Desktop 3 3 3 3
EWMH-Panel-Bottom 3
EWMH-Panel-Top 3
EwmhBaseStruts 3 3 3 3

# Crystal button 1{{{
All (FvwmButtons-Crystal) Close
DestroyModuleConfig FvwmButtons-Crystal: *
*FvwmButtons-Crystal: Geometry 34x34-0+0
*FvwmButtons-Crystal: BoxSize smart
*FvwmButtons-Crystal: Rows 1
*FvwmButtons-Crystal: Font "xft:$[panel_font]:pixelsize=$[panel_font_size]:$[panel_font_style]"
*FvwmButtons-Crystal: Padding 1 1
*FvwmButtons-Crystal: Frame 0
# Use the following for an animated icon (tested one time in the past...)
# *FvwmButtons-TopLogo: (2x1, Size 22 22, \
# Swallow (Close, Respawn) Display `Exec exec animate $[FVWM_USERDIR]/icons/Default/22x22/fvwm-crystal/dancing-tux.gif &`)
# Crystal Variant
*FvwmButtons-Crystal: (ColorSet $[infostore.cs_transparent], 1x1, Icon "32x32/fvwm-crystal/fvwm-crystal.png", \
	Action (Mouse 1) Disappear, \
	Action (Mouse 2) GotoPage prev, \
	Action (Mouse 3) GotoPage next \
	Action (Mouse 4) GotoPage-Right, \
	Action (Mouse 5) GotoPage-Left)

Module FvwmButtons FvwmButtons-Crystal
Style FvwmButtons-Crystal !Borders

DestroyFunc Toggle-Crystal
AddToFunc Toggle-Crystal
+ I All (FvwmButtons-Crystal) ToggleWindowOnTop

EdgeCommand Top Toggle-Crystal

# Other menus  {{{1
# Applications menu generator {{{2
DestroyMenu /StartMenu
AddToMenu /StartMenu "%32x32/fvwm-crystal/fvwm-crystal.png%FVWM-Crystal" Popup /FVWM-Crystal
AddToMenu /StartMenu '%22x22/fvwm-crystal/audio-x-generic.png%$[gt.Music]' Popup /Music
AddToMenu /StartMenu
# This creates the main "Start Menu" avaiable at mouse button 1
PipeRead 'fvwm-crystal.apps --database=$[FVWM_DISTROMENUDIR]/Applications --database=$[FVWM_SYSTEMDIR]/Applications --database=$[FVWM_USERDIR]/Applications --search-icons-in=$[FVWM_USERDIR]/icons/$[infostore.Icon_Theme]/32x32/categories:$[FVWM_USERDIR]/icons/$[infostore.Icon_Theme]/32x32/apps:$[FVWM_SYSTEMDIR]/icons/$[infostore.Icon_Theme]/32x32/categories:$[FVWM_SYSTEMDIR]/icons/$[infostore.Icon_Theme]/32x32/apps:$[FVWM_DISTROMENUDIR]/icons/$[infostore.Icon_Theme]/32x32/categories:$[FVWM_DISTROMENUDIR]/icons/$[infostore.Icon_Theme]/32x32/apps --default-file-icon=32x32/apps/default.png --default-dir-icon=32x32/categories/directory.png --min-submenu-length=5 --root-cat-name="StartMenu" --sort=prio --no-panel --check-execs --dont-clear-menu'
# This creates app menu available under Alt+Win_R
PipeRead 'fvwm-crystal.apps --database=$[FVWM_DISTROMENUDIR]/Applications --database=$[FVWM_SYSTEMDIR]/Applications --database=$[FVWM_USERDIR]/Applications --search-icons-in=$[FVWM_USERDIR]/icons/$[infostore.Icon_Theme]/22x22/categories:$[FVWM_USERDIR]/icons/$[infostore.Icon_Theme]/22x22/apps:$[FVWM_SYSTEMDIR]/icons/$[infostore.Icon_Theme]/22x22/categories:$[FVWM_SYSTEMDIR]/icons/$[infostore.Icon_Theme]/22x22/apps:$[FVWM_DISTROMENUDIR]/icons/$[infostore.Icon_Theme]/22x22/categories:$[FVWM_DISTROMENUDIR]/icons/$[infostore.Icon_Theme]/22x22/apps --default-file-icon=22x22/apps/default.png --default-dir-icon=22x22/categories/directory.png --min-submenu-length=5 --sort=prio --no-panel --check-execs'

# Notification aera {{{1
# Settings of stalonetray {{{2
Test (!EnvMatch trayer_width 0) \
PipeRead 'if [[ $[infostore.NotificationAreaManager] == stalonetray ]]; then echo FvwmStalonePanel \
    $(($[panel_font_size]+$(($[panel_font_size]/2)))) \
    $(($[trayer_width]/$(($[panel_font_size]+$(($[panel_font_size]/2)))))) 1 \
    "+0" "-1" NE $[trayer_width] $(($[panel_font_size]+$(($[panel_font_size]/2)))) \
    "+0" "-1"; fi'
# Settings of trayer {{{2
Test (!EnvMatch trayer_width 0) \
    PipeRead 'if [[ $[infostore.NotificationAreaManager] == trayer ]]; then echo FvwmTrayerPanel \
    request pixel 24 bottom left 0 "24"; fi'

# Desktop bindings {{{1
# Menus on mouse Button 1 {{{2
Mouse 1 R $[Mod0] Menu /StartMenu $[MenuPosition_BelowLeft]
Mouse 1 R $[Mod1] Menu /FVWM-Crystal $[MenuPosition_BelowLeft]

# Window list on mouse button 2 {{{2
Mouse 2 R $[Mod0] Window-List
# Notification Area on Alt + mouse button 2
# TODO Mouse 2 R $[Mod1] Notif Area
# TODO Music Button on Alt + Shift + Mouse 2
# TODO Mouse 2 R $[Mod2] Music

# Main "diamond" menu {{{2
DestroyMenu /FVWM-Crystal
AddToMenu /FVWM-Crystal
+ '%22x22/fvwm-crystal/preferences-desktop-screensaver.png%$[gt.Screensaver]' Popup /Screensaver
+ '%22x22/fvwm-crystal/camera-photo.png%$[gt.Screenshot]' Popup /Screenshot
+ "" Nop
+ '%22x22/fvwm-crystal/preferences-desktop-theme.png%$[gt.Window decorations]' Popup /Window-Decorations
+ '%22x22/fvwm-crystal/colorsets.png%$[gt.Colorsets]' Popup /Colorsets
+ '%22x22/fvwm-crystal/preferences-desktop-wallpaper.png%$[gt.Wallpaper]' Popup /Wallpaper
#+ '%22x22/fvwm-crystal/preferences-desktop-wallpaper.png%$[gt.All pages wallpaper]' Popup /Wallpaper-All
#+ '%22x22/fvwm-crystal/preferences-desktop-wallpaper.png%$[gt.This page wallpaper]' Popup /Wallpaper-Current
+ '%22x22/fvwm-crystal/preferences-desktop.png%$[gt.Preferences]' Popup /Preferences
+ "" Nop
+ '%22x22/fvwm-crystal/applications-development.png%$[gt.Developer menu]' Popup /Developer
+ '%22x22/fvwm-crystal/fvwm-crystal.png%$[gt.About FVWM-Crystal]' Include components/functions/About
+ MissingSubmenuFunction FuncFvwmMenuXephyrDirectory
+ '%22x22/fvwm-crystal/gdm-xnest.png%$[gt.Nested sessions]' Popup /etc/X11/Sessions
+ '%22x22/fvwm-crystal/system-log-out.png%$[gt.Exit]' Popup /Exit
# }}}2

# Override FVWM style (it's applied later) {{{1
MenuStyle * PopupOffset 0 79

# The notification area can move; Alt + MMB to show/hide it
Style FvwmStalonePanel Title, !Button 1, !Button 2, !Button 3, !Button 4, !Button 6, !Button 8, VariablePosition, StaysOnTop, Font none, TitleFormat %n
Style trayer Title, !Button 1, !Button 2, !Button 3, !Button 4, !Button 6, !Button 8, VariablePosition, StaysOnTop, TitleFormat %n

Echo /--------- Fvwm-Crystal: Recipe loaded ---------/
#PrintInfo infostore

# ViM modeline {{{1
# vim:foldmethod=marker:foldenable:foldlevel=0:ft=fvwm
