# The switch variable window_system have value "windows", "macintosh" or "x11",
# depending on the system where this file is parsed. 

# Select any of following enables. These select some configuration changes
# in keymap file. 

######################################################################
# meta-key-to-eight-bit might not work on every environment, it changes the
# meta key to insert 8-bit version of character instead of normal character.
# Note: In windows you need to map some key to mod5, and you cannot map Alt 
# key to that, because the default windows version don't allow you to map Alt
# to anything (Windows uses it internally, it is enabled only to make AltGr 
# work).
#
# The map-mod5-to-capslock setting will map capslock to be mod5.
#
# enable mod5-key-to-eight-bit
# enable map-mod5-to-capslock

######################################################################
# Scroll-on-key-mapping adds mappings to F1+Control+Shift that will toggle
# the setting of scroll-on-key (does the terminal scroll to bottom of
# history when key is pressed).
#
# enable scroll-on-key-mapping

######################################################################
# Scroll-on-output-mapping adds mappings to F2+Control+Shift that will toggle
# the setting of scroll-on-screen-output (does the terminal scroll to bottom of
# history when something is outputted to screen).
#
# enable scroll-on-output-mapping

######################################################################
# fast-scroll-mapping adds mapping to F3+Control+Shift that will toggle
# the fast-scroll setting (the scrolling is faster, because it will
# scroll several lines at once).
#
# enable fast-scroll-mapping

######################################################################
# fi-7-bit-mapping will add another keymap for Finnish 7-bit versions
# of äåö ({}|). The F12+Control+Shift will toggle the keymap between normal
# and fi-7-bit keymap.
#
# enable fi-7-bit-mapping

######################################################################
# pf1-4-keys-in-numpad will map PF1-4 keys to numeric pad to NumLock, /, *,
# and - keys. This emulates standard vt100 key placement.
# Note! NumLock will still act as a Numlock for windows, so the keypad
# will either be in numeric or cursor keys mode.
#
# enable pf1-4-keys-in-numpad

######################################################################
# swap-bs-del-key-mapping adds mapping to BackSpace+Control-Shift and
# Delete+Control-Shift that will toggle both BSIsDel and DelIsBS settings.
# It also adds BackSpace+Control+Shift mapping that will toggle only BSIsDel
# setting and Delete+Control+Shift mapping that will toggle only DelIsBS
# setting. Note! The default Vtkeys mapping is Backspace+Shift = del,
# Delete+Shift = bs.
#
# enable swap-bs-del-key-mapping

######################################################################
# map-control-to-capslock will map Capslock key so it will be control
# key instead of capslock.         
#
# enable map-control-to-capslock
 
