// based on a keyboard map from an 'xkb/symbols/il' file

// This is a partial implemetation of the Israeli standard SI-1452
// It does not implement changes to the English layout ("Alt-English"), 
// as I believe that it is not the job of this layout to modify the English
// layout.
partial default alphanumeric_keys 
xkb_symbols "basic" {
    // uses the kbd layout in use in Israel.

    name[Group1]= "Hebrew";

    key <AD01> { [ slash,	Q		]	};
    key <AD02> { [ apostrophe,	W		]	};
    key <AD04> { [ hebrew_resh,	R		]	};
    key <AD05> { [ hebrew_aleph,T		]       };
    key <AD06> { [ hebrew_tet,	Y		]       };
    key <AD07> { [ hebrew_waw,	U		]       };
    key <AD08> { [ hebrew_finalnun,	I	]       };
    key <AD09> { [ hebrew_finalmem,	O	]       };
    key <AD10> { [ hebrew_pe,	P		]	};

    key <AC02> { [ hebrew_dalet,S		]       };
    key <AC03> { [ hebrew_gimel,D		]       };
    key <AC04> { [ hebrew_kaph,	F		]	};
    key <AC05> { [ hebrew_ayin,	G		]       };
    key <AC06> { [ hebrew_yod,	H		]       };
    key <AC07> { [ hebrew_chet,	J		]	};
    key <AC08> { [ hebrew_lamed, K		]	};
    key <AC09> { [ hebrew_finalkaph,	L	]       };
    key <AC10> { [ hebrew_finalpe,	colon	]       };
    key <AC11> { [ comma,	quotedbl	]	};

    key <AB01> { [ hebrew_zain,	Z		]       };
    key <AB02> { [ hebrew_samech, X		]       };
    key <AB03> { [ hebrew_bet,	C		]       };
    key <AB04> { [ hebrew_he,	V		]       };
    key <AB05> { [ hebrew_nun,	B		]       };
    key <AB06> { [ hebrew_mem,	N		]	};
    key <AB07> { [ hebrew_zade,	M		]	};
    // Mirrored:
    key <AB08> { [ hebrew_taw,	greater		]	};
    key <AB09> { [ hebrew_finalzade,	less	]	};

    key.type[Group1] = "THREE_LEVEL";
    
    key <TLDE> { [ semicolon,	asciitilde,0x10005b0	]}; // Sheva
    key <AB10> { [ period,	question,  0x10005c3	]}; // Sof Pasuq
    key <AD03> { [ hebrew_qoph,	E,	EuroSign	]};
    key <AC01> { [ hebrew_shin,	A,	0x10020AA	]};
  
    // The following may get overriden by the iso9995-3(basic101) symbols.
    // therefore they are included here. 
    // Including them isn't a great idea (for instance: what if group 1 uses
    // UK keyboard mapping, and maps shift-3 to sterling? This mapping won't
    // preserve that, and I'm not sure that this is a good feature.
    key <AE01> { [     1, exclam      , 0x10005b1	]}; // H. Segol
    key <AE02> { [     2, at          , 0x10005b2	]}; // H. Patah
    key <AE03> { [     3, numbersign  , 0x10005b3	]}; // H.  Qamats
    key <AE04> { [     4, dollar      , 0x10005b4	]}; // Hiriq
    key <AE05> { [     5, percent     , 0x10005b5	]}; // Tsere
    key <AE06> { [     6, asciicircum , 0x10005b6	]}; // Segol
    key <AE07> { [     7, ampersand   , 0x10005b7	]}; // Patah
    key <AE08> { [     8, asterisk    , 0x10005b8	]}; // Qamats
    // Mirrored: 
    key <AE09> { [     9, parenright   , 0x10005c2	]}; // Sin dot
    key <AE10> { [     0, parenleft  , 0x10005c1	]}; // Shin dot
    key <AE11> { [ minus, underscore  , 0x10005b9	]}; // Holam
    key <AE12> { [ equal, plus        , 0x10005bc	]}; // Dagesh/Shuruq
  
    // Mirrored: 
    key <AD11> { [ bracketright, braceright, 0x10005bf	]}; // Rafe
    key <AD12> { [ bracketleft,  braceleft,  0x10005bd	]}; // Meteg
                                      
    key <BKSL> { [ backslash,    bar,  0x10005bb	]}; // Qubuts    

    include "level3(ralt_switch)"
};


