# LapLeft recipe for Fvwm-Crystal
# Written by Dominique Michel <dominique_libre@users.sourceforge.net>, 2013
#
# Modern laptops have a much wider than high screen. This recipie try to adress
# this issue by putting all the decorations on the left.
#
# You can use folding to navigate this file

Echo LapLeft recipe loading from $.

# Place of the desktop icons; " ": left; "-": right {{{1
InfoStoreAdd DeskIconsSign "-"

# Includes and FVWM modules {{{1
# Default FVWM-Crystal functions, initialization {{{2
#Include components/functions/Window-Autohide
Include components/functions/FocusOnGotoPage

# Type of icons on the desktop {{{2
LoadPreferences IconsType

# Desktop manager {{{2
LoadPreferences DefaultDesktopManager

# Media player {{{2
Include components/functions/Music-$[infostore.MusicPlayer]

# 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: *

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

# Icons on Desktop {{{1
Test (EnvMatch DefaultDesktopManager Crystal) PipeRead 'echo "Style * IconBox $(($[vp.width]-((((50*$[IconColumnsNumber]))+69))))x$(($[vp.height]-6))+50+6, IconFill right bottom, IconGrid 30 30"'
Test (!EnvMatch DefaultDesktopManager Crystal) Style * IconBox 66 3 -1 -1, IconFill right bottom, IconGrid 30 30

Style * StickyIcon
Style ApplicationPanel !Icon

DestroyFunc RedrawIconBox
AddToFunc RedrawIconBox
+ I PipeRead 'echo "Style * IconBox $(($[vp.width]-((((50*$[IconColumnsNumber]))+69))))x$(($[vp.height]-6))+50+6, IconFill right bottom, IconGrid 30 30"'

# top |Crystal|---|ApplicationPanel|---|NotifArea| Clock  |Media|Pager| bottom #
# #   | 60px  |---|     490px      |---| varianle|variable|60px | 60px|#       #
# Crystal button 1{{{
All (FvwmButtons-Crystal) Close
DestroyModuleConfig FvwmButtons-Crystal: *
*FvwmButtons-Crystal: Geometry 60x60+0+0
*FvwmButtons-Crystal: BoxSize smart
*FvwmVuttons-Crystal: ActiveColorset $[infostore.cs_panel_active]
*FvwmButtons-Crystal: Colorset $[infostore.cs_panel_inactive]
#*FvwmButtons-Crystal: Colorset $[infostore.cs_transparent]
*FvwmButtons-Crystal: Rows 1
*FvwmButtons-Crystal: Font "xft:$[panel_font]:pixelsize=$[panel_font_size]:$[panel_font_style]"
*FvwmButtons-Crystal: Padding 6 6
*FvwmButtons-Crystal: Frame 0
*FvwmButtons-Crystal: (1x1, Icon "48x48/fvwm-crystal/fvwm-crystal.png", \
	Action (Mouse 1) Menu /FVWM-Crystal $[MenuPosition_W], \
	Action (Mouse 2) Wallpaper-Random $[FVWM_SYSTEMDIR]/wallpapers $[FVWM_USERDIR]/wallpapers ~/wallpapers /usr/local/share/wallpapers /usr/share/wallpapers) \
  	Action (Mouse 4) X fvwm-crystal.videomodeswitch+, \
  	Action (Mouse 5) X fvwm-crystal.videomodeswitch-)

Module FvwmButtons FvwmButtons-Crystal

# Other menus  {{{1
# Applications menu generator {{{2
# 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'
AddToMenu /StartMenu "" Nop
AddToMenu /StartMenu "%32x32/fvwm-crystal/fvwm-crystal.png%FVWM-Crystal" Popup /FVWM-Crystal

# 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'
AddToMenu /Applications '%22x22/fvwm-crystal/audio-x-generic.png%$[gt.Music]' Popup /Music

# Desktop menu with left click {{{1
SetEnv DesktopMenu /StartMenu
#SetEnv DesktopMenu /Applications
#SetEnv DesktopMenu /FVWM-Crystal

# Window list on mouse button 2 {{{2
Mouse 2 R $[Mod0] Window-List

# Application panel {{{1
All (ApplicationPanel) Close
DestroyModuleConfig ApplicationPanel: *
PipeRead 'echo "*ApplicationPanel: Geometry 60x490+0+$(((((($[vp.height]-((180+490+(((($[panel_font_size]*3))/2))+(((((($[trayer_width]*5))/152))*30))))))/2))+60))"'
*ApplicationPanel: BoxSize smart
*ApplicationPanel: ActiveColorset $[infostore.cs_panel_active]
*ApplicationPanel: Colorset $[infostore.cs_panel_inactive]
#*ApplicationPanel: Colorset $[infostore.cs_transparent]
*ApplicationPanel: Rows 10
*ApplicationPanel: Padding 6 2
*ApplicationPanel: Frame 0
*ApplicationPanel: Font "xft:$[panel_font]:pixelsize=$[panel_font_size]:$[panel_font_style]"

# 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
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]/48x48/categories:$[FVWM_USERDIR]/icons/$[infostore.Icon_Theme]/48x48/apps:$[FVWM_SYSTEMDIR]/icons/$[infostore.Icon_Theme]/48x48/categories:$[FVWM_SYSTEMDIR]/icons/$[infostore.Icon_Theme]/48x48/apps:$[FVWM_DISTROMENUDIR]/icons/$[infostore.Icon_Theme]/48x48/categories:$[FVWM_DISTROMENUDIR]/icons/$[infostore.Icon_Theme]/48x48/apps --default-file-icon=48x48/apps/default.png --default-dir-icon=48x48/categories/directory.png --min-submenu-length=5 --sort=prio --panel-icons=topapp --panel-action1=menu --panel-action2=secondapp --panel-action3=topapp --menu-pos=W --menuname-suffix="Panel" --check-execs'

Module FvwmButtons ApplicationPanel

# Notification aera {{{1
# We use fixed sizes
# Settings of stalonetray {{{2
Test (!EnvMatch trayer_width 0) \
PipeRead 'if [ "$[infostore.NotificationAreaManager]" = "stalonetray" ]; then echo FvwmStalonePanel \
    30 2 $(((($[trayer_width]*5))/152)) "+0" "-+$((108+(((($[panel_font_size]*3))/2))))" NE 60 $(((((($[trayer_width]*5))/152))*30)) "+0" "-+$((108+(((($[panel_font_size]*3))/2))))"; fi'
# Settings of trayer {{{2
Test (!EnvMatch trayer_width 0) \
    PipeRead 'if [ "$[infostore.NotificationAreaManager]" = "trayer" ]; then echo FvwmTrayerPanel \
    pixel pixel $(((((($[trayer_width]*5))/152))*30)) bottom left 0 "$((108+(((($[panel_font_size]*3))/2))))" \\"--width 60\\"; fi'

# Clock {{{1
All (FvwmButtons-Clock) Close
DestroyModuleConfig FvwmButtons-Clock: *
PipeRead 'echo \*FvwmButtons-Clock: Geometry 60x$(($(($[panel_font_size]*3))/2))+0-+108'
*FvwmButtons-Clock: BoxSize smart
*FvwmButtons-Clock: ActiveColorset $[infostore.cs_panel_active]
#*FvwmButtons-Clock: Colorset $[infostore.cs_panel_inactive]
*FvwmButtons-Clock: Colorset $[infostore.cs_transparent]
*FvwmButtons-Clock: Columns 2
*FvwmButtons-Clock: Padding 2 2
*FvwmButtons-Clock: Frame 0
*FvwmButtons-Clock: Font "xft:$[panel_font]:pixelsize=$[panel_font_size]:$[panel_font_style]"

*FvwmButtons-Clock: (2x1, \
Swallow (Close, Respawn, FvwmModule) "FvwmScript-Clock" 'Script components/scripts/FvwmScript-Clock', \
Action (Mouse 3) SendToModule *FvwmScript-Clock SendString 1 1 str)

Module FvwmButtons FvwmButtons-Clock

# Music panel {{{1
All (FvwmButtons-Music) Close
DestroyModuleConfig FvwmButtons-Music: *
*FvwmButtons-Music: Geometry 60x48+0-+60
*FvwmButtons-Music: BoxSize smart
*FvwmButtons-Music: ActiveColorset $[infostore.cs_panel_active]
*FvwmButtons-Music: Colorset $[infostore.cs_panel_inactive]
#*FvwmButtons-Music: Colorset $[infostore.cs_transparent]
*FvwmButtons-Music: Rows 2
*FvwmButtons-Music: Padding 7 2
*FvwmButtons-Music: Frame 0
*FvwmButtons-Music: Font "xft:$[panel_font]:pixelsize=$[panel_font_size]:$[panel_font_style]"

