4

I have instance of the client which should be focused. I found only following ways to give focus to client:

  • focus.bydirection (dir, c) - Focus a client by the given direction.
  • focus.byidx (i, c) - Focus a client by its relative index.
  • focus.filter (c) - Filter out window that we do not want handled by
  • focus. focus.history.add (c) - Update client focus history.
  • focus.history.delete (c) - Remove a client from the focus history.
  • focus.history.get (screen, idx) - Get the latest focused client for a
  • screen in history. focus.history.previous () - Focus the previous client in history.

But how to focus a client if I already have an instance?

Shmygol
  • 913
  • 7
  • 16

1 Answers1

6

You should try:

client.focus = c
c:raise()

c is the client which you want to focus.

uzsolt
  • 5,832
  • 2
  • 20
  • 32
  • Thanks! It worked. Want to add one thing, which confused me. If you write a module, you have to duplicate all functions from the global namespace to the current one. Like `local client = client` or `local capi = {client = client, mouse = mouse, screen = screen, }` – Shmygol Aug 31 '12 at 02:49
  • (just start to use `awesome`) what's `client.focus`? Is it a global var? I can't find it in the `awesome` API – RNA Aug 21 '13 at 04:02
  • Check: http://awesome.naquadah.org/doc/api/modules/client.html - focus: The focused client. – uzsolt Aug 21 '13 at 07:47
  • @Shmygol Wanted to understand the reason why we have to duplicate all functions from the global to current? – Madhur Ahuja Jan 06 '23 at 04:24