How can I set a font of the text on the keyboardlayout widget? AwesomeWM

My code -

mykeyboardlayout = wibox.widget { 
	{
    {
          widget = awful.widget.keyboardlayout() 
	  },
      fg = "#A4CC96", - text color
  --  bg = "blue",
    widget = wibox.container.background
  },
    bottom = 3,
    color = "red",
    widget = wibox.container.margin
}

How can I set a font of the text on the keyboard widget?

Please, help me <3

This is a little bit hacky workaround taken from this issue on the Awesome WM github bug tracker:

Create a function keyboardlayout_with_font(font) in your rc.lua:

function keyboardlayout_with_font(font)
    local result = awful.widget.keyboardlayout()
    result.widget.font = font
    return result
end

Then you can use this function in your code e.g.:

 mykeyboardlayout = wibox.widget {
      {
        {
          widget = keyboardlayout_with_font("Noto Sans Bold 10")
        },
        fg = "white", -- text color
        --  bg = "blue",
        widget = wibox.container.background
      },
      bottom = 3,
      color = "red",
      widget = wibox.container.margin
}

Btw. your code is not runnable you are missing a - in the comment --text-color

3 Likes

I can find no adequate words to thank you . :handshake:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by