xkb_keymap {
  xkb_keycodes  { include "evdev+aliases(qwerty)" };

  xkb_types     { 
    type "ALPHABETIC" {
        modifiers= Shift+Lock;
        map[Shift]= Level2;
        map[Lock]= Level2;
        level_name[Level1]= "Base";
        level_name[Level2]= "Caps";
    };
  };

  xkb_compat    {
    virtual_modifiers Hyper;

    interpret Mod3+AnyOfOrNone(all) {
        virtualModifier= Hyper;
        useModMapMods=level1;
        action= SetGroup(group=+2);
    };

    interpret Mode_switch+AnyOfOrNone(all) {
        virtualModifier= Hyper;
        useModMapMods=level1;
        action= SetGroup(group=+1);
    };
  };

  xkb_symbols "chatpad-qwerty"  { 
    name[group1]="Germany";

    # Row 1
    key  <ESC> {         [          Escape ]
    };

    key <AE01> {
        symbols[Group1]= [               1, exclam ]
    };
    key <AE02> {
        symbols[Group1]= [               2, quotedbl ]
    };
    key <AE03> {
        symbols[Group1]= [               3, section ]
    };
    key <AE04> {
        symbols[Group1]= [               4, dollar ]
    };
    key <AE05> {
        symbols[Group1]= [               5, percent]
    };
    key <AE06> {
        symbols[Group1]= [               6, ampersand ]
    };
    key <AE07> {
        symbols[Group1]= [               7, slash ]
    };
    key <AE08> {
        symbols[Group1]= [               8, bracketright ]
    };
    key <AE09> {
        symbols[Group1]= [               9, bracketleft ]
    };
    key <AE10> {
        symbols[Group1]= [               0, equal ]
    };


    # Row 2
    key <AD01> {
        type= "ALPHABETIC",
        symbols[Group1]= [               q, Q ],
        symbols[Group2]= [               exclam ],
        symbols[Group3]= [               at ] # @
    };
    key <AD02> {
        type= "ALPHABETIC",
        symbols[Group1]= [               w, W ],
        symbols[Group2]= [               quotedbl ],
        symbols[Group3]= [               exclamdown ] # inverted !
    };
    key <AD03> {
        type= "ALPHABETIC",
        symbols[Group1]= [               e, E ],
        symbols[Group2]= [               EuroSign, cent ],
        symbols[Group3]= [               eacute, Eacute ] # é
    };
    key <AD04> {
        type= "ALPHABETIC",
        symbols[Group1]= [               r, R ],
        symbols[Group2]= [               dollar ],
        symbols[Group3]= [                yen ] # yen
    };
    key <AD05> {
        type= "ALPHABETIC",
        symbols[Group1]= [               t, T ],
        symbols[Group2]= [               percent ],
        symbols[Group3]= [               THORN ] # |b
    };

    key <AD06> {
        type= "ALPHABETIC",
        symbols[Group1]= [               z, Z ],
        symbols[Group2]= [               ampersand ],
        symbols[Group3]= [               asciicircum ] # ^
    };
    key <AD07> {
        type= "ALPHABETIC",
        symbols[Group1]= [               u, U ],
        symbols[Group2]= [               slash ],
        symbols[Group3]= [               udiaeresis, Udiaeresis ] # ü
    };
    key <AD08> {
        type= "ALPHABETIC",
        symbols[Group1]= [               i, I ],
        symbols[Group2]= [               parenleft ],
        symbols[Group3]= [                iacute, Iacute ] # í ' <- as dot
    };
    key <AD09> {
        type= "ALPHABETIC",
        symbols[Group1]= [               o, O ],
        symbols[Group2]= [               parenright ],
        symbols[Group3]= [               odiaeresis, Odiaeresis ] 
    };
    key <AD10> {
        type= "ALPHABETIC",
        symbols[Group1]= [               p, P ],
        symbols[Group2]= [               equal ],
        symbols[Group3]= [               backslash ]
    };


    key <AC01> {
        type= "ALPHABETIC",
        symbols[Group1]= [               a, A ],
        symbols[Group2]= [               aring, Aring ], # a°
        symbols[Group3]= [                adiaeresis, Adiaeresis ]
    };
    key <AC02> {
        type= "ALPHABETIC",
        symbols[Group1]= [               s, S ],
        symbols[Group2]= [               ssharp ], # ß
        symbols[Group3]= [               scaron, Scaron ] # s + v
    };
    key <AC03> {
        type= "ALPHABETIC",
        symbols[Group1]= [               d, D ],
        symbols[Group2]= [               guillemotleft ], # <<
        symbols[Group3]= [               eth, Eth ] # delta + ~
    };
    key <AC04> {
        type= "ALPHABETIC",
        symbols[Group1]= [               f, F ],
        symbols[Group2]= [               guillemotright ], # >>
        symbols[Group3]= [               sterling ] # L pound
    };
    key <AC05> {
        type= "ALPHABETIC",
        symbols[Group1]= [               g, G ],
        symbols[Group2]= [               diaeresis ], # .. 
        symbols[Group3]= [               currency ] # Microsoft Points symbol
    };
    key <AC06> {
        type= "ALPHABETIC",
        symbols[Group1]= [               h, H ],
        symbols[Group2]= [               braceleft ], # {
        symbols[Group3]= [               grave ] # `
    };
    key <AC07> {
        type= "ALPHABETIC",
        symbols[Group1]= [               j, J ],
        symbols[Group2]= [               braceright ], # }
        symbols[Group3]= [               oslash, Oslash ] # o + /
    };
    key <AC08> {
        type= "ALPHABETIC",
        symbols[Group1]= [               k, K ],
        symbols[Group2]= [               bracketleft ], # [
        symbols[Group3]= [               ae, AE ] # ae
    };
    key <AC09> {
        type= "ALPHABETIC",
        symbols[Group1]= [               l, L ],
        symbols[Group2]= [               bracketright ], # ]
        symbols[Group3]= [               oe, OE ] # oe
    };
    key <AB09> {
        type= "ALPHABETIC",
        symbols[Group1]= [               period ],
        symbols[Group2]= [               question ],
        symbols[Group3]= [               numbersign ] # # 
    };


    key <LFSH> {
        symbols[Group1]= [               Shift_L ],
        symbols[Group2]= [                ],
        symbols[Group3]= [                ] # Capslock
    };
    key <AB01> {
        type= "ALPHABETIC",
        symbols[Group1]= [                y, Y ],
        symbols[Group2]= [                less ], # < 
        symbols[Group3]= [                degree ] # °
    };
    key <AB02> {
        type= "ALPHABETIC",
        symbols[Group1]= [                x, X ],
        symbols[Group2]= [                greater ], # >
        symbols[Group3]= [                bar ] # |
    };
    key <AB03> {
        type= "ALPHABETIC",
        symbols[Group1]= [               c, C ],
        symbols[Group2]= [                asciitilde ], # ~
        symbols[Group3]= [                ccedilla, Ccedilla] # c + ,
    };
    key <AB04> {
        type= "ALPHABETIC",
        symbols[Group1]= [               v, V ],
        symbols[Group2]= [               minus ], # -
        symbols[Group3]= [               underscore  ]  # _
    };

    key <AB05> {
        type= "ALPHABETIC",
        symbols[Group1]= [               b, B ],
        symbols[Group2]= [               asterisk ], # *
        symbols[Group3]= [               plus ] # +
    };
    key <AB06> {
        type= "ALPHABETIC",
        symbols[Group1]= [               n, N ],
        symbols[Group2]= [               semicolon ], # ; 
        symbols[Group3]= [               ntilde, Ntilde ]  # n + ~
    };
    key <AB07> {
        type= "ALPHABETIC",
        symbols[Group1]= [               m, M ],
        symbols[Group2]= [               colon ], # :
        symbols[Group3]= [               mu ]  # mü
    };
    key <AB08> {
        type= "ALPHABETIC",
        symbols[Group1]= [               comma ],
        symbols[Group2]= [               apostrophe ], 
        symbols[Group3]= [               questiondown ]
    };
    key <RTRN> {
        symbols[Group1]= [               Return ]
    };

    key <LALT> {
        repeat= No,
        symbols[Group1]= [               Mode_switch ]
    };
    key <LMTA> {
        repeat= No,
        symbols[Group1]= [               Super_L ]
    };
    key <LEFT> {
        symbols[Group1]= [               Left ]
    };

    key <SPCE> {
        symbols[Group1]= [               space ]
    };

    key <RGHT> {
        symbols[Group1]= [               Right ]
    };
    key <BKSP> {
        symbols[Group1]= [               BackSpace ]
    };
    key <LCTL> {
        repeat= No,
        symbols[Group1]= [               Hyper_R ]
    };

    modifier_map Shift { <LFSH> };
    modifier_map Mod2 { <LALT> }; // green
    modifier_map Mod3 { <LCTL> }; // orange
    modifier_map Mod4 { <LMTA> }; // people
  };

  xkb_geometry  { 
    width  = 250;
    height = 140;

    baseColor=   "white";
    labelColor=  "black";
    xfont=       "-*-helvetica-medium-r-normal--*-120-*-*-*-*-iso8859-1";
    description= "Microsoft Xbox360 Chatpad";

    shape "NUM" {
        corner= 4, # corner roundness
        { [  15,  11 ] }, # width, height
        { [   1,   1 ], [  14,  9 ] } # top/left, bottom right
    };

    shape "ALPHA" {
        corner= 4, # corner roundness
        { [  16,  13 ] }, # width, height
        { [   1,   1 ], [  15,  11 ] } # top/left, bottom right
    };

    shape "SPACE" {
        corner= 4, # corner roundness
        { [  54,  13 ] }, # width, height
        { [   1,   1 ], [  53,  11 ] } # top/left, bottom right
    };

    section "Numbers" {
      key.color= "white";
      priority=  2;
      top=     47;
      left=    35;
      width=   138;
      height=  102;
      angle=  0;
      row {
        top=  1;
        left= 1;
        keys {
          { <AE01>, "NUM",   1 },
          { <AE02>, "NUM",   1 },
          { <AE03>, "NUM",   1 },
          { <AE04>, "NUM",   1 },
          { <AE05>, "NUM",   1 },

          { <AE06>, "NUM",   1 },
          { <AE07>, "NUM",   1 },
          { <AE08>, "NUM",   1 },
          { <AE09>, "NUM",   1 },
          { <AE10>, "NUM",   1 }
        };
      };
    };

    section "Alpha" {
      key.color= "white";
      priority=  2;
      top=     61;
      left=    30;
      width=   138;
      height=  102;
      angle=  0;
      row {
        top=  1;
        left= 1;
        keys {
          { <AD01>, "ALPHA",   1 },
          { <AD02>, "ALPHA",   1 },
          { <AD03>, "ALPHA",   1 },
          { <AD04>, "ALPHA",   1 },
          { <AD05>, "ALPHA",   1 },

          { <AD06>, "ALPHA",   1 },
          { <AD07>, "ALPHA",   1 },
          { <AD08>, "ALPHA",   1 },
          { <AD09>, "ALPHA",   1 },
          { <AD10>, "ALPHA",   1 }
        };
      };

      row {
        top=  16;
        left= 1;
        keys {
          { <AC01>, "ALPHA",   1 },
          { <AC02>, "ALPHA",   1 },
          { <AC03>, "ALPHA",   1 },
          { <AC04>, "ALPHA",   1 },
          { <AC05>, "ALPHA",   1 },

          { <AC06>, "ALPHA",   1 },
          { <AC07>, "ALPHA",   1 },
          { <AC08>, "ALPHA",   1 },
          { <AC09>, "ALPHA",   1 },
          { <AB09>, "ALPHA",   1 }
        };
      };

      row {
        top=  32;
        left= 1;
        keys {
          { <LFSH>, "ALPHA",   1 },
          { <AB01>, "ALPHA",   1 },
          { <AB02>, "ALPHA",   1 },
          { <AB03>, "ALPHA",   1 },
          { <AB04>, "ALPHA",   1 },

          { <AB05>, "ALPHA",   1 },
          { <AB06>, "ALPHA",   1 },
          { <AB07>, "ALPHA",   1 },
          { <AB08>, "ALPHA",   1 },
          { <RTRN>, "ALPHA",   1 }
        };
      };

      row {
        top=  48;
        left= 7;
        keys {
          { <AA01>, "ALPHA",   1 },
          { <AA02>, "ALPHA",   1 },
          { <LEFT>, "ALPHA",   1 },

          { <SPCE>, "SPACE",   1 },

          { <RGHT>, "ALPHA",  1 },
          { <BKSP>, "ALPHA",   1 },
          { <AA08>, "ALPHA",   1 }
        };
      };
    };
  };
};
