Hello,
I have a simple question. How can I get the current (focused) client from a
global key callback?
I searched google (well didn't spend more than 10 minutes because I didn't
have much time, so I guess I will have to waste yours ; ) but anyway I am
on my way to implement a simple and handy feature - something similar to
easymotion vim plugin - I don't know if it is already implemented.
Here is what it should do:
A user will be able to press a global key combination and get a prompt
where he can assign a 'tag' (a string) to the currently focused window.
Then he can do the same thing for another window. Then he can press another
key combination and enter a tag which will select the window that has the
specified tag assigned and it will bring it infront.
This is my first global key definition:
-- set 'switch-to' tag on the focused client
awful.key({ modkey}, "\\", function ()
awful.prompt.run({ prompt = "switch-to tag: ", text =
awful.client.switchtotag, },
mypromptbox[mouse.screen].widget,
function (s)
awful.client.switchtotag = s
end)
end)
The problem with this is that client.switchtotag is a static variable -
available to all clients I guess. I want it to be instance variable -
instance of switchtotag per client. How can I do that?
Currently when I press Win+\ and assign a tag to a terminal, and then do
the same thing for eclipse for example I will change the tag of the
terminal. One thing that comes to my mind is to assign this key shortcut to
a client - not global - but I have the feeling that I will like it more if
it is global. What do you think?
And this is the basic functionality. The next thing that I want to do is
exactly what easymotion does.
I press a key and all opened clients receive a tag (generated in some way -
and very short and easy to type). The user then enters the tag and the
client is focused.
Regards,
/v