#
# Grammar
# -------
#
# The grammar for this file is following:
#
# Keymap keymap-struct-name
#	modifiers = modifiers-enviroment-name
#	keys = keys-environment-name
#	chars = chars-environment-name
#	vtkeys = vtkeys-environment-name
# end
#
# Modifiers modifiers-environment-name
#	key = Shift
#	key = Control
#	key = Mod1 | Alt | Meta
# 	key = Lock | CapsLock
#	key = ShiftLock
#	key = NumLock
#	key = Mod2 | AltGr | Super
#	key = Mod3 | Hyper
#	key = Mod4
#	key = Mod5
#	....
# end
#
# Keys keys-environment-name
#	key+modifierstatus = "action"
#	key+modifierstatus = "action"
#	....
# end
#
# Chars chars-environment-name
#	char = "chars"
#	char = "chars"
#	....
# end
#
# Vtkeys vtkeys-environment-name
#	TH_Name+vtmodifierstatus+vtstatus = "chars"
#	TH_Name+vtmodifierstatus+vtstatus = "chars"
#	....
# end
#
# Every name that is used must be defined BEFORE it is used, so
# normally the Keymap-struct is at the end etc..
#
#
# Modifers
# --------
#
# Modifiers-struct contains mappings from key to one modifier. There
# can be several keys mapping to same modifier and the processing of
# that key is finished after that (it is an error to have any other
# mapping for the key after defining it as a modifier (or combination of
# modifiers)).
#
#
# Keycodes / Keysyms / Keys
# -------------------------
#
# Key is one of the following:
#
#	Keycode_xxx	XXX = is the machine dependad numeric keycode
#			for the key. If you use this remember to
#			add it inside "if enabled xxx ... end".
#
#	keysym		keysym of the key, the keysym is one used in the
#			native system with default prefix removed (in
#			windows virtual keysyms without VK_ prefix, in X11
#			X11 Keysyms, without XK_ prefix etc). Keysyms are
#			case insencetive. All keysyms that are unknown are
#			silenty ignored.
#
#	Anykey		special key that matches any key if none of the
#			previous one matched. Note you can still have
#			modifiers match. 
#
#
# Modifiers-status
# ----------------
#
# In the Keys-environment the shift status is added to key. This status is
# combination of +shiftkey and -shiftkey entries added to key. The +shiftkey
# means that the shiftkey must be on and -shiftkey means that the shift must
# be off before that line matches. If some shiftkeys isn't mentioned in the
# line it's value doesn't care.
#
# So the key "Left+Shift-Control" matches in the Keys-environment if the
# Shift is down and Control is up when the cursor left key is pressed.
#
#
# Actions
# -------
#
# Actions is a whitespace separated string of actions. Each action is
# a function taking some arguments (separated with in parenthes). 
#
# Valid actions are:
#
# special-key(TH_Name)			Send special-vtkey keypress to
#					emulator. This will jump directly
#					to vtkeys table. Note that Return
#					F-keys etc must go to vtkeys-table
#					before they are converted correctly
#					to vt100 operations. 
#
# string(chars)				Send string of chars to chars
#					conversion table level. If you need
#					to have ) in your string, quote it
#					with two backslash == "\\)". The
#					second \ is needed to quote the \
#					from configuration file parser.
#
# bell()				Ring bell.
#
# insert()				Send normal string returned by key.
#
# insert-eight-bit()			Send eight-bit (Meta) version
#					of string normally returned by key.
#
# insert-selection()			Send selection buffer to forward.
#
# keymap(name)				Change to different keymap-struct.
#
# scroll-back(count, units)		Scroll text window backwards.
#					Units can be page, halfpage, or line.
#
# scroll-forward(count, units)		Scroll text window forwards.
#
# redraw()				Redraw window.
#
# set-scrollbar(on/off/toggle)		Set emulator flavors. 
# set-reverse-video(on/off/toggle)
# set-autowrap(on/off/toggle)
# set-reverse-autowrap(on/off/toggle)
# set-autolinefeed(on/off/toggle)
# set-application-cursor-keys(on/off/toggle)
# set-application-keypad(on/off/toggle)
# set-scroll-on-key(on/off/toggle)
# set-scroll-on-screen-output(on/off/toggle)
# set-visual-bell(on/off/toggle)
# set-lock-function-keys(on/off/toggle)
# set-show-cursor(on/off/toggle)
# set-smoothscroll(on/off/toggle)
# set-status-line(on/off/toggle)
# set-eight-bit-controls(on/off/toggle)
# set-local-mode(on/off/toggle)
# set-local-echo(on/off/toggle)
# set-interpret-controls(on/off/toggle)
# set-insert-mode(on/off/toggle)
# set-form-feed-after-print-screen(on/off/toggle)
# set-print-screen-full-screen(on/off/toggle)
# set-printer-on(on/off/toggle)
# set-auto-print-on-exit-line(on/off/toggle)
# set-mouse-up-down-events(on/off/toggle)
# set-linux-color-compat(on/off/toggle)
# set-block-cursor(on/off/toggle)
# set-cursor-blinks(on/off/toggle)
# set-backspace-is-delete(on/off/toggle)
# set-delete-is-backspace(on/off/toggle)
#
# foreground(color)			Set foreground color.
#
# background(color)			Set background color.
#
# default-foreground(color)		Set default foreground color.
#
# default-background(color)		Set default background color.
#
# used-mouse-buttons(bitmask)		Tell which mouse buttons to use
#					when mouse buttons are enabled.
#
# mouse-buttons-enabled(bitmask)	Enable mouse buttons told in bitmask.
#
# window-title(string)			Set window title, see string() for
#					quoting.
#
# icon-title(string)			Set icon title.
#
# log-file-name(string)			Set log file name.
#
# screen-font(font-name)		Change to font. 
#
# initialize-tab-stops(count)		Set tab stops to every count columns.
#
# soft-reset()				Do soft reset.
#
# hard-reset()				Do hard reset.
#
# clear-saved-lines()			Clear terminal history lines.
#
# history-size(count)			Set history size to count lines.
#
# visible-bell()			Do visible-bell.
#
# paste-selection()			Paste current selection
#
# copy-selection(clipboard)		Copy selection to clipboard.
#
# paste-clipboard(clipboard)		Paste clipboard. 
#
#
# Chars-environment
# -----------------
#
# This table can be used to convert any char to string of chars. In macintosh
# this table is used to convert from 8-bit mac charset to iso-latin1 charset.
# Note that this is the only table that permits you to overwrite existing
# entries in the table. In all other tables it is an error to have two
# identical key-values, but here it is allowed. 
#
#
# vtkeys-environment
# ------------------
#
# This table is used to convert emulator special keys to string of characters
# sent to remote host. The TH_Name is the name if the emualator special
# key (TH_BackSpace TH_Tab TH_Linefeed TH_Clear TH_Return TH_Pause
# TH_Scroll_Lock TH_Sys_Req TH_Escape TH_Delete TH_Multi_key
# TH_Home TH_Left TH_Up TH_Right TH_Down TH_Prior TH_Page_Up TH_Next
# TH_Page_Down TH_End TH_Begin TH_Select TH_Print TH_Execute TH_Insert
# TH_Undo TH_Redo TH_Menu TH_Find TH_Cancel TH_Help TH_Break
# TH_Mode_switch TH_script_switch TH_Num_Lock TH_KP_Space TH_KP_Tab
# TH_KP_Enter TH_KP_F1 TH_KP_F2 TH_KP_F3 TH_KP_F4 TH_KP_Home TH_KP_Left
# TH_KP_Up TH_KP_Right TH_KP_Down TH_KP_Prior TH_KP_Page_Up TH_KP_Next
# TH_KP_Page_Down TH_KP_End TH_KP_Begin TH_KP_Insert TH_KP_Delete
# TH_KP_Equal TH_KP_Multiply TH_KP_Add TH_KP_Separator TH_KP_Subtract
# TH_KP_Decimal TH_KP_Divide TH_KP_0 TH_KP_1 TH_KP_2 TH_KP_3 TH_KP_4
# TH_KP_5 TH_KP_6 TH_KP_7 TH_KP_8 TH_KP_9 TH_F1 TH_F2 TH_F3 TH_F4 TH_F5
# TH_F6 TH_F7 TH_F8 TH_F9 TH_F10 TH_F11 TH_L1 TH_F12 TH_L2 TH_F13 TH_L3
# TH_F14 TH_L4 TH_F15 TH_L5 TH_F16 TH_L6 TH_F17 TH_L7 TH_F18 TH_L8
# TH_F19 TH_L9 TH_F20 TH_L10 TH_F21 TH_R1 TH_F22 TH_R2 TH_F23 TH_R3
# TH_F24 TH_R4 TH_F25 TH_R5 TH_F26 TH_R6 TH_F27 TH_R7 TH_F28 TH_R8
# TH_F29 TH_R9 TH_F30 TH_R10 TH_F31 TH_R11 TH_F32 TH_R12 TH_F33 TH_R13
# TH_F34 TH_R14 TH_F35 TH_R15).
#
#
# Vt modifier status
# ------------------
#
# Vt modifier status is combination of the 'Shift', 'Meta', 'Control'. 
#
#
# Vt status
# --------
#
# Vt status is one of the following 'Crlf', 'Cursor', 'Keypad',
# 'Vt52', 'Vt52app'. The order of entries is significant so that None must
# come first and other modifications for the same TH_Key must come after
# that.
#
# Crlf = autolinefeed mode on
# Cursor = cursor keys in application mode
# Keypad = keypad in application mode
# vt52 = in vt52 mode
# vt52app = in vt52 application mode.
#
#
# chars
# -----
#
# Chars is string of charcters in quotes. It can have normal c-style backslash
# escapes.
#

Modifiers default-modifiers
	Shift = Shift
	Shift_L = Shift
	Shift_R = Shift
	Control = Control
	Control_L = Control
	Control_R = Control
	Alt = Alt
	Alt_L = Alt
	Alt_R = Alt
	Meta = Meta
	Meta_L = Meta
	Meta_R = Meta
	Menu = Meta
	if enabled map-control-to-capslock
		Lock = Control
		Lock_L = Control
		Lock_R = Control
		CapsLock = Control
		Capital = Control
		CapsLock_L = Control
		CapsLock_R = Control
		ShiftLock = Control
		ShiftLock_L = Control
		ShiftLock_R = Control
	else
		if enabled map-mod5-to-capslock
			Lock = mod5
			Lock_L = mod5
			Lock_R = mod5
			CapsLock = mod5
			Caps_Lock = mod5
			Capital = mod5
			CapsLock_L = mod5
			Caps_Lock_L = mod5
			CapsLock_R = mod5
			Caps_Lock_R = mod5
			ShiftLock = mod5
			Shift_Lock = mod5
			ShiftLock_L = mod5
			Shift_Lock_L = mod5
			ShiftLock_R = mod5
			Shift_Lock_R = mod5
		else
			Lock = Lock
			Lock_L = Lock
			Lock_R = Lock
			CapsLock = CapsLock
			Caps_Lock = CapsLock
			Capital = CapsLock
			CapsLock_L = CapsLock
			Caps_Lock_L = CapsLock
			CapsLock_R = CapsLock
			Caps_Lock_R = CapsLock
			ShiftLock = ShiftLock
			Shift_Lock = ShiftLock
			ShiftLock_L = ShiftLock
			Shift_Lock_L = ShiftLock
			ShiftLock_R = ShiftLock
			Shift_Lock_R = ShiftLock
		end
	end
	if not enabled pf1-4-keys-in-numpad
		NumLock = NumLock
		Num_Lock = NumLock
		NumLock_L = NumLock
		Num_Lock_L = NumLock
		NumLock_R = NumLock
		Num_Lock_R = NumLock
	end
	AltGr = AltGr
	AltGr_L = AltGr
	AltGr_R = AltGr
	Super = Super
	Super_L = Super
	Super_R = Super
	Hyper = Hyper
	Hyper_L = Hyper
	Hyper_R = Hyper