// nikud patter based on Dekel Tsur's Hebrew mapping for LyX
partial alphanumeric_keys 
xkb_symbols "lyx" {
    name[Group1]= "Hebrew (lyx)";

    key <TLDE> { [ semicolon,	asciitilde	]	};
    // On some key (e.g. AD01, right below) there is not yet mapping for the
    // second shift level. Since I could not figure a simple way to map this
    // to "emit nothing", it is currently mapped to the same letter of the
    // first shift level (avoiding mapping may risk it be used by a character
    // from a different group).
    key <AD01> { [ slash,	slash		]       };
    key <AD02> { [ apostrophe,	apostrophe	]       };
    key <AD03> { [ hebrew_qoph,	0x10005b8	]	}; // Qamats
    key <AD04> { [ hebrew_resh,	0x10005bc	]       }; // Dagesh/Shuruq
    key <AD05> { [ hebrew_aleph,	0x100200e	]       }; // LRM
    key <AD06> { [ hebrew_tet,	0x100200f	]       }; // RLM
    key <AD07> { [ hebrew_waw,	0x10005b9	]       }; // Holam
    key <AD08> { [ hebrew_finalnun,hebrew_finalnun]      };
    key <AD09> { [ hebrew_finalmem,hebrew_finalmem]      };
    key <AD10> { [ hebrew_pe,	0x10005b7	]	}; // Patah

    key <AC01> { [ hebrew_shin,	0x10005b0	]	}; // Sheva
    key <AC02> { [ hebrew_dalet,	0x10005bc	]       }; // Dagesh/Shuruq
    key <AC03> { [ hebrew_gimel,	hebrew_gimel	]       };
    key <AC04> { [ hebrew_kaph,	hebrew_kaph	]	}; 
    key <AC05> { [ hebrew_ayin,	0x10005c2	]       }; // Sin dot
    key <AC06> { [ hebrew_yod,	0x10005c1	]       }; // Shin dot
    key <AC07> { [ hebrew_chet,	0x10005b4	]	}; // Hiriq
    key <AC08> { [ hebrew_lamed, 0x10020aa	]	}; // NIS
    key <AC09> { [ hebrew_finalkaph,hebrew_finalkaph]    };
    key <AC10> { [ hebrew_finalpe,	colon	]       };
    key <AC11> { [ comma,	quotedbl	]	};

    key <AB01> { [ hebrew_zain,	hebrew_zain	]       };
    key <AB02> { [ hebrew_samech,0x10005b6	]       }; // Segol
    key <AB03> { [ hebrew_bet,	0x10005bb	]       }; // Qubuts
    key <AB04> { [ hebrew_he,	0x10005b1	]       }; // H. Segol
    key <AB05> { [ hebrew_nun,	0x10005b2	]	}; // H. Patah
    key <AB06> { [ hebrew_mem,	0x10005b3	]       }; // H.  Qamats
    key <AB07> { [ hebrew_zade,	0x10005b5	]	}; // Tsere
    key <AB08> { [ hebrew_taw,	greater		]	};
    key <AB09> { [ hebrew_finalzade,	less	]	};
    key <AB10> { [ period,	question	]	};

    // Note the parens mirroring below:
    key <AD11> { [ bracketright,	braceright	]       };
    key <AD12> { [ bracketleft,	braceleft	]       };
    key <AE09> { [ 9         ,	parenright	]       };
    key <AE10> { [ 0         ,	parenleft	]       };
    
    key <AE11> { [ minus     ,	0x10005be	]	}; // H. Hiphen
    key <AE12> { [ equal     ,	plus		]	};
};


partial alphanumeric_keys 
xkb_symbols "phonetic" {

    // uses the phonetic layout from old Slackware 'il.map' file

    name[Group1]= "Hebrew (phonetic)";

    key <AE12> {        [     equal,    plus, hebrew_doublelowline, hebrew_doublelowline ]};

    key <LatQ> {	[ hebrew_qoph, hebrew_qoph	]	};
    key <LatW> {	[ hebrew_waw, hebrew_waw	]	};
    key <LatE> {	[ hebrew_aleph, hebrew_aleph	]       };
    key <LatR> {	[ hebrew_resh, hebrew_resh	]	};
    key <LatT> {	[ hebrew_taw, hebrew_tet	]       };
    key <LatY> {	[ hebrew_ayin, hebrew_ayin	]       };
    key <LatU> {	[ hebrew_waw, hebrew_waw	]       };
    key <LatI> {	[ hebrew_yod, hebrew_yod	]       };
    key <LatO> {	[ hebrew_samech, hebrew_samech	]       };
    key <LatP> {	[ hebrew_pe, hebrew_finalpe	]	};

    key <LatA> {	[ hebrew_aleph, hebrew_aleph	]	};
    key <LatS> {	[ hebrew_shin, hebrew_shin	]       };
    key <LatD> {	[ hebrew_dalet, hebrew_dalet	]       };
    key <LatF> {	[ hebrew_pe, hebrew_finalpe	]	};
    key <LatG> {	[ hebrew_gimel, hebrew_gimel	]       };
    key <LatH> {	[ hebrew_he, hebrew_he		]       };
    key <LatJ> {	[ hebrew_yod, hebrew_yod	]	};
    key <LatK> {	[ hebrew_kaph, hebrew_finalkaph	]	};
    key <LatL> {	[ hebrew_lamed, hebrew_lamed	]       };

    key <LatZ> {	[ hebrew_zain, hebrew_zain	]       };
    key <LatX> {	[ hebrew_chet, hebrew_chet	]       };
    key <LatC> {	[ hebrew_zade, hebrew_finalzade	]       };
    key <LatV> {	[ hebrew_waw, hebrew_waw	]       };
    key <LatB> {	[ hebrew_bet, hebrew_bet	]       };
    key <LatN> {	[ hebrew_nun, hebrew_finalnun	]	};
    key <LatM> {	[ hebrew_mem, hebrew_finalmem	]	};
};

