From b38bf229e060f4614aa39a63e0260d1d3c48c07f Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 22 May 2019 16:11:01 +0200 Subject: [PATCH] Adjust default keyboard layout based on hostname Detects the hostname of the x system starting up and sets the keyboard default layout accordingly to german or eurkey. Uses either the $HOST or $HOSTNAME variable, of which the first should typically be set. If no hostname is detected defaults to eurkey layout. Hostname detection is hardcoded for now, since I don't anticipate many changes. --- .xinitrc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.xinitrc b/.xinitrc index d6fc84d..b8073dd 100644 --- a/.xinitrc +++ b/.xinitrc @@ -36,11 +36,14 @@ fi # (only works for x environment - I haven't needed it for non-x yet) setxkbmap -option ctrl:nocaps # sets default to EURkey layout, with possibility to switch to german -setxkbmap -layout eu,de +# sets german layout to be default for the only pc I have with a german keyboard +if [[ $HOST == "marty-desk" ]] || [[ $HOSTNAME == "marty-desk" ]]; then + setxkbmap -layout de,eu +else + setxkbmap -layout eu,de +fi # allows switching layouts with alt+space setxkbmap -option grp:alt_shift_toggle -# quit out of X with ctrl+alt+backspace -setxkbmap -option terminate:ctrl_alt_bksp # Makes Capslock behave as escape - when ONLY capslock is pressed and released # this only works when we already substitute a ctrl for caps with the lines above,