On 23.02.2014 20:14, Elv1313 . wrote:
> Good points, but what about allowing a few types (number, string, boolean)
> to be read using methods like client:read_xprop_number("NAME") and allowing
> awesome to create/write new ones ones only in the AWESOME_NAQUADAH
> namespace? like client:write_xprop_number("COUNT",1000) ->
> AWESOME_NAQUADAH_COUNT ?

Not really symmetric. When I write something out with
:write_xprop_number("COUNT", 1000), I would need to know awesome's magic prefix
for reading it again. But I do like the underlying idea a lot.

So some thoughts about this:

We can just drop the "_number" from the method name. The C API can work with
number/strings/boolean in the same function and lua will have to be able to do
the same (after all, there is type()). That gets down the number of functions
needed by a factor of 3.

Then we likely also need some signals for this, so that things can know when
some property changed. However, this isn't really possible right now, because we
have to add signals before they can be used and this new API would allow quite
arbitrary signals. (Oh and the C code for implementing classes doesn't really
like dynamically added functions either)

So... uhm... require lua to register which properties it wants to use, like we
have add_signal() and connect_signal() right now? When such a property is
registered, its type could also be given.

That should make it possible to also add signals for all of this.

The final API could be something like this (I do not like the naming at all and
I still hope that someone can come up with better names for this):

-- ugly hack to read .name
-- Possible types are "string", "boolean" and "number", mapping to UTF8_STRING,
AWESOME_NAQUADAH_BOOLEAN and CARDINAL (hm... only UTF8_STRING really fits. There
are no boolean properties so far in X11 and CARDINAL is a non-negative integer
while lua's numbers are floating points... Do we really want more than just
strings?)
client.add_xproperty("_NET_WM_NAME", "string")
c:connect_signal("xproperty::_NET_WM_NAME", function() print("Oh?") end)
client.set_xproperty(c, "_NET_WM_NAME", "WMs must not set _NET_WM_NAME")
print(client.get_xproperty(c, "_NET_WM_NAME"))

> This feel like evil magic, and it is, but so is adding a single BLOB
> property. The use case your patch try to allow cannot be fixed using a
> single BLOB. I understand X11 is fragile, but do we really have a choice
> here?

Hm, yeah...

> On 23 February 2014 13:59, Uli Schlachter <psyc...@znc.in> wrote:
[...]

Cheers,
Uli

who is just thinking out loud right now
-- 
Happiness can't be found -- it finds you.
 - Majic

-- 
To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.

Reply via email to