From d266309ef8b466c3b1c4b26f66d4093dfd8f1f56 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Mon, 12 Nov 2018 11:26:16 +0300 Subject: [PATCH 1/3] awful.client: Fix c.requests_no_titlebar The property was always false because of a typo. Signed-off-by: Sergey Vlasov --- lib/awful/client.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/awful/client.lua b/lib/awful/client.lua index f75270cfa..28d66a927 100644 --- a/lib/awful/client.lua +++ b/lib/awful/client.lua @@ -1144,7 +1144,7 @@ function client.object.get_requests_no_titlebar(c) local hints = c.motif_wm_hints if not hints then return false end - local decor = hints.deocrations + local decor = hints.decorations if not decor then return false end local result = not decor.title From d17433f6c9cfa1add62fc4bc3a99be150477af54 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Mon, 12 Nov 2018 11:19:24 +0300 Subject: [PATCH 2/3] tests: Add test for Motif titlebar hints Test the c.requests_no_titlebar and titlebars_enabled=function... features. Signed-off-by: Sergey Vlasov --- tests/test-titlebar.lua | 72 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 2 deletions(-) diff --git a/tests/test-titlebar.lua b/tests/test-titlebar.lua index 38dd64135..869d8eab7 100644 --- a/tests/test-titlebar.lua +++ b/tests/test-titlebar.lua @@ -3,10 +3,11 @@ local titlebar = require("awful.titlebar") local rules = require("awful.rules") local spawn = require("awful.spawn") -local tiny_client = {"lua", "-e", [[ +local tiny_client_code_template = [[ local Gtk, class = require('lgi').require('Gtk'), 'client' Gtk.init() window = Gtk.Window {default_width=100, default_height=100, title='title'} +%s window:set_wmclass(class, class) local app = Gtk.Application {} function app:on_activate() @@ -14,7 +15,13 @@ function app:on_activate() window:show_all() end app:run {''} -]]} +]] +local tiny_client = {"lua", "-e", string.format(tiny_client_code_template, "")} +local tiny_client_undecorated = {"lua", "-e", + string.format(tiny_client_code_template, [[ +window.decorated = false +]]) +} -- Use the test client props rules.rules = {} @@ -85,6 +92,67 @@ local steps = { c:kill() + return true + end, + function() + if #client.get() ~= 0 then return end + + spawn(tiny_client_undecorated, {titlebars_enabled=true}) + + return true + end, + function() + if #client.get() ~= 1 then return end + + local c = client.get()[1] + + assert(c.width == 100 and c.height > 100) + assert(c._request_titlebars_called) + + c:kill() + + return true + end, + function() + if #client.get() ~= 0 then return end + + spawn(tiny_client, {titlebars_enabled=function(c) + return not c.requests_no_titlebar + end}) + + return true + end, + function() + if #client.get() ~= 1 then return end + + local c = client.get()[1] + + assert(c.width == 100 and c.height > 100) + assert(c._request_titlebars_called) + + c:kill() + + return true + end, + function() + if #client.get() ~= 0 then return end + + spawn(tiny_client_undecorated, {titlebars_enabled=function(c) + return not c.requests_no_titlebar + end}) + + return true + end, + function() + if #client.get() ~= 1 then return end + + local c = client.get()[1] + + assert(not c._request_titlebars_called) + assert(c.width == 100 and c.height == 100) + + c:kill() + return true end, } From f0878941ab5ec9c709a419c5ddf14e36f23c7cbb Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Mon, 12 Nov 2018 11:28:50 +0300 Subject: [PATCH 3/3] doc: Fix c.requests_no_titlebar example Signed-off-by: Sergey Vlasov --- docs/05-awesomerc.md.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/05-awesomerc.md.lua b/docs/05-awesomerc.md.lua index 674a364b3..cfe52015a 100644 --- a/docs/05-awesomerc.md.lua +++ b/docs/05-awesomerc.md.lua @@ -221,7 +221,7 @@ sections.DOC_TITLEBARS = [[ sections.DOC_CSD_TITLEBARS = [[ For client side decorations, clients might request no titlebars via Motif WM hints. To honor these hints, use: - `titlebars_enabled = function(c) return c.requests_no_titlebar end` + `titlebars_enabled = function(c) return not c.requests_no_titlebar end` See `client.requests_no_titlebar` for more details. ]]