I am using a clipboard manager and I would like to see it appear just under the mouse when I press a shortcut key.

I have written different rules for awesome wm, I see how to focus the good client, how to make it floating, how to make it appear at a fixed position..

I found this entry in the Awesome FAQ.

However, I don't see how to use this tip to create a rule.

Any hints ?

2 Answers 2


For global use by keyword

at the end of your rc.lua you have the function client.add_signal(... , inside this function you have to set the last line of the FAQ, to enable it for only particular applications I included a new variable at the beginning of rc.lua `

local undermouse = false

than the part of the FAQ:

client.add_signal("manage", function (c, startup)
    -- Add a titlebar
    -- awful.titlebar.add(c, { modkey = modkey })

    -- Enable sloppy focus
    c:add_signal("mouse::enter", function(c)
        if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
        and awful.client.focus.filter(c) then
            client.focus = c

    if not startup then
        -- Set the windows at the slave,
        -- i.e. put it at the end of others instead of setting it master.
        -- awful.client.setslave(c)

        -- Put windows in a smart way, only if they does not set an initial position.
        if not c.size_hints.user_position and not c.size_hints.program_position then
=>          if underMouse == true then
=>              awful.placement.under_mouse(c)
=>              underMouse = false
=>          end

to use this option I created the next code for my calculater key:

globalkeys = awful.util.table.join(
    awful.key({                   }, "#148", function () 
        underMouse = true 

As a rule for 1 application

as found by yourself after testing my solution, but added to this answer for use for other people:

{ rule = { class = "Gnome-calculator",  },
    properties = { 
        floating = true,
        callback = function(c) awful.placement.under_mouse(c) end,
  • @mperrin the down vote (not by me) is probably because I gave the solution and you give the solved at yourself for an answer that should be a comment to my answer. Jul 30, 2015 at 13:59
  • 1
    Ok, sorry for that, pretty new here. Your answer helped me a lot, but I thought that it didn't answer clearly to the question which was "how to write a rule...", that's why I didn't mark your answer as the accepted solution, but give it a up vote.
    – mperrin
    Jul 30, 2015 at 18:16

Many thanks for your answer, and the highlight of the awful.placement.under_mouse(c) function.

Finally, writing the rule was really easy :

 { rule = { class = "Gnome-calculator",  },
    properties = { 
        floating = true,
        callback = function(c) awful.placement.under_mouse(c) end,
  • Don't understand why this has been down voted.
    – mperrin
    Jul 30, 2015 at 13:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .