Arch linux: set keyboard layout to PL

116

Solution 1

Finaly I've found what was wrong. I didn't have polish language enabled in KDE's control panel.

systemsettings -> input devices -> keyboards -> layouts

Solution 2

I've set my keyboard layout by editing /usr/share/X11/xorg.conf.d/10-keyboard.conf.

If it doesn't exist go ahead and create it. Put this inside:

Section "InputClass"
    Identifier "system-keyboard"
    MatchIsKeyboard "on"
    Option "XkbLayout" "pl"
EndSection

Save and restart X.

For more information see the section titled Using X configuration files on the Arch wiki.

Share:
116

Related videos on Youtube

user1790399
Author by

user1790399

Updated on September 18, 2022

Comments

  • user1790399
    user1790399 over 1 year

    I have a class that has several derived classes, each with their own constructor.

    class A
        {
        public:
           static A *create_new_A(int child_ID);
    
           member_data;
           void method();
        };
    
    class A_child_0 : public A
        {
        A_child_0(int child_ID);
        //stuff
        };
    
    class A_child_1 : public A
        {
        A_child_1(int child_ID);
        //stuff
        };
        etc...
    

    and in the main file these get called with something like:

    A **array;
    array = new A *[nchildren];
    for (int i = 0 ; i < nchildren ; i++) 
        {
        array[i] = A->create_new_A( i );
        }
    

    where A is a factory that looks something like:

    A* A::create_new_A(int child_ID)
       {
       if (child_ID == 0) 
           {
           return new A_child_0(child_ID);
           }
       if (child_ID == 1)
           {
           return new A_child_1(child_ID);
           }  
       }
    

    Now when the constructor to A_child_n is called, right now I have a bunch of procedural commands inside the initialization for the member_data values that differ slightly among derived classes, e.g.,

    A_child_0(int child_ID)
        {
        member_data.vector1[0] = 0;
        for (i = 0; i < 200; i++)
             member_data.vector2[0] = i;
        read_in_conf_file("conf.txt") 
        // etc....
        }
    
    A_child_1(int child_ID)
        {
        member_data.vector1[0] = 0;
        for (i = 0; i < 50; i++)
          member_data.vector2[0] = i*i;
        read_in_conf_file("conf.txt") 
         // etc....
        }
    

    What I am curious about is whether there is a better way to go about this. Right now I'm thinking of encapsulating a lot of these procudral steps so it reads like

    A_child_0(int child_ID)
        {
        initializer_class *intializer;
        initializer->initialize(child_ID);
        }
    
    A_child_1(int child_ID)
       {
       initializer_class *intializer;
       initializer->initialize(child_ID);
       }
    

    and have a class initializer() that implements the initialization steps for the different classes. I guess this is loosely inspired by the strategy pattern. Does anybody have any suggestions on whether this approach is appropriate or sensible? Or does it just relegate the problem to the initializer class and introduce an added layer of complexity. If doing something like this is a bad idea, what could be done to try to avoid having the constructor be one long C program?

    edit: as some pointed out the factory was specified incorrectly. It's still not really polished in the example I give but it isn't as off the mark as what was there before.

    • Some programmer dude
      Some programmer dude almost 11 years
      You can't do that, as a constructor can't be used as a factory function (for example, how do you return the correct object from a constructor?). If you want a factory function then create an explicit function for that.
    • Sebastian Redl
      Sebastian Redl almost 11 years
      Have you considered std::vector<std::unique_ptr<A>> instead of that manual memory management horror you have? Or, lacking a C++11 compiler, a Boost.PtrVector? Or something to take the deletes off your hand?
    • user1790399
      user1790399 almost 11 years
      Thanks JP.This has been edited. @SR, not really, because the part in the main.cpp that uses the memory management stuff is a one time thing that is currently very manageable in the context of my application, and I don't anticipate using it really much anywhere else. I might get around to refactoring this part of the code, but I inherited this from a predecessor and don't see tinkering with this aspect of it as a high priority.
    • Jonathan Wakely
      Jonathan Wakely almost 11 years
      Replacing something as foul as array = new A *[nchildren]; is not "tinkering". Could you pick an indentation style and stick with it, so I can read your code without getting dizzy?
    • user1790399
      user1790399 almost 11 years
      In case you really must know, we use cuda code extensively in the program, and fixing this part to get it to play nice with cuda just isn't a high priority. I've fixed the indentation although others didn't seem to have an issue with it.
    • jasonwryan
      jasonwryan over 9 years
      Eh? Arch hasn't used an /etc/rc.conf for years... Use the wiki!
    • Marc Casals
      Marc Casals over 9 years
      rc.conf was one of the options I found in google. I tried everything. Wiki says about using localectl (which I did). My /etc/vconsole.conf looks like this: KEYMAP=pl FONT=lat2-16 FONT_MAP=8859-2
    • jasonwryan
      jasonwryan over 9 years
      Please edit the output of localectl into your question.
    • Marc Casals
      Marc Casals over 9 years
      I've edited my question
    • To Do
      To Do over 9 years
      What Desktop Environment are you using?
    • Marc Casals
      Marc Casals over 9 years
      KDE4 (exact version: 4.14.3)
  • user1790399
    user1790399 almost 11 years
    Yeah the original approach to the factory pattern was wrong. I've edited the original text accordingly.
  • Marc Casals
    Marc Casals over 9 years
    This is exactly what localectl set-x11-keymap pl has generated for me (mentioned in my question). I've tried a little bit different variants also without any success
  • 0x0049
    0x0049 over 9 years
    To clarify, when you say it isn't working do you mean you aren't able to type Polish characters when pressing alt? (Right alt on my system.)
  • Marc Casals
    Marc Casals over 9 years
    0x0049: exactly. alt+l should give me "ł" but it doesn't. I get "l". Only setxkbmap pl helps
  • Marc Casals
    Marc Casals over 9 years
    That's the only solution I think, but I don't find it "right" way. Also it will cause errors when I login to TTY (as this command requires X)
  • 0x0049
    0x0049 over 9 years
    I don't have enough reputation to comment on your answer, otherwise I would do this there, but like jasonwryan asked can you add the output of localectl to your question? Thanks!
  • Marc Casals
    Marc Casals over 9 years
    I've edited my question
  • Edward
    Edward over 2 years
    Maybe you could elaborate on what your script does exactly. That way, even if your script goes offline over time, we'll still be able to work it out :-)