doc: Add the markup example of popup_calendar

Refer to tests/examples/awful/widget/calendar_popup/default.lua
This commit is contained in:
sarubo 2021-11-21 23:49:46 +09:00
parent 03e437e32a
commit 8d61790be7
2 changed files with 45 additions and 0 deletions

View File

@ -46,6 +46,9 @@ local styles = { "year", "month", "yearheader", "monthheader", "header", "weekda
-- @tparam cell_properties table Table of cell style properties
--- Cell properties.
--
-- @DOC_awful_widget_calendar_popup_cell_properties_EXAMPLE@
--
-- @field markup Markup function or format string
-- @field fg_color Text foreground color
-- @field bg_color Text background color

View File

@ -0,0 +1,42 @@
--DOC_HIDE_START --DOC_GEN_IMAGE
local awful = require("awful")
local wibox = require("wibox")
screen[1]._resize { width = 480, height = 200 }
local wb = awful.wibar { position = "top", }
-- Create the same number of tags as the default config
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.layouts[1])
-- Only bother with widgets that are visible by default
local mykeyboardlayout = awful.widget.keyboardlayout()
local my_text_clock = wibox.widget.textclock()
local mytaglist = awful.widget.taglist(screen[1], awful.widget.taglist.filter.all, {})
local mytasklist = awful.widget.tasklist(screen[1], awful.widget.tasklist.filter.currenttags, {})
--DOC_HIDE_END
local my_header_properties = {
markup = function(text) return "<i>" .. text .. "</i>" end,
}
local my_options = { style_header = my_header_properties, }
local month_calendar = awful.widget.calendar_popup.month(my_options)
month_calendar:attach(my_text_clock, "tr")
--DOC_HIDE_START
wb:setup {
layout = wibox.layout.align.horizontal,
{
mytaglist,
layout = wibox.layout.fixed.horizontal,
},
mytasklist,
{
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
my_text_clock,
},
}
month_calendar:toggle()
--vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 --DOC_HIDE_END