# Dock desktop, similar to the XFCE or CDE panel
# Written by: Maciej Delmanowski <harnir@post.pl>
#
# 2007-2013: Dominique Michel <dominique_libre@users.sourceforge.net>
# See ChangeLog for details
#
# You can use folding to navigate this file

Echo Dock 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/Fullscreen
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

# Desktop & window bindings {{{2
Include components/bindings/Desktop-RMB-OpenTerminal
Include components/bindings/Desktop-MMB-EdgeScroll
Include components/bindings/Desktop-MMB-TogglePanels
Include components/bindings/Window-Basic
Include components/bindings/Window-Border
Include components/bindings/Window-Transparency

# 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

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

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

# Desktop manager
LoadPreferences DefaultDesktopManager

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

# Desktop settings {{{1
EdgeScroll	0	0
EdgeResistance			0
Style * EdgeMoveDelay		250
Style * EdgeMoveResistance	100
HideGeometryWindow	Move, Resize
OpaqueMoveSize	100
EdgeThickness	1

EWMH-Desktop 3 3 3 3
EWMH-Panel-Bottom 40

# Panel with main buttons {{{1
All (FvwmButtons-Panel) Close
DestroyModuleConfig FvwmButtons-Panel: *
*FvwmButtons-Panel: Geometry -3+3
*FvwmButtons-Panel: BoxSize smart
*FvwmButtons-Panel: ActiveColorset $[infostore.cs_panel_active]
*FvwmButtons-Panel: Colorset $[infostore.cs_panel_inactive]
*FvwmButtons-Panel: Rows 2
*FvwmButtons-Panel: Columns 3
*FvwmButtons-Panel: Padding 0 0
*FvwmButtons-Panel: Frame 0
*FvwmButtons-Panel: Font "xft:$[panel_font]:pixelsize=$[panel_font_size]:$[panel_font_style]"

# Button 1 - diamond {{{2
*FvwmButtons-Panel: (1x1, Size 18 18, Icon "16x16/fvwm-crystal/fvwm-crystal.png", \
	Action (Mouse 1) Menu /FVWM-Crystal $[MenuPosition_NE], \
	Action (Mouse 3) Wallpaper-Random $[FVWM_SYSTEMDIR]/wallpapers $[FVWM_USERDIR]/wallpapers ~/wallpapers /usr/local/share/wallpapers /usr/share/wallpapers) \
  	Action (Mouse 4) X videomodeswitch+, \
  	Action (Mouse 5) X videomodeswitch-)

# Button 2 - window list {{{2
*FvwmButtons-Panel: (1x1, Size 18 18, Icon "16x16/fvwm-crystal/window-list.png", \
	Action (Mouse 1) Window-List "$[MenuPosition_NE]", \
	Action (Mouse 2) All (CurrentPage) PlaceAgain anim, \
	Action (Mouse 3) Window-List-Icons "$[MenuPosition_NE]")

# Button 3 - Main music button, with some menus {{{2
*FvwmButtons-Panel: (1x1, Size 18 18, Icon "16x16/categories/Multimedia.png", \
	Action (Mouse 1) Menu /Player $[MenuPosition_NE], \
	Action (Mouse 2) Music-GUI, \
	Action (Mouse 3) Music-QJackGUI, \
	Action (Mouse 4) Mixer-Volume-Up $[infostore.Vol_Step], \
	Action (Mouse 5) Mixer-Volume-Down $[infostore.Vol_Step])

# Button 4 - music controls {{{2
*FvwmButtons-Panel: (1x1, Size 18 18, Icon "16x16/fvwm-crystal/media-eject.png", \
        Action (Mouse 1) Menu /Playlist-button $[MenuPosition_NE], \
        Action (Mouse 2) Menu /Playback $[MenuPosition_NE], \
        Action (Mouse 3) Menu /Music/Volume $[MenuPosition_NE], \
	Action (Mouse 4) Music-Next, \
	Action (Mouse 5) Music-Prev)

# Button 5 - music controls {{{2
*FvwmButtons-Panel: (1x1, Size 18 18, Icon "16x16/fvwm-crystal/media-playback-start.png", \
	Action (Mouse 1) Music-Play, \
	Action (Mouse 2) Music-Pause, \
	Action (Mouse 3) Menu /Mixer $[MenuPosition_NE], \
	Action (Mouse 4) Music-Speed-Up, \
	Action (Mouse 5) Music-Speed-Down)

