doc: Add an example for mouse `snap` and client edge tiling.

This commit is contained in:
Emmanuel Lepage Vallee 2020-08-09 23:34:28 -07:00
parent a39f66e1c6
commit 9b4f5b7969
3 changed files with 87 additions and 0 deletions

View File

@ -32,6 +32,9 @@ mouse.object = {}
mouse.wibox = {}
--- The default distance before snapping clients together.
--
-- @DOC_screen_client_snap_EXAMPLE@
--
-- @tfield integer awful.mouse.snap.default_distance
-- @tparam[opt=8] integer default_distance
-- @see awful.mouse.snap
@ -42,6 +45,11 @@ mouse.wibox = {}
-- @see awful.mouse.snap
--- Enable screen edges snapping.
--
--
--
--@DOC_awful_placement_aero_snap_EXAMPLE@
--
-- @tfield[opt=true] boolean awful.mouse.snap.edge_enabled
--- Enable client to client snapping.

View File

@ -0,0 +1,33 @@
--DOC_HIDE_ALL
--DOC_GEN_IMAGE
local placement = require("awful.placement")
screen[1]._resize {width = 180, height = 120} --DOC_HIDE
screen._add_screen {x = 190, y = 0, width = 180, height = 120} --DOC_HIDE
screen._add_screen {x = 380, y = 0, width = 180, height = 120} --DOC_HIDE
for _, pos in ipairs{"left", "right"} do
local c1 = client.gen_fake {x = 80, y = 55, width=78, height=50}
placement.align(client.focus, {position = pos, honor_workarea=true})
c1:_hide_all()
placement.maximize_vertically(client.focus, {position = pos, honor_workarea=true})
c1:set_label(pos)
end
for _, pos in ipairs{"top", "bottom"} do
local c1 = client.gen_fake {x = 80, y = 55, width=75, height=48,screen=screen[2]}
placement.align(client.focus, {position = pos, honor_workarea=true})
c1:_hide_all()
placement.maximize_horizontally(client.focus, {position = pos, honor_workarea=true})
c1:set_label(pos)
end
for _, pos in ipairs{"top_left", "top_right", "bottom_left", "bottom_right"} do
local c1 = client.gen_fake {x = 280, y = 55, width=79, height=48, screen=screen[3]}
c1:_hide_all()
placement.align(client.focus, {position = pos, honor_workarea=true})
c1:set_label(pos)
end
return {hide_lines=true}
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,46 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE --DOC_HIDE_ALL
screen[1]._resize {x = 0, width = 640, height = 480}
local awful = {
wibar = require("awful.wibar"),
tag = require("awful.tag"),
tag_layout = require("awful.layout.suit.floating")
}
require("awful.mouse.snap").default_distance = 32
screen[1].padding = {
left = 40,
right = 40,
top = 20,
bottom = 20,
}
local wibar = awful.wibar {
position = "top",
height = 24,
}
awful.tag.add("1", {
screen = screen[1],
selected = true,
layout = awful.tag_layout.right,
gap = 20
})
local clients = {
['client #1'] = client.gen_fake{floating=true, x = 60, y = 60, height = 160, width=200},
['client #2'] = client.gen_fake{floating=true, x = 300, y = 150, height = 160, width=200},
}
return {
factor = 2 ,
show_boxes = true,
draw_wibar = wibar,
draw_clients = clients,
display_screen_info = false,
draw_client_snap = true, --FIXME
}