#-----------------------------------------------------------------------
# File:         G2likeBottomBar
# Version:      1.2.2
# Licence:      GPL 2
#
# Description:  Gnome like bottom bar with All iconify/deiconify button,
#               windows list and pager with 4 virtual pages
#
# Author:       Thomas Funk <t.funk@web.de>    
#               Bernhard Popp <kermit.popp@googlemail.com>
#
# Created:      10/09/2012
# Changed:      02/10/2016
#-----------------------------------------------------------------------

# Bottombar
# +---+----------------------------------------------+-------------+-+
# |   |                                              |             | |
# +---+----------------------------------------------+-------------+-+
# Desktop                                             Pager        End
#      IconMan



Style G2likeBottomBar !Title, Sticky, NeverFocus, WindowListSkip, HandleWidth 2
Style G2likeBottomBar Layer 4, !Iconifiable, !Maximizable, FixedSize, FixedPosition


#=======================================================================
# FvwmButtons G2likeBottomBar
#=======================================================================

#-----------------------------------------------------------------------
# find desktop icon
#-----------------------------------------------------------------------
PipeRead "if [ `fns-find-icon -n 'preferences-system-windows' -s $[infostore.i_size] --notdesk` ]; then \
            echo InfoStoreAdd desktop_icon `fns-find-icon -n 'preferences-system-windows' -s $[infostore.i_size] --notdesk`; \
          else \
            echo InfoStoreAdd desktop_icon 'window-icons.svg:$[infostore.i_size]x$[infostore.i_size]'; \
          fi"

#=======================================================================
# Pager
#=======================================================================

#-----------------------------------------------------------------------
# Set the desk top size in units of physical screen size
#
#   +-----+-----+-----+-----+
#   |     |     |     |     |
#   +-----+-----+-----+-----+
#
#-----------------------------------------------------------------------
DeskTopSize "$[infostore.x_desks]x$[infostore.y_desks]"

#-----------------------------------------------------------------------
# FvwmPager height
#-----------------------------------------------------------------------
InfoStoreAdd pager_height $[infostore.bar_height]

#-----------------------------------------------------------------------
# FvwmPager width
#-----------------------------------------------------------------------
PipeRead "echo InfoStoreAdd pager_width `perl -e 'printf \"%.0f\",5+(($[vp.width]/($[vp.height]/$[infostore.bar_height]))*$[infostore.x_desks])'`"

#-----------------------------------------------------------------------
# FvwmPager columns
#-----------------------------------------------------------------------
PipeRead "echo InfoStoreAdd pager_columns `perl -e 'printf \"%.0f\",$[infostore.pager_width]/$[infostore.column_size]'`"

#-----------------------------------------------------------------------
# FvwmPager geometry
#-----------------------------------------------------------------------
InfoStoreAdd pager_geometry $[infostore.pager_width]x$[infostore.pager_height]-0-0'


#=======================================================================
# GlobalIconMan BottomBar
#=======================================================================

#-----------------------------------------------------------------------
# GlobalIconMan columns
#-----------------------------------------------------------------------
PipeRead 'echo InfostoreAdd iconman_columns $(($[infostore.columns]-$[infostore.pager_columns]-3))'

#-----------------------------------------------------------------------
# GlobalIconMan manager geometry
#-----------------------------------------------------------------------
InfoStoreAdd iconman_manager_geometry 8x1+0+0

#-----------------------------------------------------------------------
# GlobalIconMan geometry
#-----------------------------------------------------------------------
InfoStoreAdd iconman_button_geometry 175x$[infostore.bar_height]

#-----------------------------------------------------------------------
# GlobalIconMan Manager Tips
#-----------------------------------------------------------------------
InfoStoreAdd tips_iman always


#=======================================================================
# Bar
#=======================================================================

#***********************************************************************
# General
#***********************************************************************
DestroyModuleConfig G2likeBottomBar: *
*G2likeBottomBar: Geometry          $[infostore.bottombar_geometry]
*G2likeBottomBar: Colorset          13
*G2likeBottomBar: ActiveColorset    13
*G2likeBottomBar: PressColorset     13

*G2likeBottomBar: Rows              1
*G2likeBottomBar: Columns           $[infostore.columns]
*G2likeBottomBar: Frame             0

#***********************************************************************
# Buttons
#***********************************************************************

#-----------------------------------------------------------------------
# menu button
#-----------------------------------------------------------------------
*G2likeBottomBar: (2x1, Colorset 13, ActiveColorset 11, \
            Left, ActionOnPress, \
            Icon    $[infostore.desktop_icon], \
            ActiveIcon    $[infostore.desktop_icon], \
            Action(Mouse 1) Function ShowDesktop)

#-----------------------------------------------------------------------
# GlobalIconMan
#-----------------------------------------------------------------------
*G2likeBottomBar: ($[infostore.iconman_columns]x1, Colorset 13, Swallow "GlobalIconMan")

#-----------------------------------------------------------------------
# FvwmPager
#-----------------------------------------------------------------------
*G2likeBottomBar: ($[infostore.pager_columns]x1, Colorset 13, Frame -1, Swallow "FvwmPager")