end

Chars default-chars
	switch window_system
	"macintosh" ?
		\x80 = "\xc4"
		\x81 = "\xc5"
		\x82 = "\xc7"
		\x83 = "\xc9"
		\x84 = "\xd1"
		\x85 = "\xd6"
		\x86 = "\xdc"
		\x87 = "\xe1"
		\x88 = "\xe0"
		\x89 = "\xe2"
		\x8a = "\xe4"
		\x8b = "\xe3"
		\x8c = "\xe5"
		\x8d = "\xe7"
		\x8e = "\xe9"
		\x8f = "\xe8"
		\x90 = "\xea"
		\x91 = "\xeb"
		\x92 = "\xed"
		\x93 = "\xec"
		\x94 = "\xee"
		\x95 = "\xef"
		\x96 = "\xf1"
		\x97 = "\xf3"
		\x98 = "\xf2"
		\x99 = "\xf4"
		\x9a = "\xf6"
		\x9b = "\xf5"
		\x9c = "\xfa"
		\x9d = "\xf9"
		\x9e = "\xfb"
		\x9f = "\xfc"
		\xa0 = "\x2f\x2d"
		\xa1 = "\xb0"
		\xa2 = "\xa2"
		\xa3 = "\xa3"
		\xa4 = "\xa7"
		\xa5 = "\x53\x62"
		\xa6 = "\xb6"
		\xa7 = "\xdf"
		\xa8 = "\xae"
		\xa9 = "\xa9"
		\xaa = "\x54\x4d"
		\xab = "\xb4"
		\xac = "\xa8"
		\xad = "\x21\x3d"
		\xae = "\xc6"
		\xaf = "\xd8"
		\xb0 = "\x30\x30"
		\xb1 = "\xb1"
		\xb2 = "\x3d\x3c"
		\xb3 = "\x3e\x3d"
		\xb4 = "\xa5"
		\xb5 = "\xb5"
		\xb6 = "\x64\x50"
		\xb7 = "\x2b\x5a"
		\xb8 = "\x2a\x50"
		\xb9 = "\x70\x2a"
		\xba = "\x49\x6e"
		\xbb = "\xaa"
		\xbc = "\xba"
		\xbd = "\x57\x2a"
		\xbe = "\xe6"
		\xbf = "\xf8"
		\xc0 = "\xbf"
		\xc1 = "\xa1"
		\xc2 = "\xac"
		\xc3 = "\x52\x54"
		\xc4 = "\x46\x6c"
		\xc5 = "\x3f\x32"
		\xc6 = "\x44\x2a"
		\xc7 = "\xab"
		\xc8 = "\xbb"
		\xc9 = "\x2e\x33"
		\xca = "\xa0"
		\xcb = "\xc0"
		\xcc = "\xc3"
		\xcd = "\xd5"
		\xce = "\x4f\x45"
		\xcf = "\x6f\x65"
		\xd0 = "\x2d\x4d"
		\xd1 = "\x2d\x4e"
		\xd2 = "\x22\x36"
		\xd3 = "\x22\x39"
		\xd4 = "\x27\x36"
		\xd5 = "\x27\x39"
		\xd6 = "\xf7"
		\xd7 = "\x4f\x4c"
		\xd8 = "\xff"
		\xd9 = "\x59\x3a"
		\xda = "\x2f\x66"
		\xdb = "\xa4"
		\xdc = "\x3c\x31"
		\xdd = "\x3e\x31"
		\xde = "\x66\x69"
		\xdf = "\x66\x6c"
		\xe0 = "\x2f\x3d"
		\xe1 = "\xb7"
		\xe2 = "\x2e\x39"
		\xe3 = "\x3a\x39"
		\xe4 = "\x25\x30"
		\xe5 = "\xc2"
		\xe6 = "\xca"
		\xe7 = "\xc1"
		\xe8 = "\xcb"
		\xe9 = "\xc8"
		\xea = "\xcd"
		\xeb = "\xce"
		\xec = "\xcf"
		\xed = "\xcc"
		\xee = "\xd3"
		\xef = "\xd4"
		\xf0 = "\x5f"
		\xf1 = "\xd2"
		\xf2 = "\xda"
		\xf3 = "\xdb"
		\xf4 = "\xd9"
		\xf5 = "\x69\x2e"
		\xf6 = "\x5f"
		\xf7 = "\x5f"
		\xf8 = "\xaf"
		\xf9 = "\x27\x28"
		\xfa = "\x27\x2e"
		\xfb = "\x27\x30"
		\xfc = "\xb8"
		\xfd = "\x27\x22"
		\xfe = "\x27\x3b"
		\xff = "\x27\x3c"
		end
	end
