Choosing a non-Latin layout (e.g. ara, il, ru) via /etc/vconsole.conf leaves Hyprland unable to match Omarchy's Latin-keysym bindings, since Hyprland resolves bindings against the first layout in kb_layout only. Prepending 'us' when the detected layout doesn't already include it keeps shortcuts reachable, and activating grp:alts_toggle lets the user switch to their layout with Left Alt + Right Alt.
68 lines
1.6 KiB
Lua
68 lines
1.6 KiB
Lua
-- https://wiki.hypr.land/Configuring/Basics/Variables/#input
|
|
|
|
local function read_vconsole()
|
|
local values = {}
|
|
local file = io.open("/etc/vconsole.conf", "r")
|
|
if not file then
|
|
return values
|
|
end
|
|
|
|
for line in file:lines() do
|
|
local key, value = line:match("^%s*([%w_]+)%s*=%s*(.-)%s*$")
|
|
if key and value then
|
|
value = value:gsub("%s+#.*$", "")
|
|
value = value:gsub('^"(.*)"$', "%1")
|
|
value = value:gsub("^'(.*)'$", "%1")
|
|
values[key] = value
|
|
end
|
|
end
|
|
|
|
file:close()
|
|
return values
|
|
end
|
|
|
|
local vconsole = read_vconsole()
|
|
|
|
local layout = vconsole.XKBLAYOUT or "us"
|
|
local variant = vconsole.XKBVARIANT or ""
|
|
local kb_options = "compose:caps,shift:both_capslock"
|
|
|
|
-- Prepend 'us' so Omarchy's Latin-keysym bindings resolve — Hyprland matches
|
|
-- bindings against the first layout in kb_layout, not the currently active one.
|
|
if not (","..layout..","):find(",us,", 1, true) then
|
|
layout = "us," .. layout
|
|
variant = "," .. variant
|
|
kb_options = kb_options .. ",grp:alts_toggle"
|
|
end
|
|
|
|
hl.config({
|
|
input = {
|
|
kb_layout = layout,
|
|
kb_variant = variant,
|
|
kb_model = "",
|
|
kb_options = kb_options,
|
|
kb_rules = "",
|
|
follow_mouse = 1,
|
|
sensitivity = 0,
|
|
|
|
repeat_rate = 40,
|
|
repeat_delay = 250,
|
|
numlock_by_default = true,
|
|
|
|
touchpad = {
|
|
natural_scroll = false,
|
|
clickfinger_behavior = true,
|
|
scroll_factor = 0.4,
|
|
},
|
|
},
|
|
|
|
misc = {
|
|
key_press_enables_dpms = true,
|
|
mouse_move_enables_dpms = true,
|
|
},
|
|
})
|
|
|
|
-- Scroll nicely in the terminal.
|
|
o.window("(Alacritty|kitty|foot)", { scroll_touchpad = 1.5 })
|
|
o.window("com.mitchellh.ghostty", { scroll_touchpad = 0.2 })
|