Permanently change xkb keybindings?












3















I have a custom keyboard layout located in /usr/share/X11/xkb/symbols/us. Every time an update happens, this file is updated to the standard keyboard layout. Is there either a way to change this permanently, or a way to change this in userspace away from distro-level config?



If there is a better way to approach custom keyboard layouts, please let me know. As far as I am aware, the best way to approach this is with xkb symbols files, and there is not much documentaion for these.



Thanks.










share|improve this question























  • Which Linux distribution are you using? Debian-based distributions (using dpkg) have a concept of divert which allow you to tell them not to override a custom file of yours...

    – filbranden
    Mar 3 at 22:51











  • That's why you don't modify existing layouts, but instead you make your own layout based on an existing layout, copying and modifying files as necessary.

    – dirkt
    Mar 5 at 8:07






  • 1





    @filbranden: debian has bitten me with this before, so it could be debian/ubuntu.

    – Wyatt8740
    Mar 14 at 1:25






  • 1





    @dirkt: an explanation for someone who isn't familiar with where custom layouts are stored or how they are loaded would be appreciated. I've seen this advice before but never a "for dummies" guide.

    – Wyatt8740
    Mar 14 at 1:26











  • @Wyatt8740: There's no for dummies guide because the whole thing is a bit complex, and depending on what you want to do you may need to copy and modify quite a few files. The best introduction to XKB I know is the Unreliable guide to XKB configuration by Doug Palmer.

    – dirkt
    Mar 14 at 6:41
















3















I have a custom keyboard layout located in /usr/share/X11/xkb/symbols/us. Every time an update happens, this file is updated to the standard keyboard layout. Is there either a way to change this permanently, or a way to change this in userspace away from distro-level config?



If there is a better way to approach custom keyboard layouts, please let me know. As far as I am aware, the best way to approach this is with xkb symbols files, and there is not much documentaion for these.



Thanks.










share|improve this question























  • Which Linux distribution are you using? Debian-based distributions (using dpkg) have a concept of divert which allow you to tell them not to override a custom file of yours...

    – filbranden
    Mar 3 at 22:51











  • That's why you don't modify existing layouts, but instead you make your own layout based on an existing layout, copying and modifying files as necessary.

    – dirkt
    Mar 5 at 8:07






  • 1





    @filbranden: debian has bitten me with this before, so it could be debian/ubuntu.

    – Wyatt8740
    Mar 14 at 1:25






  • 1





    @dirkt: an explanation for someone who isn't familiar with where custom layouts are stored or how they are loaded would be appreciated. I've seen this advice before but never a "for dummies" guide.

    – Wyatt8740
    Mar 14 at 1:26











  • @Wyatt8740: There's no for dummies guide because the whole thing is a bit complex, and depending on what you want to do you may need to copy and modify quite a few files. The best introduction to XKB I know is the Unreliable guide to XKB configuration by Doug Palmer.

    – dirkt
    Mar 14 at 6:41














3












3








3


1






I have a custom keyboard layout located in /usr/share/X11/xkb/symbols/us. Every time an update happens, this file is updated to the standard keyboard layout. Is there either a way to change this permanently, or a way to change this in userspace away from distro-level config?



If there is a better way to approach custom keyboard layouts, please let me know. As far as I am aware, the best way to approach this is with xkb symbols files, and there is not much documentaion for these.



Thanks.










share|improve this question














I have a custom keyboard layout located in /usr/share/X11/xkb/symbols/us. Every time an update happens, this file is updated to the standard keyboard layout. Is there either a way to change this permanently, or a way to change this in userspace away from distro-level config?



If there is a better way to approach custom keyboard layouts, please let me know. As far as I am aware, the best way to approach this is with xkb symbols files, and there is not much documentaion for these.



Thanks.







x11 keyboard keyboard-layout xkb






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 3 at 21:45









milquetoastmilquetoast

161




