// Keyboard layouts for Norway.

default partial alphanumeric_keys
xkb_symbols "basic" {

    // With dead-key support and all ISO-8859-1 characters available.

    include "latin(type2)"

    name[Group1]="Norwegian";

    key <TLDE>	{ [       bar,    section,    brokenbar,    paragraph ]	};
    key <AE05>	{ [         5,    percent,      onehalf,     permille ]	};
    key <AE11>	{ [      plus,   question,    plusminus, questiondown ]	};
    key <AE12>	{ [ backslash, dead_grave,   dead_acute,      notsign ]	};

    key <AD04>	{ [         r,          R,   registered,    trademark ]	};
    key <AD10>	{ [         p,          P,     Greek_pi,     Greek_PI ]	};

    key <AC10>	{ [    oslash,     Oslash,   dead_acute, dead_doubleacute ] };
    key <AC11>	{ [        ae,         AE, dead_circumflex, dead_caron]	};
    key <BKSL>	{ [apostrophe,   asterisk, dead_doubleacute, multiply ]	};

    key <LSGT>	{ [      less,    greater,      onehalf, threequarters]	};
    key <AB09>	{ [    period,      colon,   ellipsis, periodcentered ]	};
    key <AB10>	{ [     minus, underscore,       endash,       emdash ]	};

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

    include "level3(ralt_switch)"
};

partial alphanumeric_keys
xkb_symbols "nodeadkeys" {

    include "no(basic)"

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

    key <AE12>	{ [ backslash,      grave,        acute,       ogonek ]	};
    key <AD11>	{ [     aring,      Aring,      radical,       dagger ] };
    key <AD12>	{ [ diaeresis, asciicircum,  asciitilde,       macron ]	};
    key <AC07>	{ [         j,          J,          ezh,          EZH ] };
    key <AC10>	{ [    oslash,     Oslash,        acute,  doubleacute ]	};
    key <AC11>	{ [        ae,         AE,  asciicircum,        caron ]	};
    key <BKSL>	{ [apostrophe,   asterisk,     ellipsis,     multiply ] };
    key <AB08>	{ [     comma,  semicolon,      cedilla,       ogonek ]	};
    key <AB09>	{ [    period,      colon, periodcentered,   abovedot ]	};
};

partial alphanumeric_keys
xkb_symbols "winkeys" {

     include "no(basic)"

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

     include "eurosign(5)"
};

// 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,	currency,   dollar,  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> { [dead_diaeresis, dead_circumflex, dead_tilde, dead_caron ] };

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

    key <LSGT> { [     oslash,	Oslash, bar,	       backslash ] };
    key <AB01> { [	   ae,	AE,     braceleft,    bracketleft] };
    key <AB05> { [	    x,	X,      multiply		 ] };
    key <AB07> { [	    m,	M,	mu			 ] };

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

    include "level3(ralt_switch)"
};

partial alphanumeric_keys
xkb_symbols "smi" {

    // Northern Sami layout for Finland, Norway and Sweden.
    // Originally implemented by Børre Gaup <boerre.gaup@pc.nu>.

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

    key <TLDE>	{ [       bar,    section,        grave,   asciitilde ]	};
    key <AE01>	{ [         1,     exclam,        U2022,   exclamdown ]	}; // bullet
    key <AE02>	{ [         2,   quotedbl,           at,    copyright ]	};
    key <AE03>	{ [         3, numbersign,     sterling,         none ]	};
    key <AE04>	{ [         4,   currency,       dollar,         cent ]	};
    key <AE05>	{ [         5,    percent,     EuroSign,     permille ]	};
    key <AE06>	{ [         6,  ampersand,  asciicircum,     multiply ]	};
    key <AE07>	{ [         7,      slash,    braceleft,     division ]	};
    key <AE08>	{ [         8,  parenleft,  bracketleft,    lessthanequal ]};
    key <AE09>	{ [         9, parenright, bracketright, greaterthanequal ]};
    key <AE10>	{ [         0,      equal,   braceright,     notequal ]	};
    key <AE11>	{ [      plus,   question,    plusminus, questiondown ]	};
    key <AE12>	{ [ backslash, dead_grave,   dead_acute,      notsign ]	};

    key <AD01>	{ [    aacute,     Aacute,            q,            Q ]	};
    key <AD02>	{ [    scaron,     Scaron,            w,            W ]	};
    key <AD03>	{ [         e,          E,     EuroSign,         none ]	};
    key <AD04>	{ [         r,          R,   registered,    trademark ]	};
    key <AD05>	{ [         t,          T,        thorn,        THORN ]	};
    key <AD06>	{ [    tslash,     Tslash,            y,            Y ]	};
    key <AD07>	{ [         u,          U,   udiaeresis,   Udiaeresis ]	};
    key <AD08>	{ [         i,          I,   idiaeresis,   Idiaeresis ]	};
    key <AD09>	{ [         o,          O,       otilde,       Otilde ]	};
    key <AD10>	{ [         p,          P,           oe,           OE ]	};
    key <AD11>	{ [     aring,      Aring, dead_diaeresis, dead_circumflex ]	};
    key <AD12>	{ [       eng,        ENG,   dead_tilde,   dead_caron ]	};

    key <AC01>	{ [         a,          A,  acircumflex,  Acircumflex ]	};
    key <AC02>	{ [         s,          S,       ssharp,        U1E9E ]	}; // ß ẞ
    key <AC03>	{ [         d,          D,          eth,          ETH ]	};
    key <AC04>	{ [         f,          F,         none,  ordfeminine ]	};
    key <AC05>	{ [         g,          G,       gcaron,       Gcaron ]	};
    key <AC06>	{ [         h,          H,        U01E5,        U01E4 ]	}; // ǥ Ǥ
    key <AC07>	{ [         j,          J,   doublelowquotemark,   singlelowquotemark ]};  // „ ‚
    key <AC08>	{ [         k,          K,        U01E9,        U01E8 ]	}; // ǩ Ǩ
    key <AC09>	{ [         l,          L,       degree,       hyphen ]	};
    key <AC10>	{ [    oslash,     Oslash,   odiaeresis,   Odiaeresis ]	};
    key <AC11>	{ [        ae,         AE,   adiaeresis,   Adiaeresis ]	};
    key <BKSL>	{ [   dstroke,    Dstroke,   apostrophe,     asterisk ]	};

    key <LSGT>	{ [    zcaron,     Zcaron,        U01EF,        U01EE ] }; // ǯ Ǯ
    key <AB01>	{ [         z,          Z,          ezh,          EZH ]	}; // ʒ Ʒ
    key <AB02>	{ [    ccaron,     Ccaron,            x,            X ]	};
    key <AB03>	{ [         c,          C,  leftdoublequotemark,  leftsinglequotemark ]}; // “ ‘
    key <AB04>	{ [         v,          V,        guillemotleft,                U2039 ]}; // « ‹
    key <AB05>	{ [         b,          B,       guillemotright,                U203A ]}; // » ›
    key <AB06>	{ [         n,          N, rightdoublequotemark, rightsinglequotemark ]}; // ” ’
    key <AB07>	{ [         m,          M,           mu,    masculine ]	};
    key <AB08>	{ [     comma,  semicolon,       less, periodcentered ] };
    key <AB09>	{ [    period,      colon,      greater,     ellipsis ] };
    key <AB10>	{ [     minus, underscore,       endash,       emdash ]	};

    include "level3(ralt_switch)"
};

