Index: HelenOS.config
===================================================================
--- HelenOS.config	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ HelenOS.config	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -497,4 +497,11 @@
 ! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&MACHINE=msim] CONFIG_MSIM_PRN (y/n)
 
+% Default Keyboard Layout
+@ "ar" Arabic
+@ "cz" Czech
+@ "us_dvorak" English US (DVORAK)
+@ "us_qwerty" English US
+! [CONFIG_PC_KBD=y|CONFIG_AT_KBD=y|CONFIG_MSIM_KBD=y] CONFIG_KB_LAYOUT (choice)
+
 % Support for VIA CUDA controller
 ! [CONFIG_HID_IN=generic&PLATFORM=ppc32] CONFIG_VIA_CUDA (y/n)
Index: defaults/amd64/Makefile.config
===================================================================
--- defaults/amd64/Makefile.config	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ defaults/amd64/Makefile.config	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -53,4 +53,7 @@
 CONFIG_PC_KBD = y
 
+# Default keyboard layout
+CONFIG_KB_LAYOUT = us_qwerty
+
 # EGA support
 CONFIG_EGA = y
Index: defaults/arm32/Makefile.config
===================================================================
--- defaults/arm32/Makefile.config	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ defaults/arm32/Makefile.config	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -38,4 +38,7 @@
 CONFIG_HID_OUT = generic
 
+# Default keyboard layout
+CONFIG_KB_LAYOUT = us_qwerty
+
 # Dynamic linking support
 CONFIG_RTLD = y
Index: defaults/arm64/Makefile.config
===================================================================
--- defaults/arm64/Makefile.config	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ defaults/arm64/Makefile.config	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -47,4 +47,7 @@
 CONFIG_HID_OUT = generic
 
+# Default keyboard layout
+CONFIG_KB_LAYOUT = us_qwerty
+
 # Optimization level
 OPTIMIZATION = 3
Index: defaults/ia64/Makefile.config
===================================================================
--- defaults/ia64/Makefile.config	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ defaults/ia64/Makefile.config	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -50,4 +50,7 @@
 CONFIG_HID_OUT = generic
 
+# Default keyboard layout
+CONFIG_KB_LAYOUT = us_qwerty
+
 # Optimization level
 OPTIMIZATION = 3
Index: defaults/mips32/Makefile.config
===================================================================
--- defaults/mips32/Makefile.config	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ defaults/mips32/Makefile.config	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -44,4 +44,7 @@
 CONFIG_HID_OUT = generic
 
+# Default keyboard layout
+CONFIG_KB_LAYOUT = us_qwerty
+
 # Barebone build with essential binaries only
 CONFIG_BAREBONE = y
Index: defaults/ppc32/Makefile.config
===================================================================
--- defaults/ppc32/Makefile.config	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ defaults/ppc32/Makefile.config	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -41,4 +41,7 @@
 CONFIG_HID_OUT = generic
 
+# Default keyboard layout
+CONFIG_KB_LAYOUT = us_qwerty
+
 # Framebuffer support
 CONFIG_FB = y
Index: defaults/riscv64/Makefile.config
===================================================================
--- defaults/riscv64/Makefile.config	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ defaults/riscv64/Makefile.config	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -38,4 +38,7 @@
 CONFIG_HID_OUT = generic
 
+# Default keyboard layout
+CONFIG_KB_LAYOUT = us_qwerty
+
 # Optimization level
 OPTIMIZATION = 3
Index: defaults/sparc64/Makefile.config
===================================================================
--- defaults/sparc64/Makefile.config	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ defaults/sparc64/Makefile.config	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -53,4 +53,7 @@
 CONFIG_HID_OUT = generic
 
+# Default keyboard layout
+CONFIG_KB_LAYOUT = us_qwerty
+
 # Start AP processors by the loader
 CONFIG_AP = y
Index: defaults/special/Makefile.config
===================================================================
--- defaults/special/Makefile.config	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ defaults/special/Makefile.config	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -32,4 +32,7 @@
 CONFIG_TEST = y
 
+# Default keyboard layout
+CONFIG_KB_LAYOUT = us_qwerty
+
 # Optimization level
 OPTIMIZATION = 3
Index: uspace/srv/hid/input/Makefile
===================================================================
--- uspace/srv/hid/input/Makefile	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ uspace/srv/hid/input/Makefile	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -32,9 +32,15 @@
 LIBS = drv
 
+ROOT_PATH = $(USPACE_PREFIX)/..
+CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
+
+include $(CONFIG_MAKEFILE)
+
+ifndef CONFIG_KB_LAYOUT
+$(error CONFIG_KB_LAYOUT must be set! Please reconfigure your HelenOS.config)
+endif
+
 SOURCES = \
-	layout/cz.c \
-	layout/us_qwerty.c \
-	layout/us_dvorak.c \
-	layout/ar.c \
+	layout/$(CONFIG_KB_LAYOUT).c \
 	port/chardev.c \
 	proto/mousedev.c \
@@ -47,3 +53,5 @@
 	stroke.c
 
+
 include $(USPACE_PREFIX)/Makefile.common
