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

partial default alphanumeric_keys
xkb_symbols "basic" {

    // Describes the differences between a very simple en_US
    // keyboard and a Norwegian keyboard with dead key support
    // and all of ISO-8859-1 characters available.

    include "latin(type2)"

    name[Group1]="Norwegian";

    key <AB09>	{ [    period,      colon, ellipsis,   periodcentered ]	};
    key <AB10>	{ [     minus, underscore,       endash,       emdash ]	};
    key <AD04>	{ [         r,          R,   registered,    trademark ]	};
    key <AD10>	{ [         p,          P,        Greek_pi,        Greek_PI ]	};
    key <AE05>	{ [         5,    percent,      onehalf,         0x1002030 ]	};

    key <AE11>	{ [      plus,   question,    plusminus, questiondown ]	};
    key <AE12>	{ [ backslash, dead_grave,   dead_acute,      notsign ]	};


    key <AC10>	{ [    oslash,   Ooblique,   dead_acute, dead_doubleacute ] };
    key <AC11>	{ [        ae,         AE, dead_circumflex, dead_caron]	};
    key <TLDE>	{ [       bar,    section,    brokenbar,    paragraph ]	};

    key <BKSL>	{ [apostrophe,   asterisk, dead_doubleacute, multiply ]	};
    key <LSGT>	{ [      less,    greater,      onehalf, threequarters]	};

    include "nbsp(level3n)"
    include "keypad(ossmath)"
    include "kpdl(comma)"

    include "level3(ralt_switch)"
};

partial alphanumeric_keys
xkb_symbols "nodeadkeys" {

    // Modifies the basic Norwegian layout to eliminate dead keys

    include "no(basic)"

    name[Group1]="Norwegian (eliminate dead keys)";

    key <AE12>	{ [ backslash,      grave,        acute,       ogonek ]	};
    key <AD12>	{ [ diaeresis, asciicircum,   asciitilde,      macron ]	};
    key <AC10>	{ [    oslash,   Ooblique,        acute,  doubleacute ]	};
    key <AC11>	{ [        ae,         AE,  asciicircum,        caron ]	};
    key <AB08>	{ [     comma,  semicolon,      cedilla,       ogonek ]	};
    key <AB09>	{ [    period,      colon, periodcentered,   abovedot ]	};
};

// Norwegian Dvorak
partial alphanumeric_keys 
xkb_symbols "dvorak" {
    include "us(dvorak)"

    name[Group1]="Norwegian (Dvorak)";

    key <TLDE> { [	  bar,	section, brokenbar, paragraph	] };

    key <AE01> { [	    1,	exclam, exclamdown, onesuperior	] };
    key <AE02> { [	    2,	quotedbl,   at,     twosuperior	] };
    key <AE03> { [	    3,	numbersign, sterling, threesuperior ] };
    key <AE04> { [	    4,	dollar,     currency,onequarter	] };
    key <AE05> { [	    5,	percent,    onehalf,	onehalf	] };
    key <AE06> { [	    6,	ampersand,  threequarters, threequarters ] };
    key <AE07> { [	    7,	slash,      braceleft, division	] };
    key <AE08> { [	    8,	parenleft,  bracketleft		] };
    key <AE09> { [	    9,	parenright, bracketright	] };
    key <AE10> { [	    0,	equal,	    braceright		] };
    key <AE11> { [	 plus,	question,   plusminus, questiondown ] };
    key <AE12> { [   backslash,	grave,	    dead_acute,	dead_grave  ] };

    key <AD01> { [       aring,	Aring,  braceright, bracketright ] };
    key <AD02> { [	comma,	semicolon, dead_cedilla, cedilla ] };
    key <AD03> { [      period,	colon,  periodcentered		 ] };
    key <AD04> { [	    p,	P,      thorn,	THORN		 ] };
    key <AD05> { [	    y,	Y,      yen			 ] };
    key <AD06> { [	    f,	F,      ordfeminine		 ] };
    key <AD08> { [	    c,	C,      ccedilla, copyright	 ] };
    key <AD09> { [	    r,	R,      registered		 ] };
    key <AD11> { [  apostrophe,	asterisk, dead_circumflex, acute ] };
    key <AD12> { [  asciitilde,	asciicircum, dead_diaeresis, dead_tilde	] };

    key <AC03> { [	    e,	E,      EuroSign,	cent	 ] };
    key <AC05> { [	    i,	I,      idotless,       Iabovedot] };
    key <AC06> { [	    d,	D,      eth,		ETH	 ] };
    key <AC10> { [	    s,	S,      ssharp			 ] };
    key <AC11> { [	minus,	underscore, hyphen,	diaeresis] };

    key <AB01> { [	   ae,	AE,     braceleft,	bracketleft] };
    key <AB05> { [	    x,	X,      multiply		 ] };
    key <AB07> { [	    m,	M,	mu			 ] };
    key <BKSL> { [	 less,	greater, guillemotleft, guillemotright	] };

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

    key <LSGT> { [	oslash,	Ooblique,  bar,	backslash	 ] };

    // fixed https://bugs.freedesktop.org/show_bug.cgi?id=4397
    include "level3(ralt_switch)"
};

// based on
// Northern Sami keyboards for Finland, Norway and Sweden
//
// Describes the differences between a very simple en_US
// keyboard and a Norwegian Northern Sami keyboard (with
// dead key support) according to the spec on
// http://www.hum.uit.no/a/trond/se-lat9-no-keys.html
// Written by Børre Gaup <boerre.gaup@pc.nu>
//

partial alphanumeric_keys
xkb_symbols "smi" {
    include "latin"

    name[Group1]= "Northern Saami (Norway)";

    key <AE01>	{ [         1,     exclam,    copyright,   exclamdown ]	};
    key <AE02>	{ [         2,   quotedbl,           at,   registered ]	};
    key <AE03>	{ [         3, numbersign,     sterling,         less ]	};
    key <AE04>	{ [         4,     dollar,       dollar,      greater ]	};
    key <AE05>	{ [         5,    percent,        U2022,        U2030 ]	};
    key <AE06>	{ [         6,  ampersand,      section,    paragraph ]	};
    key <AE07>	{ [         7,      slash,    braceleft,          bar ]	};
    key <AE08>	{ [         8,  parenleft,  bracketleft,    braceleft ]	};
    key <AE09>	{ [         9, parenright, bracketright,   braceright ]	};
    key <AE10>	{ [         0,      equal,   braceright,     notequal ]	};
    key <AE11>	{ [      plus,   question,     division, questiondown ]	};
    key <AE12>	{ [ backslash,      grave,        acute,   asciitilde ]	};

    key <AD01>	{ [    aacute,     Aacute,            q,            Q ]	};
    key <AD02>	{ [    scaron,     Scaron,            w,            W ]	};
    key <AD03>	{ [         e,          E,       eacute,       Eacute ]	};
    key <AD04>	{ [         r,          R,   registered,    trademark ]	};
    key <AD06>	{ [         y,          Y,       yacute,       Yacute ]	};
    key <AD07>	{ [         u,          U,   udiaeresis,   Udiaeresis ]	};
    key <AD08>	{ [         i,          I,   idiaeresis,   Idiaeresis ]	};
    key <AD09>	{ [         o,          O,           oe,           OE ]	};
    key <AD11>	{ [     aring,      Aring,  acircumflex,  Acircumflex ]	};
    key <AD12>	{ [       eng,        ENG,     quotedbl,  asciicircum ]	};

    key <AC01>	{ [         a,          A,       agrave,       Agrave ]	};
    key <AC02>	{ [         s,          S,       ssharp,   apostrophe ]	};
    key <AC04>	{ [         f,          F,  ordfeminine,  ordfeminine ]	};
    key <AC05>	{ [         g,          G,       gcaron,       Gcaron ]	};
    key <AC06>	{ [         h,          H,        U01E5,        U01E4 ]	};
    key <AC07>	{ [         j,          J,      notsign,     multiply ]	};
    key <AC08>	{ [         k,          K,        U01E9,        U01E8 ]	};
    key <AC09>	{ [         l,          L,       degree,       hyphen ]	};
    key <AC10>	{ [    oslash,   Ooblique,   odiaeresis,   Odiaeresis ]	};
    key <AC11>	{ [        ae,         AE,   adiaeresis,   Adiaeresis ]	};
    key <TLDE>	{ [       bar,    section,    brokenbar,    paragraph ]	};

    key <BKSL>	{ [   dstroke,    Dstroke,   apostrophe,     asterisk ]	};
    key <AB01>	{ [         z,          Z,        U0292,        U01B7 ]	};
    key <AB02>	{ [    ccaron,     Ccaron,            x,            X ]	};
    key <AB03>	{ [         c,          C,     ccedilla,     Ccedilla ]	};
    key <AB04>	{ [         v,          V, lessthanequal, guillemotleft ] };
    key <AB05>	{ [         b,          B, greaterthanequal, guillemotright ] };
    key <AB06>	{ [         n,          N, leftsinglequotemark, leftdoublequotemark ] };
    key <AB07>	{ [         m,          M, rightsinglequotemark, rightdoublequotemark ]	};
    key <AB08>	{ [     comma,  semicolon, singlelowquotemark, doublelowquotemark ] };
    key <AB09>	{ [    period,      colon,     ellipsis, periodcentered ] };
    key <AB10>	{ [     minus, underscore,       endash,       emdash ]	};

    key <LSGT>	{ type[Group1] = "FOUR_LEVEL",
                  [    zcaron,     Zcaron,        U01EF,        U01EE ]	};

    include "level3(ralt_switch)"
};

partial alphanumeric_keys
xkb_symbols "smi_nodeadkeys" {

    // Modifies the basic Norwegian layout to eliminate dead keys

    include "no(smi)"

    name[Group1]= "Northern Saami (Norway, eliminate dead keys)";

    key <AE12>	{ [ backslash,      grave,        acute,       ogonek ]	};
};

// Copied from macintosh_vndr/no
partial alphanumeric_keys 
xkb_symbols "mac" {

    // Describes the differences between a very simple en_US
    // keyboard and a very simple Norwegian keybaord

    include "latin(type4)"
    name[Group1]= "Norwegian (Macintosh)";

    key <TLDE>	{ [       bar,    section     ]	};
    key <AE03>	{ [         3, numbersign,     sterling,     sterling ]	};
    key <AE04>	{ [         4,   currency,       dollar,       dollar ]	};
    key <AE06>	{ [         6,  ampersand, threequarters, fiveeighths ]	};
    key <AE07>	{ [         7,      slash,          bar,    backslash ]	};
    key <AE08>	{ [         8,  parenleft,  bracketleft,    braceleft ]	};
    key <AE09>	{ [         9, parenright, bracketright,   braceright ]	};
    key <AC10>	{ [    oslash,   Ooblique,   odiaeresis,   Odiaeresis ]	};
    key <AE11>	{ [      plus,   question     ]	};
    key <AC11>	{ [        ae,         AE     ]	};
    key <AD11>	{ [     aring,      Aring     ]	};
    key <AE12>	{ [ dead_grave, dead_acute,       acute,  dead_ogonek ]	};
    key <AD12>	{ [ diaeresis, asciicircum,  asciitilde,  dead_macron ]	};
    key <BKSL>	{ [        at,   asterisk     ]	};
};


partial alphanumeric_keys 
xkb_symbols "mac_nodeadkeys" {

    // Modifies the basic Norwegian layout to eliminate dead keys
    include "no(mac)"
    name[Group1]= "Norwegian (Macintosh, eliminate dead keys)";

    key <AE12>	{ [      grave,     acute,        acute,       ogonek ]	};
    key <AD12>	{ [  diaeresis, asciicircum, asciitilde,       macron ]	};
};
