Welcome to new things

[Technical] [Electronic work] [Gadget] [Game] memo writing

I can no longer type underbar in Linux.

PS

I received an update notification for Chrome, and when I updated it, hoping for the best, it was cured so that I could type in the underscore!

We will keep the original article. Below is the original article.


I use Linux (Ubuntu) and Windows, but I have trouble switching keyboards, mice, and monitors, I use Ubuntu with remote desktop access from my Windows PC.

The keyboard is a Windows PC Japanese keyboard, and I have been able to type on it without any problems.

By the way, here's how to build an Ubuntu environment that can be accessed via remote desktop.

www.ekwbtblog.com

I can no longer type underbar.

I don't know when it started, but I noticed that the "/?" (backslash/underbar) key to the right of the "/?

Solution

I fixed it by reconfiguring the keyboard layout based on the following article.

forums.ubuntulinux.jp

  1. New Japanese keyboard layout
  2. Remove old Japanese keyboard layout
  3. restart

The following is a rough procedure. We use "MATE" for the desktop environment, but the procedure would be similar in other environments.

New Japanese keyboard layout

  • [Menu]-[Settings]-[Keyboard].

Underbar can no longer be entered in Linux.

  • Add Japanese layout by [Layout]-[Add

Underbar can no longer be entered in Linux.

  • Set "Keyboard Format" to "Generic 105-key PC(intl.)".

Underbar can no longer be entered in Linux.

Remove old Japanese keyboard layout

Since there will be two Japanese layouts, delete the old upper layout.

  • [Remove]

Underbar can no longer be entered in Linux.

After that, just reboot your PC, and you can use the terminalto allow the input of underscores.

Can't type underbar in Chrome

There is a reason I wrote "terminal etc.", I can't type with the underbar key in Chrome no matter how I try....

When I tried other major applications, "Terminal", "FireFox", "Chromium", "VSCode", "Vim", "Emacs" were all ok, but only "Chrome" was not ok...

It seems like a Chrome-specific problem, like Chromium is fine but Chrome is not.

I looked up the following article, and according to it, it appears that Chrome implements the key on its own.

askubuntu.com

It is certainly possible that the English keyboard does not have a key that corresponds to the underbar key on the Japanese keyboard, so it is possible that it is not implemented...

Solution

Since I usually use Chrome frequently, I have no choice but not to use it. However, it is hard not to be able to type underbar, so as a desperate measure, I decided to assign the same key assignment as the underbar key to the "menu key" located below the underbar key.

I referred to the following article on how to change key assignments. It was very easy to understand.

bearmini.hatenablog.com

For more details, please see the article, but here is a brief description of the steps we took.

key assignment procedure

On a keyboard, each key has a specific "keycode" to physically distinguish the keys.

Key assignment is performed by setting what is to be done for that keycode.

Check keycode

After executing the command xev to check the keycode, press the "underscore" key and the "menu" key to check the keycode.

The "keycode ~" displayed is the keycode of the key you pressed.

> xev
KeyPress event, serial 35, synthetic NO, window 0x4200001,
    root 0x29a, subw 0x0, time 7935771, (510,374), root:(518,453),
    state 0x0, keycode 211 (keysym 0x5c, backslash), same_screen YES,
    XKeysymToKeycode returns keycode: 117
    XLookupString gives 1 bytes: (5c) "\"
    XmbLookupString gives 1 bytes: (5c) "\"
    XFilterEvent returns: False

KeyPress event, serial 38, synthetic NO, window 0x4200001,
    root 0x29a, subw 0x0, time 8143473, (341,-8), root:(349,71),
    state 0x0, keycode 117 (keysym 0xff67, Menu), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False
  • underbar key

    • 「keycode 211」
  • menu key

    • 「keycode 117」

Examine the current settings

Checks the current setting of the "underbar key" and "menu key".

> xmodmap -pke
…
keycode 117 = Menu NoSymbol Menu
…
keycode 211 = backslash underscore backslash underscore
…
  • underbar key

    • 「backslash underscore backslash underscore」
  • menu key

    • 「NoSymbol Menu」

Create configuration file

Create a configuration file ".Xmodmap" that assigns the "menu key" to the same assignment as the "underbar key".

Xmodmap" is placed in the home directory.

.Xmodmap

keycode 117 = backslash underscore backslash underscore

After that, the configuration file is reflected and you are done.

> xmodmap ~/.Xmodmap

test

Try pressing the "Menu Key" in Chrome.

Underbar can no longer be entered in Linux.

It worked!

The configuration file is automatically loaded when the PC starts up, so there is no need to reconfigure the settings each time.

Impressions, etc.

It is not very user-friendly, but I'll take it for now.

I wonder what the actual cause is. I hope it will be fixed soon.

In these days when Japan's presence in the computer/Internet world is becoming an air, if the Japanese keyboard support were to be omitted, it would probably have a low priority....

I am sad to see that the fonts in Office365 are Chinese Kanji, the AI language API I wanted to use is not Japanese compatible, and I feel that Japan is being put on the back burner a little bit....

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com