end

Vtkeys default-vtkeys

# Backspace and delete ascii characters are special in such way that the
# settings in the keyboard panel can change them to each other. 
	TH_BackSpace = "\010"
	TH_BackSpace+Shift = "\177"
	TH_Delete = "\177"
	TH_Delete+Shift = "\010"
	TH_KP_Delete = "\177"
	TH_KP_Delete+Shift = "\010"

	TH_Tab = "\011"
	TH_Linefeed = "\012"
	TH_Clear = "\014"
	TH_Return = "\015"
	TH_Return+Crlf = "\015\012"
	TH_Return+Shift = "\012"
	TH_Pause = "\023"
	TH_Escape = "\033"
	TH_Undo = "\037"
	TH_Up = "\033[A"
	TH_Up+Cursor = "\033OA"
	TH_Up+Vt52 = "\033A"
	TH_Down = "\033[B"
	TH_Down+Cursor = "\033OB"
	TH_Down+Vt52 = "\033B"
	TH_Right = "\033[C"
	TH_Right+Cursor = "\033OC"
	TH_Right+Vt52 = "\033C"
	TH_Left = "\033[D"
	TH_Left+Cursor = "\033OD"
	TH_Left+Vt52 = "\033D"
	TH_KP_Space = " "
	TH_KP_Space+Control = "\000"
	TH_KP_Tab = "\011"
	TH_KP_Enter = "\015"
	TH_KP_Enter+Crlf = "\015\012"
	TH_KP_Enter+Shift = "\012"
	TH_KP_Enter+Keypad = "\033OM"
	TH_KP_Enter+Vt52app = "\033?M"
	TH_KP_F1 = "\033OP"
	TH_KP_F1+Keypad = "\033OP"
	TH_KP_F1+Vt52 = "\033P"
	TH_KP_F1+Vt52app = "\033P"
	TH_KP_F2 = "\033OQ"
	TH_KP_F2+Keypad = "\033OQ"
	TH_KP_F2+Vt52 = "\033Q"
	TH_KP_F2+Vt52app = "\033Q"
	TH_KP_F3 = "\033OR"
	TH_KP_F3+Keypad = "\033OR"
	TH_KP_F3+Vt52 = "\033R"
	TH_KP_F3+Vt52app = "\033R"
	TH_KP_F4 = "\033OS"
	TH_KP_F4+Keypad = "\033OS"
	TH_KP_F4+Vt52 = "\033S"
	TH_KP_F4+Vt52app = "\033S"
	TH_KP_Up = "\033[A"
	TH_KP_Up+Cursor = "\033OA"
	TH_KP_Up+Vt52 = "\033A"
	TH_KP_Down = "\033[B"
	TH_KP_Down+Cursor = "\033OB"
	TH_KP_Down+Vt52 = "\033B"
	TH_KP_Right = "\033[C"
	TH_KP_Right+Cursor = "\033OC"
	TH_KP_Right+Vt52 = "\033C"
	TH_KP_Left = "\033[D"
	TH_KP_Left+Cursor = "\033OD"
	TH_KP_Left+Vt52 = "\033D"
	TH_KP_Separator = ","
	TH_KP_Separator+Keypad = "\033Ol"
	TH_KP_Separator+Vt52app = "\033?l"
	TH_KP_Subtract = "-"
	TH_KP_Subtract+Keypad = "\033Om"
	TH_KP_Subtract+Vt52app = "\033?m"
	TH_KP_Decimal = "."
	TH_KP_Decimal+Keypad = "\033On"
	TH_KP_Decimal+Vt52app = "\033?n"
	TH_KP_0 = "0"
	TH_KP_0+Keypad = "\033Op"
	TH_KP_0+Vt52app = "\033?p"
	TH_KP_1 = "1"
	TH_KP_1+Keypad = "\033Oq"
	TH_KP_1+Vt52app = "\033?q"
	TH_KP_2 = "2"
	TH_KP_2+Keypad = "\033Or"
	TH_KP_2+Vt52app = "\033?r"
	TH_KP_3 = "3"
	TH_KP_3+Keypad = "\033Os"
	TH_KP_3+Vt52app = "\033?s"
	TH_KP_4 = "4"
	TH_KP_4+Keypad = "\033Ot"
	TH_KP_4+Vt52app = "\033?t"
	TH_KP_5 = "5"
	TH_KP_5+Keypad = "\033Ou"
	TH_KP_5+Vt52app = "\033?u"
	TH_KP_6 = "6"
	TH_KP_6+Keypad = "\033Ov"
	TH_KP_6+Vt52app = "\033?v"
	TH_KP_7 = "7"
	TH_KP_7+Keypad = "\033Ow"
	TH_KP_7+Vt52app = "\033?w"
	TH_KP_8 = "8"
	TH_KP_8+Keypad = "\033Ox"
	TH_KP_8+Vt52app = "\033?x"
	TH_KP_9 = "9"
	TH_KP_9+Keypad = "\033Oy"
	TH_KP_9+Vt52app = "\033?y"
	TH_KP_Equal = "="
	TH_KP_Multiply = "*"
	TH_KP_Add = "+"
	TH_KP_Divide = "/"
	TH_Find = "\033[1~"
	TH_Insert = "\033[2~"
	TH_Home = "\033[2~"
	TH_KP_Insert = "\033[2~"
	TH_Select = "\033[4~"
	TH_End = "\033[4~"
	TH_Prior = "\033[5~"
	TH_KP_Prior = "\033[5~"
	TH_Page_Up = "\033[5~"
	TH_KP_Page_Up = "\033[5~"
	TH_Next = "\033[6~"
	TH_KP_Next = "\033[6~"
	TH_Page_Down = "\033[6~"
	TH_KP_Page_Down = "\033[6~"
	TH_F1 = "\033[11~"
	TH_F2 = "\033[12~"
	TH_F3 = "\033[13~"
	TH_F4 = "\033[14~"
	TH_F5 = "\033[15~"
	TH_F6 = "\033[17~"
	TH_F7 = "\033[18~"
	TH_F8 = "\033[19~"
	TH_F9 = "\033[20~"
	TH_F10 = "\033[21~"
	TH_F11 = "\033[23~"
	TH_F12 = "\033[24~"
	TH_F13 = "\033[25~"
	TH_F14 = "\033[26~"
	TH_Help = "\033[28~"
	TH_Execute = "\033[29~"
	TH_F17 = "\033[31~"
	TH_F18 = "\033[32~"
	TH_F19 = "\033[33~"
	TH_F20 = "\033[34~"
