# * fonts must be specified before any menu is defined !!!

# * recommendation: when you write %%shell%% inlines in menu, write
# the script as fast as possible (i.e. call other programs as little as
# you can, don't call programs such as awk etc.)

#OpaqueMove
#OpaqueResize
#UnlockScrolling

# origin stick is off by default
#GestureStickiness 10
#OriginStickiness 10
#BorderStickiness 10

CenterPlacement
#ManualPlacement

# http://keithp.com/~keithp/talks/xtc2001/paper/
# weight, size, pixelsize
Font		Sans:pixelsize=14:weight=bold
#Font		Terminus

desktop.size	4x3
desktop.start	1 0

#pager.scale	8
pager.scale	16
#pager.pos	c+60
pager.pos	c+7
active.hover w4x1c+0	pager.raise
#active 1x1-0+0	pager.raise
#active wx1c0 ??? panel.raise
pager.font	Sans:pixelsize=10
pager.viewport	#002060
#pager.winborder 	grey

#log.geometry	w2xh4-6-6
log.geometry	w3xh2-7-7
#active 360x1-6+0 log.raise
#fc-list to see list of fonts
log.font	Sans:pixelsize=12:weight=bold
log.back	black
log.text	grey
log.hitext	yellow
active 1x1-0-0	log.raise

frame.back	#002060
frame.title	white	
frame.border	#00ffff

#menu.font	10x20
#menu.titlefont	10x20
menu.font	Sans:pixelsize=16
menu.titlefont	Sans:pixelsize=16:weight=bold


parse theme


######################################################################

WindowStyles
#	"*"		-decor
	"*"		decor, title, padding 6, border 1
#	"*"		decor, title, padding 6, border 4
#	"*"		-list
# pager is sticky by default
	"SWM Pager"	-list, -title
	"SWM Log"	sticky, -list, -title
	"emacs*"	-title
	"*VIM"		-title, padding 15, border 0
	"mc*"		-title, padding 15, border 0
	"* SciTE"	-decor
#	"*Mozilla Firebird"	-title, padding 8
	"xdvik*"	-decor
	"gv*"		-decor
#	"xterm"		-title
#	"mc*"		-decor
#	"*Mozilla"	-decor
	"Electric Eyes"	-title, padding 10
#	"VideoLAN Client*" -decor
end

######################################################################

newmenu "winops" # a reserved name!
	"&move"		move
	"re&size"	resize
	"h&ide"		hide
	"&center"	center
	"ma&x/restore"	maximize
-
	"&raise"	raise
	"&lower"	lower
	"&stick"	stick
-
	"close"		close
	"&destroy"	destroy
end

newmenu "pagerwinops" # a reserved name!
	"close"		close
	"&destroy"	destroy
-
	"h&ide"		hide
	"re&size"	resize
	"ma&x/restore"	maximize
	"&lower"	lower
	"&center"	center
end

newmenu "util"
	"&fontsel"	gtkfontsel
	"&xfontsel"	xfontsel
	"&printtool"	printtool
end

newmenu "mount"
%%shell%%
function mk_mount_item ()
{
if (grep -q "$2" /etc/mtab); then
  echo "\"-$1\" umount $2"
else
  echo "\"+$1\" mount $2"
fi
}

mk_mount_item "&CDR"	/mnt/cdrom
mk_mount_item "CDR&W"	/mnt/cdrom1
mk_mount_item "fd&a"	/mnt/fd0
mk_mount_item "&dos C:"	/mnt/dosc
%%shell%%
end

#newmenu "lpr"
#%%shell%%
#	echo "\"lp&rm\" lprm -"
#%%shell%%
#end

newmenu "shutdown"
	"Power off"	poweroff
	"Reboot"	reboot
end

newmenu "adsl"
	"Start"		/etc/ppp/run_adsl start
	"Stop"		/etc/ppp/run_adsl stop
end

newmenu "root"
	"&Portato"	portato
	"T&hunar"	thunar
	"PcManFM"	pcmanfm
	"Lx&Task"	lxtask
	-
	"&Firefox"	firefox	
	"Opera"		opera
	"Terminal"	terminal
	"Commander"	terminal -e 'mc -c'
	"Gimp"		gimp
	-
	"Pager Win"	pager.raise
	-
	|
	|
%%shell%%
echo "\"$(date +%H:%M)\" title"
echo "\"$(date +%F)\" title"
%%shell%%
	-
	"Switch to"	popup "winlist"
	"Win ops"	popup "winops"
	-
# perhaps the following line causes (due to & at the end) the crash in ubuntu?
#	"Mi&xer"	gnome-volume-control &
	"&Mixer"	xfce4-mixer
	-
	"Mount"		clickpopup "mount"
#	"Printing"	popup "lpr"
	"&Util"		popup "util"
	-
	"&Restart"	restart /home/adam/swm/swm
	"&Quit"		quit
	-
	"Shutdown"	popup "shutdown"
