fixes
This commit is contained in:
@@ -1,24 +1,23 @@
|
||||
local layout = "EN"
|
||||
|
||||
local function update_layout()
|
||||
vim.system({ "im-select" }, { text = true }, function(result)
|
||||
if result.stdout then
|
||||
layout = result.stdout:find("Russian") and "RU" or "EN"
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Update layout in background every second, never blocks UI
|
||||
local timer = vim.loop.new_timer()
|
||||
timer:start(0, 1000, vim.schedule_wrap(update_layout))
|
||||
|
||||
local function keyboard_layout()
|
||||
local handle = io.popen("im-select")
|
||||
if not handle then
|
||||
return ""
|
||||
end
|
||||
local result = handle:read("*a")
|
||||
handle:close()
|
||||
if result:find("Russian") then
|
||||
return "RU"
|
||||
end
|
||||
return "EN"
|
||||
return layout
|
||||
end
|
||||
|
||||
local function keyboard_layout_color()
|
||||
local handle = io.popen("im-select")
|
||||
if not handle then
|
||||
return { bg = "#a6e3a1", fg = "#1e1e2e", gui = "bold" }
|
||||
end
|
||||
local result = handle:read("*a")
|
||||
handle:close()
|
||||
if result:find("Russian") then
|
||||
if layout == "RU" then
|
||||
return { bg = "#f38ba8", fg = "#1e1e2e", gui = "bold" }
|
||||
end
|
||||
return { bg = "#a6e3a1", fg = "#1e1e2e", gui = "bold" }
|
||||
|
||||
Reference in New Issue
Block a user