At 1250603801 time_t, Gregor Best wrote: > after being inspired by Knirch on #awesome, I wrote a patch to > awful.client which implemented client annotations. These are little > strings stored in a table with clients as the keys. Once a client gets > focused, naughty is used to display the string associated with that > client. I added a prompt to the default rc.lua which can be used to > change the annotation of the focused client. The relevant functions are:
Did I say how it's a nice feature? :)
> diff --git a/awesomerc.lua.in b/awesomerc.lua.in
> index 459f50b..b0c1a74 100644
> --- a/awesomerc.lua.in
> +++ b/awesomerc.lua.in
> @@ -251,17 +251,27 @@ globalkeys = awful.util.table.join(
> mypromptbox[mouse.screen].widget,
> awful.util.eval, nil,
> awful.util.getdir("cache") .. "/history_eval")
> + end),
> +
> + -- Client annotation prompt
> + awful.key({ modkey }, "n",
> + function ()
> + awful.prompt.run({ prompt = "Annotate current client: " },
> + mypromptbox[mouse.screen].widget,
> + awful.client.annotation.set, nil,
> + awful.util.getdir("cache") .. "/history_annotate")
> end)
> )
>
> -- Client awful tagging: this is useful to tag some clients and then do
> stuff like move to tag on them
> clientkeys = awful.util.table.join(
> - awful.key({ modkey, }, "f", function (c) c.fullscreen =
> not c.fullscreen end),
> - awful.key({ modkey, "Shift" }, "c", function (c) c:kill()
> end),
> - awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle
> ),
> - awful.key({ modkey, "Control" }, "Return", function (c)
> c:swap(awful.client.getmaster()) end),
> - awful.key({ modkey, }, "o", awful.client.movetoscreen
> ),
> - awful.key({ modkey, "Shift" }, "r", function (c) c:redraw()
> end),
> + awful.key({ modkey, "Shift" }, "n", function (c)
> awful.client.annotation.display(c) end),
> + awful.key({ modkey, }, "f", function (c) c.fullscreen =
> not c.fullscreen end),
> + awful.key({ modkey, "Shift" }, "c", function (c) c:kill()
> end),
> + awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle
> ),
> + awful.key({ modkey, "Control" }, "Return", function (c)
> c:swap(awful.client.getmaster()) end),
> + awful.key({ modkey, }, "o", awful.client.movetoscreen
> ),
> + awful.key({ modkey, "Shift" }, "r", function (c) c:redraw()
> end),
> awful.key({ modkey,}, "m",
> function (c)
> c.maximized_horizontal = not c.maximized_horizontal
Please update documentation accordingly.
> diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in
> index 4f97f9e..c1aab7b 100644
> --- a/lib/awful/client.lua.in
> +++ b/lib/awful/client.lua.in
> @@ -7,6 +7,7 @@
> -- Grab environment we need
> local util = require("awful.util")
> local tag = require("awful.tag")
> +local naughty = require("naughty")
Humpf, that's rought. If we start depending on naughty, it's gonna be a
bit messy around. awful is already big enough. :|
> +function annotation.display(c)
> + c = c or capi.client.focus
> + if not data.annotation[c] then return end
> + naughty.notify({ text = data.annotation[c], screen = c.screen })
Well, the function that notify should be a 2nd argument IMHO, not a call
to naughty.
Rest is perfect.
Cheers,
--
Julien Danjou
// ᐰ <[email protected]> http://julien.danjou.info
// 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD
// This is the end of my signature.
signature.asc
Description: Digital signature
