keyboard mapping

Forum Forums New users New Users and General Questions keyboard mapping

  • This topic has 9 replies, 4 voices, and was last updated Mar 1-9:34 pm by salvuzzo.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #100667
    Member
    salvuzzo

      Not sure if this is the correct mailbox to post my request, if not I’ll be fast to redirect with my apologies.
      The problem is that I need to remap a few keys, in order to add a few polish on my Italian keyboard.
      The reason is that I’m studying polish, but I don’t want to switch to the Polish keyboard. It will be enough to add just a few special characters (ążćśłźę).
      On my W10 system I install the AutoHotkey program with a AHK file at startup that maps a few alt-gr combinations to the desired chars.
      Something like:
      alt-gr a -> ą
      alt-gr e -> ę
      Bytw, autohokey is a handy program that makes much much more.
      So, questions are:
      1) how to map desired chars?
      2) is there a AutoHotkey linux equivalent to be used on Antix?

      $ inxi -zv7
      System:
        Kernel: 5.10.142-antix.2-amd64-smp arch: x86_64 bits: 64 compiler: gcc
          v: 10.2.1 Desktop: IceWM v: 3.0.1 dm: slimski v: 1.5.0
          Distro: antiX-22_x64-full Grup Yorum 18 October 2022
          base: Debian GNU/Linux 11 (bullseye)
      Machine:
        Type: Other-vm? System: FUJITSU SIEMENS product: ESPRIMO Mobile V5535
          v: V1.03 serial: <superuser required>
        Mobo: FUJITSU SIEMENS model: Z17M2.0 v: V1.03
          serial: <superuser required> BIOS: Phoenix v: 1.06 date: 05/30/08
      Battery:
        ID-1: BAT0 charge: 15.8 Wh (55.2%) condition: 28.6/48.8 Wh (58.6%)
          volts: 12.4 min: 11.1 model: AAIN SMP SDI e02741401C14C08500080
          type: Li-ion serial: <filter> status: charging
      Memory:
        RAM: total: 1.69 GiB used: 412.9 MiB (23.9%)
        RAM Report:
          permissions: Unable to run dmidecode. Root privileges required.
      CPU:
        Info: dual core model: Intel Core2 Duo T5750 bits: 64 type: MCP
          smt: <unsupported> arch: Core2 Merom rev: D cache: L1: 128 KiB L2: 2 MiB
        Speed (MHz): avg: 1503 high: 1582 min/max: 1000/2000 cores: 1: 1582
          2: 1425 bogomips: 7993
        Flags: acpi aperfmperf apic arch_perfmon bts clflush cmov constant_tsc
          cpuid cx16 cx8 de ds_cpl dtes64 dtherm dts est fpu fxsr ht lahf_lm lm mca
          mce mmx monitor msr mtrr nopl nx pae pat pbe pdcm pebs pge pni pse pse36
          pti rep_good sep sse sse2 ssse3 syscall tm tm2 tsc vme xtpr
      Graphics:
        Device-1: Silicon Integrated Systems [SiS] 771/671 PCIE VGA Display Adapter
          vendor: Fujitsu Solutions driver: N/A bus-ID: 01:00.0 chip-ID: 1039:6351
          class-ID: 0300
        Display: server: X.Org v: 1.20.11 driver: X: loaded: vesa
          unloaded: fbdev,modesetting alternate: sis gpu: N/A display-ID: :0.0
          screens: 1
        Screen-1: 0 s-res: 1024x768 s-dpi: 96 s-size: 271x203mm (10.67x7.99")
          s-diag: 339mm (13.33")
        Monitor-1: default res: 1024x768 size: N/A modes: N/A
        OpenGL: renderer: llvmpipe (LLVM 11.0.1 128 bits) v: 4.5 Mesa 20.3.5
          compat-v: 3.1 direct render: Yes
      Audio:
        Device-1: Silicon Integrated Systems [SiS] Azalia Audio
          vendor: Fujitsu Solutions driver: snd_hda_intel v: kernel bus-ID: 00:0f.0
          chip-ID: 1039:7502 class-ID: 0403
        Sound Server-1: ALSA v: k5.10.142-antix.2-amd64-smp running: yes
      Network:
        Device-1: Silicon Integrated Systems [SiS] 191 Gigabit Ethernet Adapter
          vendor: Fujitsu Solutions driver: sis190 v: 1.4 port: 1080 bus-ID: 00:04.0
          chip-ID: 1039:0191 class-ID: 0200
        IF: eth0 state: down mac: <filter>
        Device-2: Qualcomm Atheros AR242x / AR542x Wireless Network Adapter
          driver: ath5k v: kernel pcie: speed: 2.5 GT/s lanes: 1 bus-ID: 02:00.0
          chip-ID: 168c:001c class-ID: 0200
        IF: wlan0 state: up mac: <filter>
        IP v4: <filter> scope: global broadcast: <filter>
        IP v6: <filter> scope: link
        WAN IP: <filter>
      Bluetooth:
        Message: No bluetooth data found.
      Logical:
        Message: No logical block device data found.
      RAID:
        Message: No RAID data found.
      Drives:
        Local Storage: total: 232.89 GiB used: 4.9 GiB (2.1%)
        ID-1: /dev/sda vendor: Fujitsu model: MHY2250BH size: 232.89 GiB
          speed: <unknown> type: N/A serial: <filter> rev: 000B scheme: MBR
        Optical-1: /dev/sr0 vendor: HL-DT-ST model: DVDRAM GSA-T40N rev: JW02
          dev-links: cdrom,cdrw,dvd,dvdrw
        Features: speed: 24 multisession: yes audio: yes dvd: yes
          rw: cd-r,cd-rw,dvd-r,dvd-ram state: running
      Partition:
        ID-1: / size: 225.58 GiB used: 4.9 GiB (2.2%) fs: ext4 dev: /dev/sda1
          label: rootantiX22 uuid: dc4657ca-05ae-4649-a6e4-d40a87488114
      Swap:
        ID-1: swap-1 type: partition size: 2.62 GiB used: 12 KiB (0.0%)
          priority: -2 dev: /dev/sda2 label: swapantiX
          uuid: 55bd0041-eb97-4cb6-85eb-0d46e0b33564
      Unmounted:
        Message: No unmounted partitions found.
      USB:
        Hub-1: 1-0:1 info: Full speed or root hub ports: 8 rev: 2.0 speed: 480 Mb/s
          chip-ID: 1d6b:0002 class-ID: 0900
        Hub-2: 2-0:1 info: Full speed or root hub ports: 4 rev: 1.1
          speed: 12 Mb/s chip-ID: 1d6b:0001 class-ID: 0900
        Hub-3: 3-0:1 info: Full speed or root hub ports: 4 rev: 1.1
          speed: 12 Mb/s chip-ID: 1d6b:0001 class-ID: 0900
        Device-1: 3-1:2 info: Belkin MI-2150 Trust Mouse type: Mouse
          driver: hid-generic,usbhid interfaces: 1 rev: 1.1 speed: 1.5 Mb/s
          power: 100mA chip-ID: 1241:1166 class-ID: 0301
      Sensors:
        System Temperatures: cpu: 55.0 C mobo: N/A
        Fan Speeds (RPM): N/A
      Info:
        Processes: 137 Uptime: 35m wakeups: 2 Init: SysVinit v: 2.96 runlevel: 5
        default: 5 Compilers: gcc: 10.2.1 alt: 10 Packages: apt: 1587 Shell: Bash
        v: 5.1.4 running-in: roxterm inxi: 3.3.19
      
      • This topic was modified 2 months, 2 weeks ago by salvuzzo. Reason: Adding inxi result
      #100676
      Moderator
      Brian Masinick
        Helpful
        Up
        0
        ::

        Hopefully this tutorial will be helpful:
        https://www.dedoimedo.com/computers/linux-keyboard-custom-remap.html

        https://linuxconfig.org/reprogram-keyboard-keys-with-xmodmap
        is another resource.

        Do either of these help your specific issues?

        --
        Brian Masinick

        #100677
        Member
        Robin
          Helpful
          Up
          0
          ::

          Open a terminalwindow, e.g. roxterm.

          First make a backup-copy of your existing keymap layout:

          xmodmap -pke > ~/.xmodmap.original

          Now you can do the modifications, e.g.:

          	xmodmap -e "keycode  10 = 1 exclam 1 exclam onesuperior U2116 onesuperior"
          	xmodmap -e "keycode  11 = 2 at 2 at twosuperior onehalf twosuperior"
          	xmodmap -e "keycode  12 = 3 numbersign 3 numbersign threesuperior U2153 threesuperior"
          	xmodmap -e "keycode  13 = 4 dollar 4 dollar sterling onequarter sterling"
          	xmodmap -e "keycode  14 = 5 percent 5 percent UFFE0 U2155 UFFE0"
          	xmodmap -e "keycode  15 = 6 dead_diaeresis 6 dead_diaeresis notsign U2159 notsign"
          	xmodmap -e "keycode  16 = 7 ampersand 7 ampersand U2103 U2150 U2103"
          	xmodmap -e "keycode  17 = 8 asterisk 8 asterisk degree oneeighth degree"
          	xmodmap -e "keycode  18 = 9 parenleft 9 parenleft U2154 U2151 U2154"
          	xmodmap -e "keycode  19 = 0 parenright 0 parenright U00BE U2152 U00BE"
          	xmodmap -e "keycode  20 = minus underscore minus underscore emdash endash emdash"
          	xmodmap -e "keycode  21 = equal plus equal plus section plusminus section"
          	xmodmap -e "keycode  24 = q Q q Q slash U03A9 slash"
          	xmodmap -e "keycode  25 = w W w W question U2156 question"
          	xmodmap -e "keycode  26 = e E e E EuroSign U2157 EuroSign"
          	xmodmap -e "keycode  27 = r R r R paragraph U2158 paragraph"
          	xmodmap -e "keycode  28 = t T t T registered U215A registered"
          	xmodmap -e "keycode  29 = y Y y Y leftarrow U215C leftarrow"
          	xmodmap -e "keycode  30 = u U u U downarrow uparrow downarrow"
          	xmodmap -e "keycode  31 = i I i I rightarrow U215D rightarrow"
          	xmodmap -e "keycode  32 = o O o O oslash Oslash oslash"
          	xmodmap -e "keycode  33 = p P p P U2718 U2714 U2718"
          	xmodmap -e "keycode  34 = dead_acute dead_grave dead_acute dead_grave U2030 U2031 U2030"
          	xmodmap -e "keycode  38 = a A a A U2074 U2084 U2074"
          	xmodmap -e "keycode  39 = s S s S U2075 U2085 U2075"
          	xmodmap -e "keycode  40 = d D d D U2076 U2086 U2076"
          	xmodmap -e "keycode  41 = f F f F U2077 U2087 U2077"
          	xmodmap -e "keycode  42 = g G g G U2078 U2088 U2078"
          	xmodmap -e "keycode  43 = h H h H U2079 U2089 U2079"
          	xmodmap -e "keycode  44 = j J j J U2070 U2080 U2070"
          	xmodmap -e "keycode  45 = k K k K U1D6FC U2081 U1D6FC"
          	xmodmap -e "keycode  46 = l L l L U1D6FD U2082 U1D6FD"
          	xmodmap -e "keycode  47 = U00E7 U00C7 U00E7 U00C7 U1D6FE U2083 U1D6FE"
          	xmodmap -e "keycode  49 = apostrophe quotedbl apostrophe quotedbl multiply division multiply"
          	xmodmap -e "keycode  52 = z Z z Z guillemotright U203A guillemotright"
          	xmodmap -e "keycode  53 = x X x X guillemotleft U2039 guillemotleft"
          	xmodmap -e "keycode  55 = v V v V doublelowquotemark singlelowquotemark doublelowquotemark"
          	xmodmap -e "keycode  56 = b B b B leftdoublequotemark leftsinglequotemark leftdoublequotemark"
          	xmodmap -e "keycode  57 = n N n N rightdoublequotemark rightsinglequotemark rightdoublequotemark"
          	xmodmap -e "keycode  58 = m M m M mu U260F mu"
          	xmodmap -e "keycode  59 = comma less comma less U1D706 U2BF3 U1D706"
          	xmodmap -e "keycode  60 = period greater period greater U1D717 U2B1C U1D717"
          	xmodmap -e "keycode  61 = semicolon colon semicolon colon U1D719 U2BEE U1D719"
          	xmodmap -e "keycode  94 = backslash bar backslash bar U254E UFE19 U254E"

          (this is an example for pt_BR advanced keyboard only. you’ll need to adapt the modifications to your needs)
          When you are content with the result, save the modified keyboard layout to a file:

          xmodmap -pke > ~/.xmodmap.pt_BR_special

          If there happened any errors, causing you not being able to write any longer, simply restart PC, then your default keyboard layout will be back immediately.
          But if all keys are assigned as you prefer it, you can make the changes permanent. If not existing, create the (hidden) file ~/.xinitrc within your home folder.

          touch ~/.xinitrc

          Open the file using leafpad or geany and append the following line:

          xmodmap ~/.xmodmap.pt_BR_special

          Save the file.

          Windows is like a submarine. Open a window and serious problems will start.

          #100691
          Member
          madibi
            Helpful
            Up
            1
            ::

            Dear salvuzzo
            as far as I know, you have some different ways to solve your problem:

            1. using “onboard” (without brackets)
            with onboard you have a virtual board on your screen.
            That keyboard has the identical layout of your main keyboard.
            Then you install the Polish layout and switch back and forth on demand.

            2. using “xev” and “xmodmap”
            first with xev you discover the codes of a key or a combination of keys (ex Alt-Gr + a)
            then with xmodmap you can change the output according to the syntax written by Robin in his post #100677

            ciao!
            m

            #100717
            Member
            Robin
              Helpful
              Up
              1
              ::

              Should append, there is a way more easy method to achieve a quick access to the desired characters: In antiX Control Center you can set up a second language and a secondary keyboard layout. If you enable the hotswitch (default on antiX is left Alt+Shift keys) you can switch on the fly between the layouts while typing, using them very similar to having multiple special keys on a single keyboard layout added. Meanwhile I’ve switched completely to this approach for daily usage. The key reassignment as described in the postings before is feasible when for a specific language advanced keys are missing in the layout, and only very basic keys are provided by an existing spartan layout (which is still common in some languages).

              Single drawback is when using antiX Live or Frugal install, the secondary language layout is always set back to US English as secondary after reboot, and you have to manually restore your second keyboard layout. There must be some mechanism in the Live environment causing this, it doesn’t happen when antiX is classically installed to an HDD. And keep in mind you have to press the hotswitch key combination twice always to return to your original language in case this is not US English, since you can’t deactivate US English layout even if you never use or need it for daily usage. It is just there as an annoyance in workflow.

              Windows is like a submarine. Open a window and serious problems will start.

              #100778
              Member
              salvuzzo
                Helpful
                Up
                0
                ::

                1. using “onboard” (without brackets)
                with onboard you have a virtual board on your screen.
                That keyboard has the identical layout of your main keyboard.
                Then you install the Polish layout and switch back and forth on demand.

                2. using “xev” and “xmodmap”
                first with xev you discover the codes of a key or a combination of keys (ex Alt-Gr + a)
                then with xmodmap you can change the output according to the syntax written by Robin in his post #100677

                ciao!
                m

                Hi Madibi. I’ll try to be more precise. What I need it’s not to change some keyboard assignment, but to create some new one.
                In short, the combination altGr-a does not have any meaning in the Italian keyboard. What I’m looking for is a way to add a new key combination so than when I hit the altGr-a key I get the “ą” character. Same for altGr-e that gives the brand new “ę” char, and so on.
                Other solutions, like the onboard keyboard or the polish keyboard on the fly are not handy for a fast typing.
                Thanks for your suggestions, I’ll let you know when I’ll find the “fast” way.

                #100798
                Member
                Robin
                  Helpful
                  Up
                  0
                  ::

                  What I’m looking for is a way to add a new key combination so than when I hit the altGr-a key I get the “ą” character. Same for altGr-e that gives the brand new “ę” char, and so on.

                  Then you want to check out the method I described in posting #100677 above.

                  To lookup the proper key number you want to edit, just type in terminal window (e.g. Roxterm, enlarge the window to avoid additional confusing linebreaks):

                  xmodmap -pke

                  Then you can modify a single key by a line similar to those in my above example:

                  xmodmap -e keycode  29 = y Y y Y leftarrow U215C leftarrow
                  xmodmap -e keycode  29 = y Y y Y ssharp U215C ssharp

                  If a character is named, you can use its name (like leftarrow, rightarrow, without the XK_ prefix), otherwise you’ll have to lookup its respective unicode number (there are some more lists available) and enter something like U017F or U1E9E instead (omit the + character between U and the code number). The codes behind the key number are in a specific order. Please read man xmodmap carefully to understand what you have to change in a line from the output. (The -pke option is designed to allow you directly to copy the line you want to change from it, apply the modifications, and feed it back to console in order to make the additions/changes to the keyboard mapping. Also try
                  xmodmap -grammar
                  to learn different approaches of managing the keymapping with xmodmap, it allows to enter the modifier bindings for a key directly this way.

                  You will have to experiment with it until you succeed, I assure you.

                  Windows is like a submarine. Open a window and serious problems will start.

                  #100807
                  Member
                  madibi
                    Helpful
                    Up
                    0
                    ::

                    Dear Salvuzzo,
                    my 2nd proposal is in fact tailored on the needs that you expressed 🙂

                    Sorry, that I cannot help you before thu afternoon.
                    In case you cannot solve this problem before, I’ll try to write to you the exact string that you have to write and memorize on your antiX.

                    Please read carefully Robin’s posts and make some try.

                    Good luck

                    m

                    #100851
                    Member
                    salvuzzo
                      Helpful
                      Up
                      0
                      ::

                      Dear Salvuzzo,
                      my 2nd proposal is in fact tailored on the needs that you expressed

                      Sorry, that I cannot help you before thu afternoon.
                      In case you cannot solve this problem before, I’ll try to write to you the exact string that you have to write and memorize on your antiX.

                      Please read carefully Robin’s posts and make some try.

                      Good luck

                      m

                      Madibi, you’re so kind! Now I’m a bit overloaded, but I’ll do my best to follow your (and Robin’s) advice. I just installed a VirtualBox VM on my W10 system, so that I can work on it in an easier way. I’ll keep you posted.
                      Just for your info, this a list of assignments that I’ll try to make:
                      altGr-a = ą
                      altGr-e = ę
                      altGr-o = ó
                      altGr-z = ż
                      altGr-x = ź
                      altGr-S = ś
                      altGr-c = ć
                      altGr-n = ń

                      Thanks again
                      BTW, how do you get the tilde char on a simple keyboard, without the numeric keypad? The code is 126, but without numeric keypad I’m totally unable to get it.

                      • This reply was modified 2 months, 1 week ago by anticapitalista.
                      • This reply was modified 2 months, 1 week ago by rokytnji.
                      #100886
                      Member
                      salvuzzo
                        Helpful
                        Up
                        0
                        ::

                        Dear Salvuzzo,
                        my 2nd proposal is in fact tailored on the needs that you expressed
                        …..
                        Please read carefully Robin’s posts and make some try.
                        m

                        Dear Madibi (and Robin and Brian)
                        Thanks to your suggestions I solved the problem.
                        1) I’ve been loking for UNICODE polish character codes (e.g ą = U0105)
                        2) I exported the present key table: xmodmap -pke > ~/.xmodmap.original
                        3) I made a copy of the previous file in ~/.xmodmap.polish
                        4) I looked on the file the key for A letters: keycode 38 = a A a A ae AE
                        5) I changed the line, using UNICODE values at fifth and sixth place: keycode 38 = a A a A U0105 U0104
                        6) I loaded the modified file with the command xmodmap ~/.xmodmap.polish

                        That’s all, now it works with ą (lower and uppercase). I will extend for all other letters and then load it at startup.
                        Thanks again,

                      Viewing 10 posts - 1 through 10 (of 10 total)
                      • You must be logged in to reply to this topic.