LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to type back slash? Altgr+ vertical line does not work. (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-type-back-slash-altgr-vertical-line-does-not-work-4175568222/)

Sheik Yabooty 02-27-2017 07:32 PM

UK keyboard
 
I have the same issue with backslash and pipe key being void using Ubuntu 16.04 (works fine on an identical machine running Ubuntu Studio 16.10) Sorry if this is old news - it is still pertinant to me, so I guess others?

I have managed to work out that the backslash key can be accessed by using the Alt Gr + the key to the right of zero, and the pipe key can be accessed by using the Alt Gr + the key to the left of one. Additional keys can also be found using using Alt+shift+key (result!)

I do not know why the standard backslash/pipe key does not function at all in Ubuntu, but works fine in Ubuntu Studio?
The sudo nano /etc/default/keyboard file has "pc105" for XKBMODEL and "gb" for XKBLAYOUT on both machines, both are the same Dell 105 key UK keyboards. Hope this is of some help to someone.

notKlaatu 02-27-2017 07:45 PM

That's a good tip.

Another way round your problem is to map the backslash and pipe to the key you want, manually, with Xmodmap. I had to do this on my laptop because I bought it secondhand, and it came with a non-US keyboard. Since I use Dvorak layout anyway, most of the keys not being "right" didn't bother me, but some keys needed extra assistance to get where they were supposed to be.

In a file called ~/.xmodmap:

Code:

keycode 51 = backslash bar backslash bar
The key code may NOT be 51 in your case, but that seems to be pretty common.

To find out for sure, launch `xev` from a terminal. Then press the key that should produce the backslash. In the terminal output, look for `keycode` and then [some number]. That's the keycode you want to use.

To test, use the xmodmap command:

Code:

$ xmodmap ~/.xmodmap
Now your backslash and pipe should work as expected.

If so, add that xmodmap command to your ~/.bash_profile or ~/.bashrc file.

DavidMcCann 02-28-2017 11:19 AM

If you can't find backslash and bar (\|), here's what to do.

1. Open a terminal and enter the command "setxkbmap -print". The output will include a line starting like
xkb_symbols {include "pc+gb"
That shows that I have a driver that includes the basic keys (pc, for things like SPACE) and the British layout (gb).

2. Now you know your layout name, look at its file in the folder /usr/share/x11/xkb/symbols/
Search that file for "backslash" and for "bar" to find where they are. The file may start with an "include" statement, so if it says "include latin(type 4)" you may have to search the "latin" file as well.

The alphanumberic keys are labeled by A plus a letter for the line (from A for the space bar to E for the top line) plus the number in the line. Thus AC02 is the second key in the home row: S. Three keys have special designations. TLDE is at the top left. LSGT is to the left of Z. BKSP is at the right end of the home row on international keyboards but at the right end above ENTER on US keyboards.

Each entry will have 2 or 4 symbols listed: basic, Shift + basic, AltGr + basic, AltBr + Shift + basic. So if your keyboard was Spanish (es), you'd get
key <AE11> {[ apostrophe, question, backslash, questiondown ]};
key <AE01> {[ 1, exclam, bar, exclamdown ]};
That shows you that both backslash is on "'", bar is on "1", and both need the AltGr key.


All times are GMT -5. The time now is 01:56 AM.