# Button 6 - music controls {{{2
*FvwmButtons-Panel: (1x1, Size 18 18, Icon "16x16/fvwm-crystal/media-skip-forward.png", \
        Action (Mouse 1) Menu /Speed $[MenuPosition_NE], \
	Action (Mouse 4) Button-Seek-+, \
	Action (Mouse 5) Button-Seek--)

# 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.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

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

InfoStoreAdd Desk_Pages_X "8"
InfoStoreAdd Desk_Pages_Y "1"

DesktopSize $[infostore.Desk_Pages_X]x$[infostore.Desk_Pages_Y]

*FvwmPager: MiniIcons
*FvwmPager: Font none
*FvwmPager: WindowBorderWidth 1
*FvwmPager: Window3DBorders
#*FvwmPager: NoSeparators
*FvwmPager: UseSkipList
*FvwmPager: Colorset * $[infostore.cs_panel_inactive]
*FvwmPager: HilightColorset * $[infostore.cs_panel_active]
*FvwmPager: WindowColorsets $[infostore.cs_panel_wininactive] $[infostore.cs_panel_winactive]

# Dock, applications panel and menu generator {{{1
All (ApplicationPanel) Close
DestroyModuleConfig ApplicationPanel: *
*ApplicationPanel: BoxSize smart
*ApplicationPanel: ActiveColorset $[infostore.cs_panel_active]
*ApplicationPanel: Colorset $[infostore.cs_panel_inactive]
*ApplicationPanel: Rows 2
*ApplicationPanel: Padding 1 1
*ApplicationPanel: Frame 0
*ApplicationPanel: Font "xft:$[panel_font]:pixelsize=$[panel_font_size]:$[panel_font_style]"

*ApplicationPanel: (2x2, Size 54 36, Swallow (Close, Respawn, FvwmModule) "FvwmButtons-Panel" 'Module FvwmButtons FvwmButtons-Panel')

# fvwm-crystal.apps {{{2
# This creates the distribution-based panel button - defaut distribution
# icon, only menu is opened (no default app on the panel). Menus are not
# generated
PipeRead 'fvwm-crystal.apps --database=$[FVWM_DISTROMENUDIR]/Applications --database=$[FVWM_SYSTEMDIR]/Applications --database=$[FVWM_USERDIR]/Applications --with=/Applications/$[FVWM_DISTROMENUNAME] --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 --sort=prio --panel-icons=standard --panel-action1=menu --panel-action2=none --panel-action3=menu --button-geometry=2 2 --menu-pos=N --menuname-suffix="Dock" --no-menus --check-execs'
# This creates the main panel with applications - default app icon is
# shown on the panel, and can be launched using RMB; LMB opens the app
# category menu. Menus are not generated
PipeRead 'fvwm-crystal.apps --database=$[FVWM_DISTROMENUDIR]/Applications --database=$[FVWM_SYSTEMDIR]/Applications --database=$[FVWM_USERDIR]/Applications --without=/Applications/$[FVWM_DISTROMENUNAME] --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 --sort=prio --panel-icons=topapp --panel-action1=menu --panel-action2=none --panel-action3=topapp --button-geometry=2 2 --menu-pos=N --menuname-suffix="Dock" --no-menus --check-execs'
# This generates menus for the panel buttons. They are created upside-down,
# because panel is on the bottom of the screen
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 --menuname-suffix="Dock" --submenu-suffix="Item 100 o100" --sort=rprio --no-panel --check-execs'
# This creates the menu with applications 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'
# }}}2

# $[ApplicationPanelLength] is set by fvwm-crystal.apps, contains the number
# of the buttons on the panel
PipeRead 'echo "*ApplicationPanel: Geometry 520x36+$(((($[vp.width]-(((($[ApplicationPanelLength]*32))+200))))/2))-1"'
*ApplicationPanel: (6x1, Size 144 18, Swallow (Close, Respawn, FvwmModule) "FvwmScript-Clock-small_date" 'Function Script components/scripts/FvwmScript-Clock-small_date')
*ApplicationPanel: (6x1, Size 144 18, Swallow (Close, FvwmModule) "FvwmPager" 'Module FvwmPager')

Module FvwmButtons ApplicationPanel

# Settings for icons on the desktop {{{1
Style * IconBox 1200x800+30-50, IconFill left bottom, IconGrid 30 30
Style * StickyIcon
Style ApplicationPanel !Icon

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

Echo /--------- Fvwm-Crystal: Recipe loaded ---------/

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