end

Keys default-keys
	Back = "special-key(TH_BackSpace)"
	BackSpace = "special-key(TH_BackSpace)"
	if enabled swap-bs-del-key-mapping
		Back+Control-Shift = "set-backspace-is-delete(toggle)
				      set-delete-is-backspace(toggle)"
		BackSpace+Control-Shift = "set-backspace-is-delete(toggle)
					   set-delete-is-backspace(toggle)"
		Back+Control+Shift = "set-backspace-is-delete(toggle)"
		BackSpace+Control+Shift = "set-backspace-is-delete(toggle)"
	end
	Tab = "special-key(TH_Tab)"
	Linefeed = "special-key(TH_Linefeed)"
	Clear = "special-key(TH_Clear)"
	Return = "special-key(TH_Return)"
	Pause = "special-key(TH_Pause)"
	Scroll = "special-key(TH_Scroll_Lock)"
	ScrollLock = "special-key(TH_Scroll_Lock)"
	Scroll_Lock = "special-key(TH_Scroll_Lock)"
	Sys_Req = "special-key(TH_Sys_Req)"
	Escape = "special-key(TH_Escape)"
	Space+Control = "string(\000)"
	Delete = "special-key(TH_Delete)"
	if enabled swap-bs-del-key-mapping
		Delete+Control-Shift = "set-backspace-is-delete(toggle)
					set-delete-is-backspace(toggle)"
		Delete+Control+Shift = "set-delete-is-backspace(toggle)"
	end
	Multi_Key = "special-key(TH_Multi_Key)"
	Home = "special-key(TH_Home)"
	Left = "special-key(TH_Left)"
	Up = "special-key(TH_Up)"
	Right = "special-key(TH_Right)"
	Down = "special-key(TH_Down)"
	Prior = "special-key(TH_Page_Up)"
	Page_Up = "special-key(TH_Page_Up)"
	Next = "special-key(TH_Page_Down)"
	Page_Down = "special-key(TH_Page_Down)"
	End = "special-key(TH_End)"
	Begin = "special-key(TH_Begin)"
	Select = "special-key(TH_Select)"
	Snapshot = "special-key(TH_Print)"
	Print = "special-key(TH_Print)"
	Insert = "special-key(TH_Insert)"
	Insert+Control-Shift = "copy-selection(PRIMARY)"
	Insert-Control+Shift = "paste-clipboard(PRIMARY)"
	Execute = "special-key(TH_Execute)"
	switch window_system
	"windows" ?
		Execute = "special-key(TH_KP_Enter)"
		end
	end
	Undo = "special-key(TH_Undo)"
	Redo = "special-key(TH_Redo)"
	Keycode_189+Control = "special-key(TH_Undo)"