// The 'Biblical Hebrew' keyboard layout as defined by Tiro for use with the
// 'SBL Hebrew' font was added 2006.11.13 by Sebastian J. Bronner
// <waschtl@sbronner.com>.  Its primary features (as compared to the lyx layout)
// are that the consonants are in the Israeli standard positions, that a great
// multitude of glyphs can be input directly from the keyboard, and that it is
// the closest thing to a standard layout a theologian can hope for.
// Documentation (including printable keyboard tables), SBL Hebrew font, and
// keyboard layout for Windows are available at
// http://www.sbl-site.org/Resources/Resources_BiblicalFonts.aspx.
//
// It is of interest that the 'basic' layout defined first in this file (as
// ships with x.org disagrees in the non-consonant characters that the Tiro-
// layout claims to be the Israeli standard.  Tiros apparent diligence in the
// PDF-documentation accompanying the keyboard-layout-files lead me to put
// greater stock in their claim than in this file.  Therefore, the 'biblical'
// layout below does not include 'il(basic)' but redoes the _whole_ thing from
// scratch.

partial alphanumeric_keys 
xkb_symbols "biblical" {
	name[Group1]= "Hebrew (Biblical, Tiro)";
	key.type = "FOUR_LEVEL_SEMIALPHABETIC";

	key <TLDE> { [ U05C3, U05AE, semicolon, asciitilde ] };
	key <AE01> { [ 1,     U05A9, VoidSymbol, exclam ] };
	key <AE02> { [ 2,     U0599, VoidSymbol, at ] };
	key <AE03> { [ 3,     U0592, VoidSymbol, numbersign ] };
	key <AE04> { [ 4,     U05AF, NewSheqelSign, dollar ] };
	key <AE05> { [ 5,     VoidSymbol, U200D, percent ] };
	key <AE06> { [ 6,     U05B9, U200C, asciicircum ] };
	key <AE07> { [ 7,     U05BF, U034F, ampersand ] };
	key <AE08> { [ 8,     U05C2, U200E, asterisk ] };
	key <AE09> { [ 9,     U05C1, U200F, parenright ] };
	key <AE10> { [ 0,     U059D, U25CC, parenleft ] };
	key <AE11> { [ U05BE, U05A0, minus, underscore ] };
	key <AE12> { [ equal, U05BC, VoidSymbol, plus ] };

	key <AD01> { [ U0307, U05C4, U0308, slash ] };
	key <AD02> { [ U05F3, U05AC, U05F4, apostrophe ] };
	key <AD03> { [ hebrew_qoph, U05AB, U20AC ] };
	key <AD04> { [ hebrew_resh, U059F ] };
	key <AD05> { [ hebrew_aleph, U0593 ] };
	key <AD06> { [ hebrew_tet, U059E ] };
	key <AD07> { [ hebrew_waw, U059C, U05F0 ] };
	key <AD08> { [ hebrew_finalnun, U05A1 ] };
	key <AD09> { [ hebrew_finalmem, U0595 ] };
	key <AD10> { [ hebrew_pe, U0594 ] };
	key <AD11> { [ bracketright, U0597, VoidSymbol, braceright ] };
	key <AD12> { [ bracketleft, U0598, VoidSymbol, braceleft ] };
	key <BKSL> { [ U05C0, U05A8, backslash, bar ] };

	key <AC01> { [ hebrew_shin, U05BD ] };
	key <AC02> { [ hebrew_dalet, U05B0 ] };
	key <AC03> { [ hebrew_gimel, U05BB ] };
	key <AC04> { [ hebrew_kaph, U05B4 ] };
	key <AC05> { [ hebrew_ayin, U05B1 ] };
	key <AC06> { [ hebrew_yod, U05B6, U05F2 ] };
	key <AC07> { [ hebrew_chet, U05B5, U05F1 ] };
	key <AC08> { [ hebrew_lamed, U05B3 ] };
	key <AC09> { [ hebrew_finalkaph, U05B8, U05C7 ] };
	key <AC10> { [ hebrew_finalpe, U05B2, VoidSymbol, colon ] };
	key <AC11> { [ U059a, U05B7, comma, quotedbl ] };

	key <AB01> { [ hebrew_zain, U05C5 ] };
	key <AB02> { [ hebrew_samech, U05A4 ] };
	key <AB03> { [ hebrew_bet, U05AA, U05A2 ] };
	key <AB04> { [ hebrew_he, U05A6 ] };
	key <AB05> { [ hebrew_nun, U05A5, U05C6 ] };
	key <AB06> { [ hebrew_mem, U05A7 ] };
	key <AB07> { [ hebrew_zade, U059B ] };
	key <AB08> { [ hebrew_taw, U0591, VoidSymbol, greater ] };
	key <AB09> { [ hebrew_finalzade, U0596, VoidSymbol, less ] };
	key <AB10> { [ U05AD, U05A3, period, question ] };

	key <SPCE> { [ space, space, thinspace, nobreakspace ] };
};
