
# $Id: ConfigFvwmTabs,v 1.1 2006/11/23 01:05:49 chapuis Exp $

# Author: Scott Smedley ss@aao.gov.au

# See the FvwmTabs(1) man page for how to use the FvwmTabs module.
#
# DO NOT EDIT this file unless you know what you are doing.
# Default USER CONFIGURATION settings are in FvwmTabs-DefaultSetup.

# Create a new Tabber.
# Can specify optional --geometry 1st argument.
# ie. NewTabber --geometry=+220+550 scottie
DestroyFunc NewTabber
AddToFunc NewTabber I SendToModule FvwmTabs createNewTabber $0 $1

# Add a window (as a tab) to a Tabber.
DestroyFunc Tabize
AddToFunc Tabize I SendToModule FvwmTabs addme $0

# Save FvwmTabs state (usually invoked just before restart).
DestroyFunc SaveState
AddToFunc SaveState I SendToModule FvwmTabs saveState

DestroyFunc SaveStateAndKill
AddToFunc SaveStateAndKill
+ I	Function SaveState
+ I KillModule FvwmTabs

# Functions used in key bindings.
DestroyFunc NextTab
AddToFunc NextTab
+ I Current (FvwmTabs) SendToModule FvwmTabs fn showNext $[w.id] 1

DestroyFunc PrevTab
AddToFunc PrevTab
+ I Current (FvwmTabs) SendToModule FvwmTabs fn showNext $[w.id] -1

DestroyFunc LastTab
AddToFunc LastTab
+ I Current (FvwmTabs) SendToModule FvwmTabs fn showLast $[w.id]

DestroyFunc ReleaseIconifyTab
AddToFunc ReleaseIconifyTab
+ I Current (FvwmTabs) SendToModule FvwmTabs fn releaseTab $[w.id] current 1

DestroyFunc ReleaseTab
AddToFunc ReleaseTab
+ I Current (FvwmTabs) SendToModule FvwmTabs fn releaseTab $[w.id] current 0

DestroyFunc ReleaseAllTabs
AddToFunc ReleaseAllTabs
+ I Current (FvwmTabs) SendToModule FvwmTabs fn releaseAll $[w.id] 0

DestroyFunc ReleaseIconifyAllTabs
AddToFunc ReleaseIconifyAllTabs
+ I Current (FvwmTabs) SendToModule FvwmTabs fn releaseAll $[w.id] 1

DestroyFunc CloseTabber
AddToFunc CloseTabber
+ I Current (FvwmTabs) SendToModule FvwmTabs fn closeTabber $[w.id]

DestroyFunc AddTab
AddToFunc AddTab
+ I Current (FvwmTabs) SendToModule FvwmTabs fn pickAndAdd $[w.id] single

DestroyFunc MultiAddTab
AddToFunc MultiAddTab
+ I Current (FvwmTabs) SendToModule FvwmTabs fn pickAndAdd $[w.id] multi

DestroyFunc ShowTab
AddToFunc ShowTab
+ I Current (FvwmTabs) SendToModule FvwmTabs fn showTab $[w.id] $0

DestroyFunc SwapLeft
AddToFunc SwapLeft
+ I Current (FvwmTabs) SendToModule FvwmTabs fn swapLeft $[w.id]

DestroyFunc SwapRight
AddToFunc SwapRight
+ I Current (FvwmTabs) SendToModule FvwmTabs fn swapRight $[w.id]

DestroyFunc EnableDND
AddToFunc EnableDND I SendToModule FvwmTabs enableDND $0

# SwallowNew - Run program $0 & have window immediately added to tabber.
DestroyFunc SwallowNew
AddToFunc SwallowNew
+ I SendToModule FvwmTabs swallowNext lastFocus Exec exec $*

# SwallowNewIfFocussed - Run program $0. If a tabber is focused, have
# window immediately added to tabber.
DestroyFunc SwallowNewIfFocused
AddToFunc SwallowNewIfFocused
+ I Current (FvwmTabs) SwallowNew $*
+ I TestRc (NoMatch) Exec exec $0

# SwallowNextStatus - is used by the 'tab' (shell) command.
DestroyFunc SwallowNextStatus
AddToFunc SwallowNextStatus
+ I Deschedule 314159
+ I PipeRead 'usleep 1'
+ I SendToModule FvwmCommandS swallowNext$0
+ I PipeRead 'usleep 1'
+ I SendToModule FvwmCommandS flush

# AddToTabber - add the current window to a tabber.
DestroyFunc AddToTabber
AddToFunc AddToTabber I Current Function Tabize $0

# CreateTabberWithWin will put the focused window into a new tabber,
# creating it at the same position as the window.
DestroyFunc CreateTabberWithWin
AddToFunc CreateTabberWithWin
+ I Current (!FvwmTabs) SetEnv CTWW_ID $[w.id]
+ I TestRc (NoMatch) Break
+ I PipeRead 'echo SetEnv CTWW_COUNT $(( $CTWW_COUNT+1 ))'
+ I NewTabber --geometry=+$[w.x]+$[w.y] .$[CTWW_COUNT]
+ I Wait "FvwmTabs*"
+ I WindowId $[CTWW_ID] Tabize .$[CTWW_COUNT]

DestroyFunc MakeTabbersMenu
AddToFunc MakeTabbersMenu
+ I DestroyMenu recreate TabbersMenu
+ I AddToMenu TabbersMenu "FvwmTabs tab-managers" Title
+ I AddToMenu TabbersMenu "Create tab-manager with this window" Function CreateTabberWithWin
+ I All ("FvwmTabs [*]") AddToMenu TabbersMenu "$$$$[w.name]" Function AddToTabber $$$$[w.id]

# TabbersMenu - best invoked from the menu that pops up when you click
# on the left button in the titlebar of a window. It lists all tabbers
# currently running on the system & automatically adds the window to the
# tabber the user selects.
DestroyMenu TabbersMenu
AddToMenu TabbersMenu
+ DynamicPopupAction Function MakeTabbersMenu

# === Once ===

# Once - only execute an action if it has not been executed already.
# This looks complicated mostly because environment variable
# values are preserved between restarts.
# Requires FVWM >= 2.5.17 or CVS >= 16-July-2006
DestroyFunc Once
AddToFunc Once
+ I Test (EnvIsSet $[0]) Break
+ I SetEnv $[0]
+ I AddToFunc Once_ClearEnvVars I UnsetEnv $[0]
+ I $[1-]

Once ONCE_INIT AddToFunc ExitFunction I Test (ToRestart) Once_ClearEnvVars

# === === ===

# Make sure "SaveState" is only added to ExitFunction once.
Once FvwmTabs_AddSaveStateHook AddToFunc ExitFunction I Test (ToRestart) Function SaveState

# FvwmTabs-DefaultSetup has some useful key-bindings for FvwmTabs.
# Source this file unless the $FvwmTabs_NoDefaultSetup environment
# variable is set, in which case the user probably wants to define their
# own bindings.
Test (!EnvIsSet FvwmTabs_NoDefaultSetup) Read FvwmTabs-DefaultSetup
