Add c.requests_to_titlebar

This property is based on Motif WM hints and checks if the client
requests that it is not decorated with a titlebar.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2018-08-22 13:23:20 +02:00
parent 48d4a31b17
commit fa1728d749
1 changed files with 32 additions and 0 deletions

View File

@ -1040,6 +1040,38 @@ function client.dockable.set(c, value)
client.property.set(c, "dockable", value)
end
--- If the client requests not to be decorated with a titlebar.
--
-- The motif wm hints allow a client to request not to be decorated by the WM in
-- various ways. This property uses the motif MWM_DECOR_TITLE hint and
-- interprets it as the client (not) wanting a titlebar.
--
-- **Signal:**
--
-- * *property::requests_no_titlebar*
--
-- @property requests_no_titlebar
-- @param boolean Whether the client requests not to get a titlebar
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
if not decor then return false end
local result = not decor.title
if decor.all then
-- The "all" bit inverts the meaning of the other bits
result = not result
end
return result
end
capi.client.connect_signal("property::motif_wm_hints", function(c)
-- We cannot be sure that the property actually changes, but whatever
c:emit_signal("property::requests_no_titlebar")
end)
--- Get a client property.
--
-- This method is deprecated. It is now possible to use `c.value` directly.