Green background for EN, red for RU. Uses im-select on macOS. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
51 lines
1.2 KiB
Lua
51 lines
1.2 KiB
Lua
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"
|
|
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
|
|
return { bg = "#f38ba8", fg = "#1e1e2e", gui = "bold" }
|
|
end
|
|
return { bg = "#a6e3a1", fg = "#1e1e2e", gui = "bold" }
|
|
end
|
|
|
|
return {
|
|
"nvim-lualine/lualine.nvim",
|
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
|
opts = {
|
|
options = {
|
|
theme = "auto",
|
|
component_separators = { left = "", right = "" },
|
|
section_separators = { left = "", right = "" },
|
|
},
|
|
sections = {
|
|
lualine_a = { "mode" },
|
|
lualine_b = {
|
|
{ keyboard_layout, color = keyboard_layout_color },
|
|
"branch",
|
|
"diff",
|
|
"diagnostics",
|
|
},
|
|
lualine_c = { { "filename", path = 1 } },
|
|
lualine_x = { "encoding", "filetype" },
|
|
lualine_y = { "progress" },
|
|
lualine_z = { "location" },
|
|
},
|
|
},
|
|
}
|