0

So... I recently bought a keyboard with a US layout as they didn't have it for my native language. It is however missing the key on the keyboard where i normally do '\'. I am using I3 as my WM and ubuntu 18.04. Is there a way to check different combinations of keys does? I seem to recall it is in some file, and can also be changed there, but cant find that file...

EDIT: The problem is, that on the US keybhoard the key next to Z is SHIFT. Normally there is a key before shift, where backslash is on danish layouts. I want to see if some combination of keys on the US keyboard corresponds to this missing key... Or remap something to backslash alternatively.

  • What do you mean the '\' key is missing? On the us layout AFAIR has the '\' between the enter and backspace key? – j-money Oct 17 '18 at 21:47
  • @j-money Bad explanation sorry. I purchased a keyboard with US layout. I then set the keyboard layout as DK in ubuntu. From here i can't type '\' as the key i normally use on a native DK layout keyboard is missing. – sn3jd3r Oct 17 '18 at 21:49
  • Try <Right Alt>+[key to the left of Z]. But you can show the keyboard layout, for instance by going to Region & Language, selecting the Danish layout, and clicking the keyboard icon. – Gunnar Hjalmarsson Oct 17 '18 at 21:58
  • @GunnarHjalmarsson The problem is, that on the US keybhoard i have the key next to Z is SHIFT. Normally there is a key before shift, where backslash is on danish layouts. I want to see if some combination of keys on the US keyboard corresponds to this missing key... Or remap something to backslash alternatively. – sn3jd3r Oct 17 '18 at 22:02
  • Actually the US keyboard layout includes an ordinary key to the left of the Z key, so it seems like the physical keyboard you bought isn't optimal, neither for English (US) nor Danish. – Gunnar Hjalmarsson Oct 17 '18 at 22:19
0

Maybe you can try something like this? It just reads in from the keyboard and echo's it back out!

#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/time.h>
#include <linux/fb.h>
//All other includes
#include <time.h>
#include <unistd.h>
#include <termios.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>


char getkey()
{
    fd_set rfds;
    struct timeval timev;
    int ioready;
    char ch;
    FD_ZERO(&rfds);
    FD_SET(0, &rfds);

    timev.tv_sec = 0;
    timev.tv_usec = 0;

    ioready = select(1, &rfds, NULL, NULL, &timev);

    if(ioready)
    {
        read(1, &ch, 1);
        return ch;
    }
    else
        return '\0';
}

int main()
{
    while(1)
    {
        char my_char = getkey();
        if(my_char == 'q')
            break;
        printf("%c", my_char);
    }

}
0

The backslash on my keyboard that looks like the one in the picture you posted is obtained by pressing shift+(the key before number 1).

"Or remap something to backslash alternatively."

You could use Xmodmap, xkb or AutoKey to remap keys. With xbindkeys you can launch a command with a combination of keys. I don't know how to remap keys with it.

With AutoKey, a graphical user interface (GUI), you can use abbreviations. For example, to obtain a backslash you can type "zz" or use a hotkey ctrl+y or whatever combination you want (Control, Alt, Shift, Super, Hyper, Meta).

Danish and Norwegian alphabet :

  • aae to æ
  • AAE to Æ
  • OO to Ø

Other examples :

  • btw to by the way
  • addd to a multiline address
  • tilde to ~ ...

There are also sample scripts in python (insert date with an abbreviation or a hotkey). And you can code your own.

A Python3 version is on GitHub. https://github.com/autokey/autokey

Or an outdated version in the Sofware Manager. This version may freeze when configuring data. Sometimes I had to open the terminal and write : xkill ; than click on AutoKey window.

To set a hotkey you have to do theses steps in the right order :

Hotkey/Set/Press to Set/Press a key.../Press Ctrl or Alt or Shift/Ok ; Then Save

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.