Merge pull request #3073 from actionless/placement-skip-fullscreen

feat(awful: placement): add "skip_fullscreen"
This commit is contained in:
Emmanuel Lepage Vallée 2020-05-04 01:43:55 -07:00 committed by GitHub
commit e384ee449f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 82 additions and 0 deletions

View File

@ -1624,6 +1624,26 @@ function placement.restore(d, args)
return true return true
end end
--- Skip all preceeding results of placement pipeline for fullscreen clients.
--@DOC_awful_placement_skip_fullscreen_EXAMPLE@
-- @tparam drawable d A drawable (like `client`, `mouse` or `wibox`)
-- @tparam[opt={}] table args Other arguments
-- @treturn table The new geometry
-- @staticfct awful.placement.skip_fullscreen
function placement.skip_fullscreen(d, args)
args = add_context(args, "skip_fullscreen")
d = d or capi.client.focus
if d.fullscreen then
return {get_screen(d.screen).geometry, {}, true}
else
local ngeo = geometry_common(d, args)
remove_border(d, args, ngeo)
geometry_common(d, args, ngeo)
return fix_new_geometry(ngeo, args, true)
end
end
return placement return placement
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,25 @@
--DOC_GEN_OUTPUT --DOC_GEN_IMAGE --DOC_HIDE
local awful = {placement = require("awful.placement")} --DOC_HIDE
--DOC_HIDE no_offscreen is auto-called when startup is true, avoid this.
awesome.startup = false -- luacheck: globals awesome.startup --DOC_HIDE
-- using just no_offscreen with honor_workarea:
local c = client.gen_fake {x = 0, y = 0, width= screen[1].geometry.width, height=screen[1].geometry.height} --DOC_HIDE
c.fullscreen = false --DOC_HIDE
print("no_offscreen:") --DOC_HIDE
print("Before:", "x="..c.x..", y="..c.y..", width="..c.width..", height="..c.height) --DOC_HIDE
awful.placement.no_offscreen(c, {honor_workarea=true, })
print("After:", "x="..c.x..", y="..c.y..", width="..c.width..", height="..c.height) --DOC_HIDE
c:kill() --DOC_HIDE
-- using no_offscreen + skip_fullscreen:
c = client.gen_fake {x = 0, y = 0, width= screen[1].geometry.width, height=screen[1].geometry.height} --DOC_HIDE
c.fullscreen = false --DOC_HIDE
print("no_offscreen + skip_fullscreen:") --DOC_HIDE
print("Before:", "x="..c.x..", y="..c.y..", width="..c.width..", height="..c.height) --DOC_HIDE
local f = (awful.placement.no_offscreen + awful.placement.skip_fullscreen)
f(c, {honor_workarea=true, })
print("After:", "x="..c.x..", y="..c.y..", width="..c.width..", height="..c.height) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,6 @@
no_offscreen:
Before: x=0, y=0, width=320, height=240
After: x=10, y=10, width=320, height=240
no_offscreen + skip_fullscreen:
Before: x=0, y=0, width=320, height=240
After: x=10, y=10, width=320, height=240

View File

@ -0,0 +1,25 @@
--DOC_GEN_OUTPUT --DOC_GEN_IMAGE --DOC_HIDE
local awful = {placement = require("awful.placement")} --DOC_HIDE
--DOC_HIDE no_offscreen is auto-called when startup is true, avoid this.
awesome.startup = false -- luacheck: globals awesome.startup --DOC_HIDE
-- using just no_offscreen with honor_workarea:
local c = client.gen_fake {x = 0, y = 0, width= screen[1].geometry.width, height=screen[1].geometry.height} --DOC_HIDE
c.fullscreen = true --DOC_HIDE
print("no_offscreen:") --DOC_HIDE
print("Before:", "x="..c.x..", y="..c.y..", width="..c.width..", height="..c.height) --DOC_HIDE
awful.placement.no_offscreen(c, {honor_workarea=true, })
print("After:", "x="..c.x..", y="..c.y..", width="..c.width..", height="..c.height) --DOC_HIDE
c:kill() --DOC_HIDE
-- using no_offscreen + skip_fullscreen:
c = client.gen_fake {x = 0, y = 0, width= screen[1].geometry.width, height=screen[1].geometry.height} --DOC_HIDE
c.fullscreen = true --DOC_HIDE
print("no_offscreen + skip_fullscreen:") --DOC_HIDE
print("Before:", "x="..c.x..", y="..c.y..", width="..c.width..", height="..c.height) --DOC_HIDE
local f = (awful.placement.no_offscreen + awful.placement.skip_fullscreen)
f(c, {honor_workarea=true, })
print("After:", "x="..c.x..", y="..c.y..", width="..c.width..", height="..c.height) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,6 @@
no_offscreen:
Before: x=0, y=0, width=320, height=240
After: x=10, y=10, width=320, height=240
no_offscreen + skip_fullscreen:
Before: x=0, y=0, width=320, height=240
After: x=0, y=0, width=320, height=240