end

######################################################################
# doubleclick duration (in milliseconds)
DoubleClick 300

# the "winlist" popup is created automatically during the run of SWM,
# contains the names of all windows for which you haven't specified
# "-list" in style-specification, or the string "<empty>" if no such
# window exists

active.click 1x1+0+0 popup "root"
#active.enter 1x1+0+0 popup "root"
active.click 1x1+0-0 popup "hiddenlist"
#active.enter 1x1+0-0 popup "hiddenlist"
#active 1x1+0-0 popup "winlist"
#active 1x1-0-0 popup "winops"

#active 2xh2+0c scroll -1 +0
#active 2xh2-0c scroll +1 +0
#active w2x2c+0 scroll +0 -1
#active w2x2c-0 scroll +0 +1

######################################################################
# bindings (mouse and keyboard)
#
# syntax:
# mouse [button] [context] [modifier key] [action]
# and similar for "key"
#
# context == when the action will be performed; if the pointer is in
# D ... decorations
# X ... doubleclick on decorations
# W ... any app window or pager or logwin
# R ... root window
# A (any) ... D or W or R
#
# modifier keys:
# A ... any
# C ... control
# M ... Alt(meta) key
# W ... 'window' key == 'Super_L' keysym
#
# for keybinds the D context doesn't exist, since whenever you enter
# the frame (with pointer), the focus is set to the window decorated
# (and not to the decorations (=frame) itself), so it is impossible
# to catch any keys for frame

mouse 1 R A	popup "root"
mouse 2 R A	popup "winlist"
mouse 3 R A	popup "winops"

mouse 1 D A	raisemove
mouse 1 X A	maximize
#mouse 1 D A	move
mouse 3 D A	resize
mouse 1 D C	raise
mouse 3 D C	lower
mouse 2 D C	stick

#key Left	a m 	scroll -1 +0
#key Right	a m	scroll +1 +0
#key Up		a m	scroll +0 -1
#key Down	a m	scroll +0 +1

key Left	a w	scroll -1 +0
key Right	a w	scroll +1 +0
key Up		a w	scroll +0 -1
key Down	a w	scroll +0 +1

key Left	a sw	scroll.swap -1 +0
key Right	a sw	scroll.swap +1 +0
key Up		a sw	scroll.swap +0 -1
key Down	a sw	scroll.swap +0 +1

key Left	a cw	scroll.wrap -1 +0
key Right	a cw	scroll.wrap +1 +0
key Up		a cw	scroll.wrap +0 -1
key Down	a cw	scroll.wrap +0 +1

#key Left	a sw	movecursor -50 +0
#key Right	a sw	movecursor +50 +0
#key Up		a sw	movecursor +0 -50
#key Down	a sw	movecursor +0 +50

# have to be A M (some code dependson having Alt_L (META) pressed when
# the function is called for proper function)

#key Alt_L	w n	seqswitch
#key Win_L	w a	seqswitch
#key Menu	w a	seqswitch
key Tab		a m	seqswitch
key Tab		a w	dskseqswitch

key Escape	a c	popup "winlist"
key space	a w	log.raise
key l		r c	log.clear
key s		r c	log.stop
key q		r c	log.cont
key l		r sc	ToggleLock
key w		a w	popup "root"

#key F1		w m	popup "winops"
#key F2		w m	center
#key F3		w m	move
key F4		w m	close

key F1		w w	popup "winops"
key F2		w w	center
key F3		w w	move
key F4		w w	close
#key x		a w	close

#key s		a m	stick
#key r		a m	raise
#key l		a m	lower
key s		a w	stick
key r		a w	raise
key l		a w	lower

key m		a m	popup "mount"
key space	r n	popup "root"
key f		r n	thunar
key t		r n	terminal
key c		r n	terminal -e 'mc -c'	
key p		r n	lxtask
key m		r n	xfce4-mixer
#key e	 	r n	scite
#key e		r n	emacs
key e		r n	terminal --geometry=150x55
key g	 	r n	geany
#key x		r n	xterm
key d		r n	dosbox
key o		r n	opera
key e		a w	thunar
#key a		r n	aria

key a		a w	amixer -c 0 set Master 2dB+
key z		a w	amixer -c 0 set Master 2dB-
key 1		a w	setxkbmap us,cz -option "grp:alt_shift_toggle"
key 2		a w	setxkbmap cz,us -option "grp:alt_shift_toggle"

key Insert	a w	restart /home/adam/swm/swm
key grave	a w	log.raise	
key q		r a	quit

# if the command isn't an internal command, it is considered as system
# command (i.e. implicitly exec) but you can specify exec explicitly
# (to run a program called "popup", e.g.)

# exec automaticky, ale můžu ho specifikovat (aby šel spustit třeba
# program s názvem "popup" atd.)