# We dont want to map menu key to anything as it is used to bring up the menus
# in windows (Alt-key). 
#	Menu = "special-key(TH_Menu)"

	Find = "special-key(TH_Find)"
	Cancel = "special-key(TH_Cancel)"
	Help = "special-key(TH_Help)"
	Break = "special-key(TH_Break)"
	Mode_switch = "special-key(TH_Mode_switch)"
	Script_switch = "special-key(TH_Script_switch)"
	KP_Tab = "special-key(TH_KP_Tab)"
	KP_Enter = "special-key(TH_KP_Enter)"
	KP_F1 = "special-key(TH_KP_F1)"
	KP_F2 = "special-key(TH_KP_F2)"
	KP_F3 = "special-key(TH_KP_F3)"
	KP_F4 = "special-key(TH_KP_F4)"
	KP_Home = "special-key(TH_KP_Home)"
	KP_Left = "special-key(TH_KP_Left)"
	KP_Up = "special-key(TH_KP_Up)"
	KP_Right = "special-key(TH_KP_Right)"
	KP_Down = "special-key(TH_KP_Down)"
	KP_Prior = "special-key(TH_KP_Prior)"
	KP_Page_Up = "special-key(TH_KP_Page_Up)"
	KP_Next = "special-key(TH_KP_Next)"
	KP_Page_Down = "special-key(TH_KP_Page_Down)"
	KP_End = "special-key(TH_KP_End)"
	KP_Begin = "special-key(TH_KP_Begin)"
	KP_Insert = "special-key(TH_KP_Insert)"
	KP_Delete = "special-key(TH_KP_Delete)"
	if enabled swap-bs-del-key-mapping
		KP_Delete+Control-Shift = "set-backspace-is-delete(toggle)
					   set-delete-is-backspace(toggle)"
		KP_Delete+Control+Shift = "set-delete-is-backspace(toggle)"
	end
	KP_Equal = "special-key(TH_KP_Equal)"
