Configuration Highlights: Keyboard Layout in Hyprland

Omarchy ensures your XKB keyboard layout set during the Arch install is automatically applied to your Hyprland session. This section explains how Omarchy:

  • Reads your system’s XKBLAYOUT/XKBVARIANT from /etc/vconsole.conf.
  • Injects them into Hyprland’s ~/.config/hypr/input.conf.
  • Guarantees a consistent typing experience between console and GUI.

Index

  1. Purpose
  2. Workflow Diagram
  3. Implementation Overview
  4. Key Script: detect-keyboard-layout.sh
  5. How It Works
  6. Dependencies & Related Files
  7. Configuration Paths
  8. Example Snippet

Purpose

Omarchy’s keyboard layout synchronization ensures Hyprland uses the same layout and variant as your console setup. This avoids mismatches between terminal and GUI key mappings.


Workflow Diagram

flowchart TD
  A[/etc/vconsole.conf/] -->|read<br/>XKBLAYOUT/XKBVARIANT| B[detect-keyboard-layout.sh]
  B -->|insert<br/>kb_layout/kb_variant| C[~/.config/hypr/input.conf]

Implementation Overview

  • A Bash script runs during the Omarchy install.
  • It parses /etc/vconsole.conf for layout settings.
  • It inserts kb_layout and kb_variant directives just above kb_options in input.conf.
  • This runs automatically as part of the install.sh Configurations phase .

Key Script: detect-keyboard-layout.sh

This script lives at install/config/detect-keyboard-layout.sh and is sourced by install.sh.

#!/bin/bash
# Sync console keyboard layout to Hyprland

conf="/etc/vconsole.conf"
hyprconf="$HOME/.config/hypr/input.conf"

# Extract layout and variant
layout=$(grep '^XKBLAYOUT=' "$conf" | cut -d= -f2 | tr -d '"')
variant=$(grep '^XKBVARIANT=' "$conf" | cut -d= -f2 | tr -d '"')

# Insert into Hyprland config before kb_options
if [[ -n "$layout" ]]; then
  sed -i "/^[[:space:]]*kb_options *=/i\  kb_layout = $layout" "$hyprconf"
fi

if [[ -n "$variant" ]]; then
  sed -i "/^[[:space:]]*kb_options *=/i\  kb_variant = $variant" "$hyprconf"
fi

Source: install/config/detect-keyboard-layout.sh


How It Works

  1. Read /etc/vconsole.conf for XKBLAYOUT and XKBVARIANT.
  2. Validate that each value is non-empty.
  3. Inject lines into Hyprland’s input.conf, ensuring they precede existing kb_options.
  4. Result: Hyprland honors your console layout and variant seamlessly.

Dependencies & Related Files

Component Path Purpose
Omarchy installer install.sh Sources the detect script as part of config phase.
Detect script install/config/detect-keyboard-layout.sh Reads and applies XKB settings.
Hyprland input config (user) ~/.config/hypr/input.conf Final destination for injected layout directives.
Hyprland default input config default/hypr/input.conf Provides default values (kb_layout = us, etc.).

Configuration Paths

File Description
/etc/vconsole.conf System console layout (XKBLAYOUT/XKBVARIANT).
~/.config/hypr/input.conf User’s Hyprland input settings (where edits occur).
install/config/detect-keyboard-layout.sh Bash script performing the sync.
install.sh Invokes the above script during Omarchy installation.

Example Snippet in ~/.config/hypr/input.conf

# Control your input devices
input {
  kb_layout = us
  kb_variant = intl
  kb_options = compose:caps
  repeat_rate = 40
  repeat_delay = 600
  
  touchpad {
    scroll_factor = 0.4
  }
}

This shows kb_layout and kb_variant injected above kb_options, matching your console settings .


By automating this step, Omarchy delivers a frictionless desktop setup, keeping your keyboard behavior consistent across console and Wayland environments.