Merge pull request #3041 from SethBarberee/tag_gap_doc

[Doc] add example for master_count in awful.tag
This commit is contained in:
mergify[bot] 2020-03-20 12:46:16 +00:00 committed by GitHub
commit 5d1394b91d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 0 deletions

View File

@ -1227,6 +1227,8 @@ end
--- Set the number of master windows.
--
-- @DOC_sequences_tag_master_count_EXAMPLE@
--
-- **Signal:**
--
-- * *property::nmaster* (deprecated)

View File

@ -0,0 +1,48 @@
--DOC_GEN_IMAGE --DOC --DOC_NO_USAGE
local module = ... --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout") } --DOC_HIDE
screen[1]._resize {x = 0, width = 128, height = 96} --DOC_HIDE
function awful.spawn(_, args) --DOC_HIDE
local c = client.gen_fake{} --DOC_HIDE
c:tags({args.tag}) --DOC_HIDE
assert(#c:tags() == 1) --DOC_HIDE
assert(c:tags()[1] == args.tag) --DOC_HIDE
end --DOC_HIDE
module.add_event("Create differing master count tags", function() --DOC_HIDE
-- Create a tag with master count of 1 and tag with count of 2
awful.tag.add("Master 1", {
screen = screen[1],
layout = awful.layout.suit.tile,
master_count = 1,
})
--DOC_NEWLINE
awful.tag.add("Master 2", {
screen = screen[1],
layout = awful.layout.suit.tile,
master_count = 2,
})
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
--DOC_NEWLINE
module.add_event("Add some clients", function() --DOC_HIDE
-- Add some clients.
for _, t in ipairs(screen[1].tags) do
for _ = 1, 5 do
awful.spawn("xterm", {tag = t})
end
assert(#t:clients() == 5) --DOC_HIDE
end
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute {show_empty = true} --DOC_HIDE