partial alphanumeric_keys
xkb_symbols "smi_nodeadkeys" {

    include "no(smi)"

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

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

partial alphanumeric_keys
xkb_symbols "mac" {

    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 <AE11>	{ [      plus,   question     ]	};
    key <AE12>	{ [dead_grave, dead_acute,        acute,  dead_ogonek ]	};

    key <AD11>	{ [     aring,      Aring     ]	};
    key <AD12>	{ [ diaeresis, asciicircum,  asciitilde,  dead_macron ]	};

    key <AC10>	{ [    oslash,     Oslash,   odiaeresis,   Odiaeresis ]	};
    key <AC11>	{ [        ae,         AE     ]	};
    key <BKSL>	{ [        at,   asterisk     ]	};
};

partial alphanumeric_keys
xkb_symbols "mac_nodeadkeys" {

    include "no(mac)"

    name[Group1]= "Norwegian (Macintosh, no dead keys)";

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

partial alphanumeric_keys
xkb_symbols "colemak" {

    include "no(basic)"

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

    // See https://colemak.com/.
    // Q W F P G   J L U Y Ø Å ¨
    // A R S T D   H N E I O Æ '
    // < Z X C V   B K M , . -

    key <AD03>	{ [         f,          F,      dstroke,  ordfeminine ] };
    key <AD04>	{ [         p,          P,     Greek_pi,     Greek_PI ] };
    key <AD05>	{ [         g,          G,          eng,          ENG ] };
    key <AD06>	{ [         j,          J ] };
    key <AD07>	{ [         l,          L,      lstroke,      Lstroke ] };
    key <AD08>	{ [         u,          U,    downarrow,      uparrow ] };
    key <AD09>	{ [         y,          Y,    leftarrow,          yen ] };
    key <AD10>	{ [    oslash,     Oslash,   dead_acute, dead_doubleacute ] };

    key <AC02>	{ [         r,          R,   registered,    trademark ] };
    key <AC03>	{ [         s,          S,       ssharp,      section ] };
    key <AC04>	{ [         t,          T,        thorn,        THORN ] };
    key <AC05>	{ [         d,          D,          eth,          ETH ] };
    key <AC07>	{ [         n,          N ] };
    key <AC08>	{ [         e,          E,     EuroSign,         cent ] };
    key <AC09>	{ [         i,          I,   rightarrow,     idotless ] };
    key <AC10>	{ [         o,          O,           oe,           OE ] };

    key <AB06>	{ [         k,          K,          kra,    ampersand ] };
};

// Having a Colemak-DH variant in the Norwegian layout provides validation for users that this layout is suitable for typing Norwegian text.
// Furthermore, staying true to the US layout gives interchangabilty benefits which far outperforms the benefits of providing a unique layout.
// You can use the referenced layout to type Norwegian characters. See: https://colemak.com/Multilingual#Norwegian_.28Norsk_bokm.C3.A5l.29

// Colemak-DH (ISO) symbols for xkb on X.Org Server 7.x
// 2014-10-25 by SteveP, https://colemakmods.github.io/mod-dh/

xkb_symbols "colemak_dh" {

    include "us(colemak_dh_iso)"
    name[Group1]= "Norwegian (Colemak-DH)";
};

// Colemak-DH (Wide ISO) symbols for xkb on X.Org Server 7.x
// https://colemakmods.github.io/mod-dh/

xkb_symbols "colemak_dh_wide" {

    include "us(colemak_dh_wide_iso)"
    name[Group1]= "Norwegian (Colemak-DH Wide)";
};

// EXTRAS:

partial alphanumeric_keys
	xkb_symbols "sun_type6" {
	include "sun_vndr/no(sun_type6)"
};
