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" widget.ibus_indicator_text.font = config.core.font.normal_medium widget.xkb_indicator_text = wibox.widget.textbox("??") widget.xkb_indicator_text.valign = "center" widget.xkb_indicator_text.align = "center" widget.xkb_indicator_text.font = config.core.font.normal_small 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() widget.ibus_indicator_text.text = config.ibus.language_list[util.current_engine_index]["indicator_code"] widget.xkb_indicator_text.text = util.current_xkbmap 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