From b71d522f8c1a280d6e13192bafef1c245d7f8a1a Mon Sep 17 00:00:00 2001 From: actionless Date: Thu, 23 Apr 2020 06:23:49 +0200 Subject: [PATCH 1/5] feat(awful: placement): add "skip_fullscreen" --- lib/awful/placement.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/awful/placement.lua b/lib/awful/placement.lua index c67de4e9..fafeb0ad 100644 --- a/lib/awful/placement.lua +++ b/lib/awful/placement.lua @@ -1624,6 +1624,26 @@ function placement.restore(d, args) return true 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 {d: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 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 From 05d905cd7d69a9681e894a804b3511723fcaa728 Mon Sep 17 00:00:00 2001 From: actionless Date: Thu, 23 Apr 2020 07:14:21 +0200 Subject: [PATCH 2/5] test(examples: awful: placement): add for "skip_fullscreen" --- .../awful/placement/skip_fullscreen.lua | 21 +++++++++++++++++++ .../placement/skip_fullscreen.output.txt | 4 ++++ 2 files changed, 25 insertions(+) create mode 100644 tests/examples/awful/placement/skip_fullscreen.lua create mode 100644 tests/examples/awful/placement/skip_fullscreen.output.txt diff --git a/tests/examples/awful/placement/skip_fullscreen.lua b/tests/examples/awful/placement/skip_fullscreen.lua new file mode 100644 index 00000000..bf020e2d --- /dev/null +++ b/tests/examples/awful/placement/skip_fullscreen.lua @@ -0,0 +1,21 @@ +--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 + +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("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 + +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("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 diff --git a/tests/examples/awful/placement/skip_fullscreen.output.txt b/tests/examples/awful/placement/skip_fullscreen.output.txt new file mode 100644 index 00000000..fe735dd9 --- /dev/null +++ b/tests/examples/awful/placement/skip_fullscreen.output.txt @@ -0,0 +1,4 @@ +Before: x=0, y=0, width=320, height=240 +After: x=10, y=10, width=320, height=240 +Before: x=0, y=0, width=320, height=240 +After: x=0, y=0, width=320, height=240 From 9ef78c4f887f89bc46ef522b9d744f2b0a75e992 Mon Sep 17 00:00:00 2001 From: actionless Date: Thu, 23 Apr 2020 07:27:51 +0200 Subject: [PATCH 3/5] fix(awful: placement: skip_fullscreen): force screen geometry --- lib/awful/placement.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/awful/placement.lua b/lib/awful/placement.lua index fafeb0ad..234818f2 100644 --- a/lib/awful/placement.lua +++ b/lib/awful/placement.lua @@ -1635,7 +1635,7 @@ function placement.skip_fullscreen(d, args) d = d or capi.client.focus if d.fullscreen then - return {d:geometry(), {}, true} + return {get_screen(d.screen).geometry, {}, true} else local ngeo = geometry_common(d, args) remove_border(d, args, ngeo) From e820136810cbbf777effcc0a495946b273c5f5db Mon Sep 17 00:00:00 2001 From: actionless Date: Thu, 23 Apr 2020 07:41:18 +0200 Subject: [PATCH 4/5] fixup! fix(awful: placement: skip_fullscreen): force screen geometry doc(awful: placement: no_offscreen): add descriptions to examples --- tests/examples/awful/placement/skip_fullscreen.lua | 4 ++++ tests/examples/awful/placement/skip_fullscreen.output.txt | 2 ++ 2 files changed, 6 insertions(+) diff --git a/tests/examples/awful/placement/skip_fullscreen.lua b/tests/examples/awful/placement/skip_fullscreen.lua index bf020e2d..2e1e749e 100644 --- a/tests/examples/awful/placement/skip_fullscreen.lua +++ b/tests/examples/awful/placement/skip_fullscreen.lua @@ -4,15 +4,19 @@ 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, }) diff --git a/tests/examples/awful/placement/skip_fullscreen.output.txt b/tests/examples/awful/placement/skip_fullscreen.output.txt index fe735dd9..1df44693 100644 --- a/tests/examples/awful/placement/skip_fullscreen.output.txt +++ b/tests/examples/awful/placement/skip_fullscreen.output.txt @@ -1,4 +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 From d686a0e35735f02086674fc68e035ccce2b97c52 Mon Sep 17 00:00:00 2001 From: actionless Date: Thu, 23 Apr 2020 08:29:27 +0200 Subject: [PATCH 5/5] test(examples: awful: placement: skip_fullscreen): cover non-fullscreen clients --- .../skip_fullscreen-no_fullscreen.lua | 25 +++++++++++++++++++ .../skip_fullscreen-no_fullscreen.output.txt | 6 +++++ 2 files changed, 31 insertions(+) create mode 100644 tests/examples/awful/placement/skip_fullscreen-no_fullscreen.lua create mode 100644 tests/examples/awful/placement/skip_fullscreen-no_fullscreen.output.txt diff --git a/tests/examples/awful/placement/skip_fullscreen-no_fullscreen.lua b/tests/examples/awful/placement/skip_fullscreen-no_fullscreen.lua new file mode 100644 index 00000000..7207f460 --- /dev/null +++ b/tests/examples/awful/placement/skip_fullscreen-no_fullscreen.lua @@ -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 diff --git a/tests/examples/awful/placement/skip_fullscreen-no_fullscreen.output.txt b/tests/examples/awful/placement/skip_fullscreen-no_fullscreen.output.txt new file mode 100644 index 00000000..432b85aa --- /dev/null +++ b/tests/examples/awful/placement/skip_fullscreen-no_fullscreen.output.txt @@ -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