#	if enabled pf1-4-keys-in-numpad
#		NumLock = "special-key(TH_KP_F1)"
#		Divide = "special-key(TH_KP_F2)"
#		Multiply = "special-key(TH_KP_F3)"
#		Subtract = "special-key(TH_KP_F4)"
#		KP_Divide = "special-key(TH_KP_F2)"
#		KP_Multiply = "special-key(TH_KP_F3)"
#		KP_Subtract = "special-key(TH_KP_F4)"
#	else
#		Divide = "special-key(TH_KP_Divide)"
#		Multiply = "special-key(TH_KP_Multiply)"
#		Subtract = "special-key(TH_KP_Subtract)"
#		KP_Divide = "special-key(TH_KP_Divide)"
#		KP_Multiply = "special-key(TH_KP_Multiply)"
#		KP_Subtract = "special-key(TH_KP_Subtract)"
#	end
#	Add = "special-key(TH_KP_Add)"
#	Separator = "special-key(TH_KP_Separator)"
#	Decimal = "special-key(TH_KP_Decimal)"
#	Numpad0 = "special-key(TH_KP_0)"
#	KP_0 = "special-key(TH_KP_0)"
#	Numpad1 = "special-key(TH_KP_1)"
#	KP_1 = "special-key(TH_KP_1)"
#	Numpad2 = "special-key(TH_KP_2)"
#	KP_2 = "special-key(TH_KP_2)"
#	Numpad3 = "special-key(TH_KP_3)"
#	KP_3 = "special-key(TH_KP_3)"
#	Numpad4 = "special-key(TH_KP_4)"
#	KP_4 = "special-key(TH_KP_4)"
#	Numpad5 = "special-key(TH_KP_5)"
#	KP_5 = "special-key(TH_KP_5)"
#	Numpad6 = "special-key(TH_KP_6)"
#	KP_6 = "special-key(TH_KP_6)"
#	Numpad7 = "special-key(TH_KP_7)"
#	KP_7 = "special-key(TH_KP_7)"
#	Numpad8 = "special-key(TH_KP_8)"
#	KP_8 = "special-key(TH_KP_8)"
#	Numpad9 = "special-key(TH_KP_9)"
#	KP_9 = "special-key(TH_KP_9)"
	F1 = "special-key(TH_F1)"
	F2 = "special-key(TH_F2)"
	F3 = "special-key(TH_F3)"
	F4 = "special-key(TH_F4)"
	F5 = "special-key(TH_F5)"
	F6 = "special-key(TH_F6)"
	F7 = "special-key(TH_F7)"
	F8 = "special-key(TH_F8)"
	F9 = "special-key(TH_F9)"
	F10 = "special-key(TH_F10)"
	F11 = "special-key(TH_F11)"
	L1 = "special-key(TH_L1)"
	F12 = "special-key(TH_F12)"
	L2 = "special-key(TH_L2)"
	F13 = "special-key(TH_F13)"
	L3 = "special-key(TH_L3)"
	F14 = "special-key(TH_F14)"
	L4 = "special-key(TH_L4)"
	F15 = "special-key(TH_F15)"
	L5 = "special-key(TH_L5)"
	F16 = "special-key(TH_F16)"
	L6 = "special-key(TH_L6)"
	F17 = "special-key(TH_F17)"
	L7 = "special-key(TH_L7)"
	F18 = "special-key(TH_F18)"
	L8 = "special-key(TH_L8)"
	F19 = "special-key(TH_F19)"
	L9 = "special-key(TH_L9)"
	F20 = "special-key(TH_F20)"
	L10 = "special-key(TH_L10)"
	F21 = "special-key(TH_F21)"
	R1 = "special-key(TH_R1)"
	F22 = "special-key(TH_F22)"
	R2 = "special-key(TH_R2)"
	F23 = "special-key(TH_F23)"
	R3 = "special-key(TH_R3)"
	F24 = "special-key(TH_F24)"
	R4 = "special-key(TH_R4)"
	F25 = "special-key(TH_F25)"
	R5 = "special-key(TH_R5)"
	F26 = "special-key(TH_F26)"
	R6 = "special-key(TH_R6)"
	F27 = "special-key(TH_F27)"
	R7 = "special-key(TH_R7)"
	F28 = "special-key(TH_F28)"
	R8 = "special-key(TH_R8)"
	F29 = "special-key(TH_F29)"
	R9 = "special-key(TH_R9)"
	F30 = "special-key(TH_F30)"
	R10 = "special-key(TH_R10)"
	F31 = "special-key(TH_F31)"
	R11 = "special-key(TH_R11)"
	F32 = "special-key(TH_F32)"
	R12 = "special-key(TH_R12)"
	F33 = "special-key(TH_F33)"
	R13 = "special-key(TH_R13)"
	F34 = "special-key(TH_F34)"
	R14 = "special-key(TH_R14)"
	F35 = "special-key(TH_F35)"
	R15 = "special-key(TH_R15)"

	Prior+Shift-Control = "scroll-back(1, line)"
	Page_Up+Shift-Control = "scroll-back(1, line)"
	Prior-Shift+Control = "scroll-back(1, halfpage)"
	Page_Up-Shift+Control = "scroll-back(1, halfpage)"

	Next+Shift-Control = "scroll-forward(1, line)"
	Page_Down+Shift-Control = "scroll-forward(1, line)"
	Next-Shift+Control = "scroll-forward(1, halfpage)"
	Page_Down-Shift+Control = "scroll-forward(1, halfpage)"

	if enabled mod5-key-to-eight-bit
		Anykey+mod5 = "insert-eight-bit()"
		AnyKey-mod5 = "insert()"
	else
		AnyKey = "insert()"
	end
	if enabled scroll-on-key-mapping
		F1+Control+Shift = "set-scroll-on-key(toggle)"
	end
	if enabled scroll-on-output-mapping
		F2+Control+Shift = "set-scroll-on-screen-output(toggle)"
	end
	if enabled fast-scroll-mapping
		F3+Control+Shift = "set-fast-scroll(toggle)"
	end
	if enabled fi-7-bit-mapping
	 	F12+Control+Shift = "keymap(fi-7-bit-keymap)"
	end
end

Keymap default-keymap
	modifiers = default-modifiers
	keys = default-keys
	chars = default-chars
	vtkeys = default-vtkeys
end


# Keymap for 7-bit Finnish chars. You can switch to this keymap by
# binding some key to execute "keymap(fi-7-bit-chars)" command.
# Yoy can get back to default keymap by pressing Ctrl+Shift+F12
#
# This is only here to show you how you can have several keymaps
# and how you can take defaults from some other definition.
#
# We cannot use if enabled to comment out whole section only all mappings
# inside, so if fi-7-bit-mapping is not enabled this will generate an
# empty keymap named fi-7-bit-keymap, and there is no way to change to that
# keymap.
#
# This will also demonstrate how to use anonymous structures and merges.

Keymap fi-7-bit-keymap
	if enabled fi-7-bit-mapping
		modifiers = default-modifiers
		keys = Keys
			merge default-keys
#			F12+Control+Shift = "keymap(default-keymap)"
		end
		chars = Chars
			merge default-chars
			switch window_system
			"macintosh" ?
				\x8a = "{"
		 		\x8c = "}"
				\x9a = "|"
				\x80 = "["
				\x81 = "]"
				\x85 = "\\"
				end
			"x11" ? 
				ä = "{"
		 		å = "}"
		 		ö = "|"
		 		Ä = "["
		 		Å = "]"
		 		Ö = "\\"
				end
			"windows" ? 
				ä = "{"
		 		å = "}"
		 		ö = "|"
		 		Ä = "["
		 		Å = "]"
		 		Ö = "\\"
				end
			end
		end
		vtkeys = default-vtkeys
	end
end

# This will tell the default keymap strcture.

use default-keymap


