From 8d61790be77d560138928a28ca807e443f15adfc Mon Sep 17 00:00:00 2001 From: sarubo Date: Sun, 21 Nov 2021 23:49:46 +0900 Subject: [PATCH] doc: Add the markup example of popup_calendar Refer to tests/examples/awful/widget/calendar_popup/default.lua --- lib/awful/widget/calendar_popup.lua | 3 ++ .../widget/calendar_popup/cell_properties.lua | 42 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 tests/examples/awful/widget/calendar_popup/cell_properties.lua diff --git a/lib/awful/widget/calendar_popup.lua b/lib/awful/widget/calendar_popup.lua index 0d911aba0..6da667ae0 100644 --- a/lib/awful/widget/calendar_popup.lua +++ b/lib/awful/widget/calendar_popup.lua @@ -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 diff --git a/tests/examples/awful/widget/calendar_popup/cell_properties.lua b/tests/examples/awful/widget/calendar_popup/cell_properties.lua new file mode 100644 index 000000000..f9fc1d294 --- /dev/null +++ b/tests/examples/awful/widget/calendar_popup/cell_properties.lua @@ -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 "" .. text .. "" 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 \ No newline at end of file