Score:1

How to change keyboard layout by switching 1234567890 with !@#$%^&*() with Shift or Num Lock keys?

bn flag

What I would like to do is, instead of pressing Shift+1 or Shift+2 to see ! or @ respectively, have by default ! @ # $ % ^ & * ( ) instead of 1 2 3 4 5 6 7 8 9 0, and maybe if I have my NumLock off it could be 1 2 3 4 5 6 7 8 9 0. But if NumLock is off I would have ! @ # $ % ^ & * ( ) in the first row, and could have access to the numbers if I use the Shift key.

Can someone get me to the right track?

// Begin: Insert 42lx by cosvaldo@42lx.com
// This file is called 42lx and must be placed into the following linux folder:
// /usr/share/X11/xkb/symbols
partial alphanumeric_keys
xkb_symbols "basic" {
    name[Group1]= "US/ASCII";
    key <AE01> { [   1,          exclam,           exclamdown,      onesuperior ] };
    key <AE02> { [   2,              at,          twosuperior, dead_doubleacute ] };
    key <AE03> { [   3,      numbersign,        threesuperior,      dead_macron ] };
    key <AE04> { [   4,          dollar,             currency,         sterling ] };
    key <AE05> { [   5,         percent,             EuroSign,     dead_cedilla ] };
    key <AE06> { [   6, dead_circumflex,           onequarter,      asciicircum ] };
    key <AE07> { [   7,       ampersand,              onehalf,        dead_horn ] };
    key <AE08> { [   8,        asterisk,        threequarters,      dead_ogonek ] };
    key <AE09> { [   9,       parenleft,  leftsinglequotemark,       dead_breve ] };
    key <AE10> { [   0,      parenright, rightsinglequotemark,   dead_abovering ] };
    modifier_map Shift   { Num_Lock };
    //modifier_map Shift  { Shift_L, Shift_R };
    //modifier_map Mod2   { Num_Lock };
    // key <NMLK> {    [ Num_Lock  ]   };
};
// End: Insert 42lx by cosvaldo@42lx.com

I also will insert this code:

// /usr/share/X11/xkb/rules/evdev.xml
// It will be inserted at line ... this code in evdev.xml:
    <!-- Begin: Insert 42lx by cosvaldo@42lx.com -->
    <layout>
      <configItem>
        <name>42lx</name>
        <shortDescription>42lx.com</shortDescription>
        <description>42lx English (US): switch between numbers and signs at the
        first line, below function keys with Num Lock, Left and Right
        Shift.</description>
        <languageList>
          <iso639Id>eng</iso639Id>
          <iso639Id>por</iso639Id>
        </languageList>
      </configItem>
      <variantList/>
    </layout>
    <!-- End: Insert 42lx by cosvaldo@42lx.com -->

I already saw this link and this one, but something is missing here.

Score:0
in flag

You can use the remapper deamon keyd for this purpose. See this answer for installation, usage and tips.

After installation, use the config below (plus lines for 4-0, obviously). The config uses f12 to toggle between two layers, one where 1-3 act normally (the default main layer), one where they act as if shift is pressed (I called it f12layer). You can use something else than f12. Run keyd -m, press the key you want to use as a toggle, note the name, change and reload the config.

[ids]

*

[main]

f12 = toggle(f12layer)

[f12layer]

f12 = toggle(f12layer)
1 = S-1
2 = S-2
3 = S-3
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.