+
Index: uspace/srv/hid/input/input.c
===================================================================
--- uspace/srv/hid/input/input.c	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ uspace/srv/hid/input/input.c	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -66,13 +66,4 @@
 #include "serial.h"
 
-#define NUM_LAYOUTS  4
-
-static layout_ops_t *layout[NUM_LAYOUTS] = {
-	&us_qwerty_ops,
-	&us_dvorak_ops,
-	&cz_ops,
-	&ar_ops
-};
-
 typedef struct {
 	/** Link into the list of clients */
@@ -206,31 +197,7 @@
 	}
 
-	// TODO: More elegant layout switching
-
-	if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) &&
-	    (key == KC_F1)) {
+	if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) && (key == KC_F1)) {
 		layout_destroy(kdev->active_layout);
-		kdev->active_layout = layout_create(layout[0]);
-		return;
-	}
-
-	if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) &&
-	    (key == KC_F2)) {
-		layout_destroy(kdev->active_layout);
-		kdev->active_layout = layout_create(layout[1]);
-		return;
-	}
-
-	if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) &&
-	    (key == KC_F3)) {
-		layout_destroy(kdev->active_layout);
-		kdev->active_layout = layout_create(layout[2]);
-		return;
-	}
-
-	if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) &&
-	    (key == KC_F4)) {
-		layout_destroy(kdev->active_layout);
-		kdev->active_layout = layout_create(layout[3]);
+		kdev->active_layout = layout_create(&layout_default);
 		return;
 	}
@@ -392,5 +359,5 @@
 	kdev->mods = KM_NUM_LOCK;
 	kdev->lock_keys = 0;
-	kdev->active_layout = layout_create(layout[0]);
+	kdev->active_layout = layout_create(&layout_default);
 
 	return kdev;
Index: uspace/srv/hid/input/layout.h
===================================================================
--- uspace/srv/hid/input/layout.h	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ uspace/srv/hid/input/layout.h	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -56,8 +56,5 @@
 } layout_ops_t;
 
-extern layout_ops_t us_qwerty_ops;
-extern layout_ops_t us_dvorak_ops;
-extern layout_ops_t cz_ops;
-extern layout_ops_t ar_ops;
+extern layout_ops_t layout_default;
 
 extern layout_t *layout_create(layout_ops_t *);
Index: uspace/srv/hid/input/layout/ar.c
===================================================================
--- uspace/srv/hid/input/layout/ar.c	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ uspace/srv/hid/input/layout/ar.c	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -46,9 +46,13 @@
 static wchar_t ar_parse_ev(layout_t *, kbd_event_t *ev);
 
-layout_ops_t ar_ops = {
+#ifdef CONFIG_KB_LAYOUT_ar
+
+layout_ops_t layout_default = {
 	.create = ar_create,
 	.destroy = ar_destroy,
 	.parse_ev = ar_parse_ev
 };
+
+#endif
 
 static wchar_t map_not_shifted[] = {
Index: uspace/srv/hid/input/layout/cz.c
===================================================================
--- uspace/srv/hid/input/layout/cz.c	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ uspace/srv/hid/input/layout/cz.c	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -57,9 +57,13 @@
 } layout_cz_t;
 
-layout_ops_t cz_ops = {
+#ifdef CONFIG_KB_LAYOUT_us_qwerty
+
+layout_ops_t layout_default = {
 	.create = cz_create,
 	.destroy = cz_destroy,
 	.parse_ev = cz_parse_ev
 };
+
+#endif
 
 static wchar_t map_lcase[] = {
Index: uspace/srv/hid/input/layout/us_dvorak.c
===================================================================
--- uspace/srv/hid/input/layout/us_dvorak.c	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ uspace/srv/hid/input/layout/us_dvorak.c	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -45,9 +45,13 @@
 static wchar_t us_dvorak_parse_ev(layout_t *, kbd_event_t *ev);
 
-layout_ops_t us_dvorak_ops = {
+#ifdef CONFIG_KB_LAYOUT_us_dvorak
+
+layout_ops_t layout_default = {
 	.create = us_dvorak_create,
 	.destroy = us_dvorak_destroy,
 	.parse_ev = us_dvorak_parse_ev
 };
+
+#endif
 
 static wchar_t map_lcase[] = {
Index: uspace/srv/hid/input/layout/us_qwerty.c
===================================================================
--- uspace/srv/hid/input/layout/us_qwerty.c	(revision 1e8b633ea4fe33de942dfc3b6dfe8d63fa018b89)
+++ uspace/srv/hid/input/layout/us_qwerty.c	(revision cb9313e8da64558473ca8fdf6c8c48d6f75b0b96)
@@ -45,9 +45,13 @@
 static wchar_t us_qwerty_parse_ev(layout_t *, kbd_event_t *ev);
 
-layout_ops_t us_qwerty_ops = {
+#ifdef CONFIG_KB_LAYOUT_us_qwerty
+
+layout_ops_t layout_default = {
 	.create = us_qwerty_create,
 	.destroy = us_qwerty_destroy,
 	.parse_ev = us_qwerty_parse_ev
 };
+
+#endif
 
 static wchar_t map_lcase[] = {
