Search code examples
unixluax11pangoawesome-wm

How to output lowercase strings in AwesomeWM rc.lua?


I'm using AwesomeWM vicious datewidget. I'm trying to output the date and time in wibox, in my rc.lua, with this format Feb 17, 12:10 AM (%b %d, %l:%M:%p) but I want the AM(%p) to be lowercase.

I've tried: vicious.register(datewidget, vicious.widgets.date, "<span font-family='terminus' color='#999999'>%b %d, %l:%M:</span> <span variant='smallcaps'%p</span>", 1) but the variant attribute doesn't seem to work.

Is there another way to do this?

my full rc.lua


Solution

  • You can use string library's lower() call.

    os.date( "%b, %I:%M " )..string.lower( os.date("%p") )
    

    Edit

    Though it is not mentioned in Lua PiL; the strftime also has %P to format as lowercase am or pm.

    The string can be:

    os.date( "%b, %I:%M %P" )
    

    Codepad example.