161













  • Which Linux distribution are you using? Debian-based distributions (using dpkg) have a concept of divert which allow you to tell them not to override a custom file of yours...

    – filbranden
    Mar 3 at 22:51











  • That's why you don't modify existing layouts, but instead you make your own layout based on an existing layout, copying and modifying files as necessary.

    – dirkt
    Mar 5 at 8:07






  • 1





    @filbranden: debian has bitten me with this before, so it could be debian/ubuntu.

    – Wyatt8740
    Mar 14 at 1:25






  • 1





    @dirkt: an explanation for someone who isn't familiar with where custom layouts are stored or how they are loaded would be appreciated. I've seen this advice before but never a "for dummies" guide.

    – Wyatt8740
    Mar 14 at 1:26











  • @Wyatt8740: There's no for dummies guide because the whole thing is a bit complex, and depending on what you want to do you may need to copy and modify quite a few files. The best introduction to XKB I know is the Unreliable guide to XKB configuration by Doug Palmer.

    – dirkt
    Mar 14 at 6:41



















  • Which Linux distribution are you using? Debian-based distributions (using dpkg) have a concept of divert which allow you to tell them not to override a custom file of yours...

    – filbranden
    Mar 3 at 22:51











  • That's why you don't modify existing layouts, but instead you make your own layout based on an existing layout, copying and modifying files as necessary.

    – dirkt
    Mar 5 at 8:07






  • 1





    @filbranden: debian has bitten me with this before, so it could be debian/ubuntu.

    – Wyatt8740
    Mar 14 at 1:25






  • 1





    @dirkt: an explanation for someone who isn't familiar with where custom layouts are stored or how they are loaded would be appreciated. I've seen this advice before but never a "for dummies" guide.

    – Wyatt8740
    Mar 14 at 1:26











  • @Wyatt8740: There's no for dummies guide because the whole thing is a bit complex, and depending on what you want to do you may need to copy and modify quite a few files. The best introduction to XKB I know is the Unreliable guide to XKB configuration by Doug Palmer.

    – dirkt
    Mar 14 at 6:41

















Which Linux distribution are you using? Debian-based distributions (using dpkg) have a concept of divert which allow you to tell them not to override a custom file of yours...

– filbranden
Mar 3 at 22:51





Which Linux distribution are you using? Debian-based distributions (using dpkg) have a concept of divert which allow you to tell them not to override a custom file of yours...

– filbranden
Mar 3 at 22:51













That's why you don't modify existing layouts, but instead you make your own layout based on an existing layout, copying and modifying files as necessary.

– dirkt
Mar 5 at 8:07





That's why you don't modify existing layouts, but instead you make your own layout based on an existing layout, copying and modifying files as necessary.

– dirkt
Mar 5 at 8:07




1




1





@filbranden: debian has bitten me with this before, so it could be debian/ubuntu.

– Wyatt8740
Mar 14 at 1:25





@filbranden: debian has bitten me with this before, so it could be debian/ubuntu.

– Wyatt8740
Mar 14 at 1:25




1




1





@dirkt: an explanation for someone who isn't familiar with where custom layouts are stored or how they are loaded would be appreciated. I've seen this advice before but never a "for dummies" guide.

– Wyatt8740
Mar 14 at 1:26





@dirkt: an explanation for someone who isn't familiar with where custom layouts are stored or how they are loaded would be appreciated. I've seen this advice before but never a "for dummies" guide.

– Wyatt8740
Mar 14 at 1:26













@Wyatt8740: There's no for dummies guide because the whole thing is a bit complex, and depending on what you want to do you may need to copy and modify quite a few files. The best introduction to XKB I know is the Unreliable guide to XKB configuration by Doug Palmer.

– dirkt
Mar 14 at 6:41





@Wyatt8740: There's no for dummies guide because the whole thing is a bit complex, and depending on what you want to do you may need to copy and modify quite a few files. The best introduction to XKB I know is the Unreliable guide to XKB configuration by Doug Palmer.

– dirkt
Mar 14 at 6:41










1 Answer
1






active

oldest

votes


















1














Make a directory tree under /home/<user>/ which has the same structure as /usr/share/X11/xkb/. In other words:



$ tree -L 1
.
├── compat
├── geometry
├── keycodes
├── rules
├── symbols
└── types


So put the relevant files in compat, symbols, etc. You obviously don’t need to make empty directories, just the directories for the files that you need.



Then consider renaming your symbols file to something different than us. There might be a way to disambiguate your own us symbols file from the one under /usr/share/X11/xkb/, but it is easier to just pick a new name which doesn’t appear in /usr/share/X11/xkb/symbols/. mine will do fine.



Let’s say that you put your custom Xkb directory at /home/<user>/my-xkb and that your custom symbols file is named mine.



If you use setxkbmap(1) to set your layout you simply need to change it to print its output and pipe it to xkbcomp(1). So if this is your setxkbmap invocation:



setxkbmap mine


You will need to change it to this:



setxkbmap mine -print |
xkbcomp -I"/home/<user>/my-xkb" - "$DISPLAY"





