Unify input methods with the installer keyboard selection
This commit is contained in:
1 parent
402128b6a2
commit
9fe6a04715
34 files changed
+1207
-31
No files matched your search
@@ -0,0 +1,47 @@
|
||||
-- The keyboard layout picked at install time. The installer and first-boot
|
||||
-- setup persist it to /etc/vconsole.conf, so Hyprland reads it from there
|
||||
-- instead of rewriting every user's config.
|
||||
|
||||
local keyboard = {}
|
||||
|
||||
local function read_values(path)
|
||||
local values = {}
|
||||
local file = io.open(path, "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
|
||||
|
||||
function keyboard.vconsole()
|
||||
return read_values("/etc/vconsole.conf")
|
||||
end
|
||||
|
||||
function keyboard.installed()
|
||||
local values = keyboard.vconsole()
|
||||
if read_values("/etc/omarchy/input-method").XKB_LAYOUT == "kr" then
|
||||
values.XKBLAYOUT, values.XKBVARIANT = "kr", ""
|
||||
end
|
||||
return values
|
||||
end
|
||||
|
||||
-- Japanese (JIS) keyboards put +, ^, and the Henkan/Muhenkan keys where US
|
||||
-- keyboards don't, so a few defaults only apply when that layout leads.
|
||||
function keyboard.jis()
|
||||
local layout = keyboard.installed().XKBLAYOUT or "us"
|
||||
return layout:match("^[^,]*") == "jp"
|
||||
end
|
||||
|
||||
return keyboard
|
||||
Reference in new issue
Block a user