doc: Add a client "sticky" example.
This commit is contained in:
parent
522d628c2c
commit
8fb4e2b721
|
@ -815,6 +815,12 @@ lua_class_t client_class;
|
||||||
* @propemits false false
|
* @propemits false false
|
||||||
* @request client geometry fullscreen granted When the client must be resized
|
* @request client geometry fullscreen granted When the client must be resized
|
||||||
* because it became (or stop being) fullscreen.
|
* because it became (or stop being) fullscreen.
|
||||||
|
* @see maximized_horizontal
|
||||||
|
* @see maximized_vertical
|
||||||
|
* @see immobilized_horizontal
|
||||||
|
* @see immobilized_vertical
|
||||||
|
* @see maximized
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -828,6 +834,11 @@ lua_class_t client_class;
|
||||||
* @request client geometry maximized granted When the client must be resized
|
* @request client geometry maximized granted When the client must be resized
|
||||||
* because it became (or stop being) maximized.
|
* because it became (or stop being) maximized.
|
||||||
* @see request::border
|
* @see request::border
|
||||||
|
* @see maximized_horizontal
|
||||||
|
* @see maximized_vertical
|
||||||
|
* @see fullscreen
|
||||||
|
* @see immobilized_horizontal
|
||||||
|
* @see immobilized_vertical
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -840,6 +851,11 @@ lua_class_t client_class;
|
||||||
* @propemits false false
|
* @propemits false false
|
||||||
* @request client geometry maximized_horizontal granted When the client must be resized
|
* @request client geometry maximized_horizontal granted When the client must be resized
|
||||||
* because it became (or stop being) maximized horizontally.
|
* because it became (or stop being) maximized horizontally.
|
||||||
|
* @see maximized_vertical
|
||||||
|
* @see fullscreen
|
||||||
|
* @see immobilized_horizontal
|
||||||
|
* @see immobilized_vertical
|
||||||
|
* @see maximized
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -852,6 +868,11 @@ lua_class_t client_class;
|
||||||
* @propemits false false
|
* @propemits false false
|
||||||
* @request client geometry maximized_vertical granted When the client must be resized
|
* @request client geometry maximized_vertical granted When the client must be resized
|
||||||
* because it became (or stop being) maximized vertically.
|
* because it became (or stop being) maximized vertically.
|
||||||
|
* @see maximized_horizontal
|
||||||
|
* @see fullscreen
|
||||||
|
* @see immobilized_horizontal
|
||||||
|
* @see immobilized_vertical
|
||||||
|
* @see maximized
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -994,6 +1015,8 @@ lua_class_t client_class;
|
||||||
* per screens rather than globally like some other
|
* per screens rather than globally like some other
|
||||||
* implementations.
|
* implementations.
|
||||||
*
|
*
|
||||||
|
* @DOC_sequences_client_sticky_EXAMPLE@
|
||||||
|
*
|
||||||
* @property sticky
|
* @property sticky
|
||||||
* @tparam boolean sticky
|
* @tparam boolean sticky
|
||||||
* @propemits false false
|
* @propemits false false
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
--DOC_GEN_IMAGE --DOC --DOC_NO_USAGE --DOC_ASTERISK
|
||||||
|
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{x = 10, y = 10, height=50, width=50} --DOC_HIDE
|
||||||
|
c:tags{screen[1].tags[1]} --DOC_HIDE
|
||||||
|
end --DOC_HIDE
|
||||||
|
|
||||||
|
awful.tag({ "one", "two", "three", "four", "five" }, screen[1]) --DOC_HIDE
|
||||||
|
|
||||||
|
module.add_event("Add a client", function() --DOC_HIDE
|
||||||
|
-- Add a client.
|
||||||
|
awful.spawn("xterm")
|
||||||
|
assert(#screen[1].clients == 1) --DOC_HIDE
|
||||||
|
end) --DOC_HIDE
|
||||||
|
|
||||||
|
module.display_tags() --DOC_HIDE
|
||||||
|
|
||||||
|
--DOC_NEWLINE
|
||||||
|
|
||||||
|
module.add_event("Set sticky = true", function() --DOC_HIDE
|
||||||
|
-- Set sticky = true
|
||||||
|
screen[1].clients[1].sticky = true
|
||||||
|
end) --DOC_HIDE
|
||||||
|
|
||||||
|
module.display_tags() --DOC_HIDE
|
||||||
|
|
||||||
|
module.execute {show_empty = true} --DOC_HIDE
|
|
@ -242,11 +242,28 @@ local function gen_cls(c,results)
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function get_all_tag_clients(t)
|
||||||
|
local s = t.screen
|
||||||
|
|
||||||
|
local clients = gtable.clone(t:clients(), false)
|
||||||
|
|
||||||
|
for _, c in ipairs(s.clients) do
|
||||||
|
if c.sticky then
|
||||||
|
if not gtable.hasitem(clients, c) then
|
||||||
|
table.insert(clients, c)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return clients
|
||||||
|
end
|
||||||
|
|
||||||
local function fake_arrange(tag)
|
local function fake_arrange(tag)
|
||||||
local cls,results,flt = {},setmetatable({},{__mode="k"}),{}
|
local cls,results,flt = {},setmetatable({},{__mode="k"}),{}
|
||||||
local _, l = tag.screen, tag.layout
|
local l = tag.layout
|
||||||
local focus, focus_wrap = capi.client.focus, nil
|
local focus, focus_wrap = capi.client.focus, nil
|
||||||
for _ ,c in ipairs (tag:clients()) do
|
|
||||||
|
for _ ,c in ipairs (get_all_tag_clients(tag)) do
|
||||||
-- Handle floating client separately
|
-- Handle floating client separately
|
||||||
if not c.minimized then
|
if not c.minimized then
|
||||||
local floating = c.floating
|
local floating = c.floating
|
||||||
|
@ -758,7 +775,7 @@ function module.display_tags()
|
||||||
master_width_factor = t.master_width_factor,
|
master_width_factor = t.master_width_factor,
|
||||||
client_geo = fake_arrange(t),
|
client_geo = fake_arrange(t),
|
||||||
})
|
})
|
||||||
assert(#st[#st].client_geo == #t:clients())
|
assert(#st[#st].client_geo == #get_all_tag_clients(t))
|
||||||
end
|
end
|
||||||
table.insert(ret, {tags=st})
|
table.insert(ret, {tags=st})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue