How to output lowercase strings in AwesomeWM rc.lua?

て烟熏妆下的殇ゞ 提交于 2019-12-24 09:26:09

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/14918546/how-to-output-lowercase-strings-in-awesomewm-rc-lua

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!