# Main music button, with some menus {{{2
*FvwmButtons-Music: (1x1, Size 22 22, Icon "22x22/categories/Multimedia.png", \
	Action (Mouse 1) Menu /Player $[MenuPosition_W], \
	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])
# music controls button {{{2
*FvwmButtons-Music: (1x1, Size 22 22, Icon "22x22/fvwm-crystal/media-eject.png", \
	Action (Mouse 1) Menu /Playlist-button $[MenuPosition_W], \
	Action (Mouse 2) Menu /Music/Volume $[MenuPosition_W], \
	Action (Mouse 3) Menu /Mixer $[MenuPosition_W], \
	Action (Mouse 4) Music-Next, \
	Action (Mouse 5) Music-Prev)
# music controls button {{{2
*FvwmButtons-Music: (1x1, Size 22 22, Icon "22x22/fvwm-crystal/media-playback-start.png", \
        Action (Mouse 1) Music-Play, \
        Action (Mouse 2) Music-Pause, \
        Action (Mouse 3) Menu /Playback $[MenuPosition_W], \
	Action (Mouse 4) Music-Speed-Up, \
	Action (Mouse 5) Music-Speed-Down)
# music controls button 4 {{{2
*FvwmButtons-Music: (1x1, Size 22 22, Icon "22x22/fvwm-crystal/media-skip-forward.png", \
	Action (Mouse 1) Menu /Speed $[MenuPosition_W], \
	Action (Mouse 4) Button-Seek-+, \
	Action (Mouse 5) Button-Seek--)
# }}}2
Module FvwmButtons FvwmButtons-Music

# Pager {{{1
All (FvwmButtons-Pager) Close
DestroyModuleConfig FvwmButtons-Pager: *
PipeRead "echo \*FvwmButtons-Pager: Geometry 60x60+0-0"
*FvwmButtons-Pager: BoxSize smart
*FvwmButtons-Pager: ActiveColorset $[infostore.cs_panel_active]
*FvwmButtons-Pager: Colorset $[infostore.cs_panel_inactive]
#*FvwmButtons-Pager: Colorset $[infostore.cs_transparent]
*FvwmButtons-Pager: Rows 1
*FvwmButtons-Pager: Padding 6 2
*FvwmButtons-Pager: Frame 0
*FvwmButtons-Pager: Font "xft:$[panel_font]:pixelsize=$[panel_font_size]:$[panel_font_style]"

# Pager button {{{2
*FvwmButtons-Pager: (1x1, Size 48 48, Icon "48x48/fvwm-crystal/user-desktop.png", \
Action (Mouse 2) GotoPage prev, \
Action (Mouse 3) GotoPage next \
Action (Mouse 4) GotoPage-Right, \
Action (Mouse 5) GotoPage-Left, \
Panel (right, position 15p) "FvwmPager" "Module FvwmPager")

# Pager window {{{2
DestroyFunc FvwmPagerWindow
AddToFunc FvwmPagerWindow
+ I KillModule FvwmPager
+ I DestroyModuleConfig FvwmPager: *
+ I PipeRead 'echo \*FvwmPager: Geometry $((60*$[infostore.Desk_Pages_X]))x$((60*$[infostore.Desk_Pages_Y]))+0-+0'
+ I *FvwmPager: MiniIcons
+ I *FvwmPager: Font none
+ I *FvwmPager: WindowBorderWidth 1
+ I *FvwmPager: Window3DBorders
#+ I *FvwmPager: NoSeparators
+ I *FvwmPager: UseSkipList
+ I *FvwmPager: Colorset * $[infostore.cs_panel_inactive]
+ I *FvwmPager: HilightColorset * $[infostore.cs_panel_active]
#+ I *FvwmPager: Colorset $[infostore.cs_transparent]
+ I *FvwmPager: HilightColorset $[infostore.cs_transparent]
+ I *FvwmPager: WindowColorsets $[infostore.cs_panel_wininactive] $[infostore.cs_panel_winactive]
#+ I *FvwmPager: WindowColorset $[infostore.cs_transparent] $[infostore.cs_transparent]

FvwmPagerWindow
Module FvwmButtons FvwmButtons-Pager

# Override FVWM style (it's applied later) {{{1
MenuStyle * PopupOffset 0 79
Style FvwmButtons-Clock Layer 2
# Style * TitleAtRight 

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

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