Hi,
On 02.12.2013 22:18, Stanislav Ochotnicky wrote:
> First my use case (perhaps someone will suggest a different way to deal with
> this):
> I use dynamic tagging facilities in awesome (and tyrranical). I have
> configuration for most applications that I use but I often connect to several
> hosts and for each I create a separate tag so that I don't mess up.
>
> Now the issue is that when I disconnect my laptop from docking station,
> awesome
> restarts due to XRandR change and all the consoles and apps without specific
> rules end up on the first tag.
>
> I came up with a possible solution:
> * For each client awesome would set custom X property[1]
> * On restart awesome would look at that custom property and it would
> override whatever rules were configured
>
> There are possible caveats but I'd say this might still be useful.
>
> Is this perhaps something that someone else has already implemented? Couldn't
> find anything in the archives. Ideally this would be done in the library code,
> but as PoC I might just do a custom configuration
>
> [1] xprop -f WM_AWESOME_TAGS 8s -set WM_AWESOME_TAGS tag1,tag2
Such a property (almost) already exists and is called _NET_WM_DESKTOP. It is
used for saving the first (and only the first, this is the "almost" part) tag
that a client is attached to (mostly because EWMH demands this).
After parsing the config, the C code goes through all already-existing clients
and manages them (thus creates client objects for them and call the manage
signal). Before emiting the manage hook, the C code checks if the client has the
_NET_WM_DESKTOP property set and tags it with the appropriate tag. This is done
in the following C code:
reply = xcb_get_property_reply(globalconf.connection, c0, NULL);
if(reply && reply->value_len && (data = xcb_get_property_value(reply)))
{
desktop = *(uint32_t *) data;
if(desktop == -1)
c->sticky = true;
else if (desktop >= 0 && desktop < globalconf.tags.len)
for(int i = 0; i < globalconf.tags.len; i++)
if(desktop == i)
{
luaA_object_push(globalconf.L, globalconf.tags.tab[i]);
tag_client(c);
}
else
untag_client(c, globalconf.tags.tab[i]);
else
/* Value out of bounds, just give it the first tag */
if (globalconf.tags.len > 0)
{
luaA_object_push(globalconf.L, globalconf.tags.tab[0]);
tag_client(c);
}
}
This does work with the default config. Now why doesn't it work with your
config?
> I use dynamic tagging facilities in awesome (and tyrranical).
After your config was parsed, there is only a single tag (at least I guess so).
Thus, the above code cannot tag the client appropriately.
I hope this clears up the current state. Feel free to come up with suggestions
on how to improve this.
Cheers,
Uli
--
A normal person is just someone you don't know well enough yet.
- Nettie Wiebe
--
To unsubscribe, send mail to [email protected].