Skip to main content

from_system

Function from_system 

Source
pub fn from_system() -> (&'static Layout, LayoutSource)
Expand description

Finds the layout this system is configured for.

Reads, in order: DENISE_KEYMAP, XKB_DEFAULT_LAYOUT, and the console keyboard configuration files distributions actually use. Falls back to US.

§What this does and does not do

It reads the system’s choice of layout, not the layout itself. The layout still has to be one Denise has a table for; a system configured for fr on a build with only us and no gets US and says so through the returned LayoutSource, rather than silently typing the wrong thing.

Reading the layout data would mean the kernel’s own keymap, through KDGKBENT on a VT — which needs /dev/tty0, which is root:root mode 600 on every distribution checked. Denise otherwise runs unprivileged, needing only the video and input groups, and giving that up to read a keymap is a poor trade. Adding a layout table is about thirty lines; needing root is forever.