Keyboard Layout Customization: Difference between revisions

mNo edit summary
Rhendric (talk | contribs)
Relevant other options: Update xkb options
 
(2 intermediate revisions by 2 users not shown)
Line 9: Line 9:
The easiest way to customize your keyboard layout on NixOS is with these options:
The easiest way to customize your keyboard layout on NixOS is with these options:


* <code>services.xserver.layout</code>: Keyboard layout, or multiple keyboard layouts separated by commas.
* <code>services.xserver.xkb.layout</code>: Keyboard layout, or multiple keyboard layouts separated by commas.
* <code>services.xserver.xkbVariant</code>: X keyboard variant or multiple variants separated by commas (a variant can be empty).  
* <code>services.xserver.xkb.variant</code>: X keyboard variant or multiple variants separated by commas (a variant can be empty).  
* <code>services.xserver.xkbModel</code>: Keyboard model.
* <code>services.xserver.xkb.model</code>: Keyboard model.
* <code>services.xserver.xkbOptions</code>: X keyboard options; layout switching goes here.
* <code>services.xserver.xkb.options</code>: X keyboard options; layout switching goes here.


=====Example:=====
=====Example:=====
Line 18: Line 18:
For desktop:
For desktop:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
services.xserver = {
services.xserver.xkb = {
   layout = "us,ru";
   layout = "us,ru";
   xkbVariant = "workman,";
   variant = "workman,";
   xkbOptions = "grp:win_space_toggle";
   options = "grp:win_space_toggle";
};
};
</syntaxhighlight>
</syntaxhighlight>
Line 54: Line 54:


* <code>services.xserver.exportConfiguration</code>: Makes it so the above mentioned xkb directory (and the <code>xorg.conf</code> file) gets exported to <code>/etc/X11/xkb</code>, which is useful if you have to often look stuff up in it.
* <code>services.xserver.exportConfiguration</code>: Makes it so the above mentioned xkb directory (and the <code>xorg.conf</code> file) gets exported to <code>/etc/X11/xkb</code>, which is useful if you have to often look stuff up in it.
* <code>services.xserver.xkbDir</code>: Allows you to set a different xkb directory altogether. All the above mentioned things will use this instead of the default one in regards to xkb stuff.
* <code>services.xserver.xkb.dir</code>: Allows you to set a different xkb directory altogether. All the above mentioned things will use this instead of the default one in regards to xkb stuff.
* <code>console.useXkbConfig</code>: Makes it so the tty console has about the same layout as the one configured in the <code>services.xserver</code> options.
* <code>console.useXkbConfig</code>: Makes it so the tty console has about the same layout as the one configured in the <code>services.xserver</code> options.


Line 93: Line 93:
   services.xserver.displayManager.sessionCommands = "sleep 5 && ${pkgs.xorg.xmodmap}/bin/xmodmap -e 'keycode 43 = h H Left H' &";
   services.xserver.displayManager.sessionCommands = "sleep 5 && ${pkgs.xorg.xmodmap}/bin/xmodmap -e 'keycode 43 = h H Left H' &";
</syntaxhighlight>
</syntaxhighlight>
[[Category:Desktop]]
[[Category:Hardware]]