share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504158%2fpermanently-change-xkb-keybindings%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Make a directory tree under /home/<user>/ which has the same structure as /usr/share/X11/xkb/. In other words:



    $ tree -L 1
    .
    ├── compat
    ├── geometry
    ├── keycodes
    ├── rules
    ├── symbols
    └── types


    So put the relevant files in compat, symbols, etc. You obviously don’t need to make empty directories, just the directories for the files that you need.



    Then consider renaming your symbols file to something different than us. There might be a way to disambiguate your own us symbols file from the one under /usr/share/X11/xkb/, but it is easier to just pick a new name which doesn’t appear in /usr/share/X11/xkb/symbols/. mine will do fine.



    Let’s say that you put your custom Xkb directory at /home/<user>/my-xkb and that your custom symbols file is named mine.



    If you use setxkbmap(1) to set your layout you simply need to change it to print its output and pipe it to xkbcomp(1). So if this is your setxkbmap invocation:



    setxkbmap mine


    You will need to change it to this:



    setxkbmap mine -print |
    xkbcomp -I"/home/<user>/my-xkb" - "$DISPLAY"





    share|improve this answer




























      1














      Make a directory tree under /home/<user>/ which has the same structure as /usr/share/X11/xkb/. In other words:



      $ tree -L 1
      .
      ├── compat
      ├── geometry
      ├── keycodes
      ├── rules
      ├── symbols
      └── types


      So put the relevant files in compat, symbols, etc. You obviously don’t need to make empty directories, just the directories for the files that you need.



      Then consider renaming your symbols file to something different than us. There might be a way to disambiguate your own us symbols file from the one under /usr/share/X11/xkb/, but it is easier to just pick a new name which doesn’t appear in /usr/share/X11/xkb/symbols/. mine will do fine.



      Let’s say that you put your custom Xkb directory at /home/<user>/my-xkb and that your custom symbols file is named mine.



      If you use setxkbmap(1) to set your layout you simply need to change it to print its output and pipe it to xkbcomp(1). So if this is your setxkbmap invocation:



      setxkbmap mine


      You will need to change it to this:



      setxkbmap mine -print |
      xkbcomp -I"/home/<user>/my-xkb" - "$DISPLAY"





      share|improve this answer


























        1












        1








        1







        Make a directory tree under /home/<user>/ which has the same structure as /usr/share/X11/xkb/. In other words:



        $ tree -L 1
        .
        ├── compat
        ├── geometry
        ├── keycodes
        ├── rules
        ├── symbols
        └── types


        So put the relevant files in compat, symbols, etc. You obviously don’t need to make empty directories, just the directories for the files that you need.



        Then consider renaming your symbols file to something different than us. There might be a way to disambiguate your own us symbols file from the one under /usr/share/X11/xkb/, but it is easier to just pick a new name which doesn’t appear in /usr/share/X11/xkb/symbols/. mine will do fine.



        Let’s say that you put your custom Xkb directory at /home/<user>/my-xkb and that your custom symbols file is named mine.



        If you use setxkbmap(1) to set your layout you simply need to change it to print its output and pipe it to xkbcomp(1). So if this is your setxkbmap invocation:



        setxkbmap mine


        You will need to change it to this:



        setxkbmap mine -print |
        xkbcomp -I"/home/<user>/my-xkb" - "$DISPLAY"





        share|improve this answer













        Make a directory tree under /home/<user>/ which has the same structure as /usr/share/X11/xkb/. In other words:



        $ tree -L 1
        .
        ├── compat
        ├── geometry
        ├── keycodes
        ├── rules
        ├── symbols
        └── types


        So put the relevant files in compat, symbols, etc. You obviously don’t need to make empty directories, just the directories for the files that you need.



        Then consider renaming your symbols file to something different than us. There might be a way to disambiguate your own us symbols file from the one under /usr/share/X11/xkb/, but it is easier to just pick a new name which doesn’t appear in /usr/share/X11/xkb/symbols/. mine will do fine.



        Let’s say that you put your custom Xkb directory at /home/<user>/my-xkb and that your custom symbols file is named mine.



        If you use setxkbmap(1) to set your layout you simply need to change it to print its output and pipe it to xkbcomp(1). So if this is your setxkbmap invocation:



        setxkbmap mine


        You will need to change it to this:



        setxkbmap mine -print |
        xkbcomp -I"/home/<user>/my-xkb" - "$DISPLAY"






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 13 at 23:57









        GuildensternGuildenstern

        1736




        1736






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504158%2fpermanently-change-xkb-keybindings%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to make a Squid Proxy server?

            Is this a new Fibonacci Identity?

            19世紀