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

# origin stick is off by default
OriginStick 10
BordersStick 10

CenterPlacement
#ManualPlacement

desktopsize	4x3
#pager.scale	8
pager.scale	16
#pager.pos	c+60
pager.pos	c+6
#active w4x1c+0	RaisePager
active 1x1-0+0	RaisePager
#active wx1c0 ??? RaisePanel
pager.font	6x10
pager.viewport	#002060
#pager.winborder 	grey

#log.geometry	w2xh4-6-6
log.geometry	w3xh6c-6
#active 360x1-6+0 raiselog
log.font		fixed	
log.back		black
log.text		grey
log.hitext		yellow
active 1x1-0-0	RaiseLog

frame.back	#002060
frame.title	white

parse theme

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

WindowStyles
#	"*"		-decor
	"*"		decor, title, dw 5, bw 1
#	"*"		decor, title, dw 6, bw 40
#	"*"		decor, title, dw 0, bw 1
#	"*"		-list
# pager is sticky by default
	"SWM Pager"	-list, -title
	"SWM Log"	sticky, -list, -title
	"emacs*"	-title
#	"*Mozilla Firebird"	-title, dw 8
	"xdvik*"	-decor
	"gv*"		-decor
#	"xterm"		-title, dw 6
	"xterm"		-decor
	"mc*"		-decor
	#-title, dw 10
#	"mc*"		-decor
#	"*Mozilla"	-decor
	"Electric Eyes"	-title, dw 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"
	"&Pager Win"		RaisePager
	-
#	"PLAY video"	playit
	"&Opera"	opera
	"&Firefox"	firefox	
	"&Terminal"	terminal
	"&Commander"	terminal -e 'mc -c'
	"Gimp"		gimp
	"Portato"	portato
	"&Geany"	geany
	-
	"Proclist"	gps
	|
	|
%%shell%%
echo "\"$(date +%H:%M)\" title"
echo "\"$(date +%F)\" title"
%%shell%%
	-
	"Switch to"	popup "winlist"
	"Win ops"	popup "winops"
	-
	"Mi&xer"	gnome-volume-control &
	-
	"Mount"		clickpopup "mount"
#	"Printing"	popup "lpr"
	"&Util"		popup "util"
	-
	"&Restart"	restart /home/adam/swm/swm
	"&Quit"		quit
	-
	"Shutdown"	popup "shutdown"
end

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

# 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 1x1+0+0 popup "root"
#active 1x1+0-0 popup "winlist"
active 1x1+0-0 popup "hiddenlist"
#active 1x1-0-0 popup "winops"

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

######################################################################
# 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
# 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 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 -100 +0
#key Right	a m	scroll +100 +0
#key Up		a m	scroll +0 -100
#key Down	a m	scroll +0 +100

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

key Left	a sw	swapscroll -1 +0
key Right	a sw	swapscroll +1 +0
key Up		a sw	swapscroll +0 -1
key Down	a sw	swapscroll +0 +1

#key Left	A SC	movecursor -10 +0
#key Right	A SC	movecursor +10 +0
#key Up		A SC	movecursor +0 -10
#key Down	A SC	movecursor +0 +10

#key Left	a sw	scroll -10 +0
#key Right	a sw	scroll +10 +0
#key Up		a sw	scroll +0 -10
#key Down	a sw	scroll +0 +10

# have to be A M (some code depends on 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 Escape	a c	popup "winlist"
key space	a w	RaiseLog
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 m		r n	mozilla --mail &> /dev/null
key f		r a	firefox
#key e	 	r a	scite
key e		r a	emacs
key g	 	r a	geany
key t		r a	terminal
key x		r a	xterm
key c		r a	terminal -e 'mc -c'	
key d		r a	dosbox
key h		r a	thunar
key e		a w	thunar
#key a		r a	aria
key o		r a	opera
key x		a w	gnome-volume-control

key a		a w	amixer -c 0 set Master 2dB+
key z		a w	amixer -c 0 set Master 2dB-
key z		a sw	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 q		a w	quit
# the following is for correct ending of scroll (which doesn't grab)
# ok swm should probably detect automatically which modifiers to catch, hm
#key Super_L	a a	Nop
#key Alt_L	a a	Nop

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