2022-07-16 14:13:03 -07:00
|
|
|
local util = req_rel(..., "util")
|
|
|
|
local widget = {}
|
|
|
|
|
|
|
|
widget.ibus_indicator_text = wibox.widget.textbox("??")
|
|
|
|
widget.ibus_indicator_text.valign = "center"
|
|
|
|
widget.ibus_indicator_text.align = "center"
|
2023-08-21 19:00:27 -07:00
|
|
|
widget.ibus_indicator_text.font = config.core.font.normal_medium
|
2022-07-16 14:13:03 -07:00
|
|
|
|
|
|
|
widget.xkb_indicator_text = wibox.widget.textbox("??")
|
|
|
|
widget.xkb_indicator_text.valign = "center"
|
|
|
|
widget.xkb_indicator_text.align = "center"
|
2023-08-21 19:00:27 -07:00
|
|
|
widget.xkb_indicator_text.font = config.core.font.normal_small
|
2022-07-16 14:13:03 -07:00
|
|
|
|
|
|
|
|
|
|
|
widget.widget = wibox.widget {
|
|
|
|
{
|
|
|
|
{ -- Right spacer
|
|
|
|
widget = wibox.widget.separator,
|
|
|
|
color = beautiful.color.transparent,
|
|
|
|
forced_width = beautiful.dpi(3)
|
|
|
|
},
|
|
|
|
|
|
|
|
wibox.widget {
|
|
|
|
widget.ibus_indicator_text,
|
|
|
|
widget.xkb_indicator_text,
|
|
|
|
|
|
|
|
forced_num_cols = 1,
|
|
|
|
forced_num_rows = 2,
|
|
|
|
homogeneous = true,
|
|
|
|
expand = true,
|
|
|
|
layout = wibox.layout.grid
|
|
|
|
},
|
|
|
|
|
|
|
|
{ -- Left spacer
|
|
|
|
widget = wibox.widget.separator,
|
|
|
|
color = beautiful.color.transparent,
|
|
|
|
forced_width = beautiful.dpi(3)
|
|
|
|
},
|
|
|
|
|
|
|
|
layout = wibox.layout.align.horizontal,
|
|
|
|
},
|
|
|
|
layout = wibox.container.background,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-- Change background when mouse is over widget
|
|
|
|
widget.widget:connect_signal("mouse::enter", function(result)
|
|
|
|
widget.widget.bg = beautiful.color.bar.hover_bg
|
|
|
|
end)
|
|
|
|
|
|
|
|
widget.widget:connect_signal("mouse::leave", function(result)
|
|
|
|
widget.widget.bg = beautiful.color.transparent
|
|
|
|
end)
|
|
|
|
|
|
|
|
widget.update = function()
|
2023-09-02 18:26:22 -07:00
|
|
|
widget.ibus_indicator_text.text = config.ibus.language_list[util.current_engine_index]["indicator_code"]
|
|
|
|
widget.xkb_indicator_text.text = util.current_xkbmap
|
2022-07-16 14:13:03 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- Update every 2 seconds, just in case.
|
|
|
|
widget.update_timer = gears.timer {
|
|
|
|
timeout = 2,
|
|
|
|
call_now = false,
|
|
|
|
autostart = true,
|
|
|
|
single_shot = false,
|
|
|
|
callback = function ()
|
|
|
|
util.get(widget.update)
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
return widget
|