Hi, On 10.06.2014 14:51, Markus Fuchs wrote: > I tried to extend the scratchdrop module by Lucas de Vries such that > the given clients keep their "scratchdrop properties" after awesome is > restarted. You can find the code here: > > https://gist.github.com/fixje/4a1ef48cbbfe5ba6e070 > > With scratchdrop you can assign keys which toggle the visibility of > certain programs that do not show up as managed clients in awesome. > The list of clients managed by the scratchdrop module is stored in a > variable which is re-initialized after awesome is restarted. To > circumvent this issue, I put the necessary values into custom X > properties and re-assign them: > > awesome.register_xproperty("AWESOME_SCRATCHTOP_VERT", "string") > awesome.register_xproperty("AWESOME_SCRATCHTOP_HORIZ", "string") > awesome.register_xproperty("AWESOME_SCRATCHTOP_WIDTH", "string") > awesome.register_xproperty("AWESOME_SCRATCHTOP_HEIGHT", "string") > awesome.register_xproperty("AWESOME_SCRATCHTOP_STICKY", "boolean") > awesome.register_xproperty("AWESOME_SCRATCHTOP_SCREEN", "string") > awesome.register_xproperty("AWESOME_SCRATCHTOP_PROG", "string") > > function scratchdrop.restore() > for k, c in pairs(client.get()) do > if c:get_xproperty("AWESOME_SCRATCHTOP_VERT") ~= "" then > local vert = c:get_xproperty("AWESOME_SCRATCHTOP_VERT") > local horiz = c:get_xproperty("AWESOME_SCRATCHTOP_HORIZ") > local width = c:get_xproperty("AWESOME_SCRATCHTOP_WIDTH") > local height = c:get_xproperty("AWESOME_SCRATCHTOP_HEIGHT") > local sticky = c:get_xproperty("AWESOME_SCRATCHTOP_STICKY") > local screen = c:get_xproperty("AWESOME_SCRATCHTOP_SCREEN") > local prog = c:get_xproperty("AWESOME_SCRATCHTOP_PROG") > width = tonumber(width) > height = tonumber(height) > screen = tonumber(screen) > set_client_properties(c, vert, horiz, width, height, > sticky, screen, prog) > > if not dropdown[prog] then > dropdown[prog] = {} > end > dropdown[prog][screen] = c > > c.hidden = true > local ctags = c:tags() > for i, t in pairs(ctags) do > ctags[i] = nil > end > c:tags(ctags) > end > end > end > > > The problem arises when I try to call scratchdrop.restore() from > rc.lua. I tried to place it at the end of the config, but client > attributed are not restored at all. On the other hand, I can just call > the function from the awesome lua prompt after a successful restart > and it works as I expect. > Is there something I missed out from the startup process?
Step 1: Parse the config Step 2: Start managing pre-existing clients (So client.get() will just give you an empty table during step 1) Step 3: Profit. So you might want to replace scratchdrop.restore with a function that gets a client as its argument and connect this function to the manage signal. Cheers, Uli -- "Because I'm in pain," he says. "That's the only way I get your attention." He picks up the box. "Don't worry, Katniss. It'll pass." He leaves before I can answer. -- To unsubscribe, send mail to [email protected].
