7

I have two monitors. How can I focus on a window that is on a different screen than the one I'm working on?

Mod+j/h works only for one monitor.

fixer1234
  • 28,064
Sytrix
  • 71

2 Answers2

13

awesome refers to different monitors as screens just as you do. Check the man page for commands mentioning screen. Here are some helpful ones:

  1. Mod4 + Control + j focus next screen

    • this moves your cursor from one screen to another. it changes the focus from a client window on one screen to a client window on the next screen.
  2. Mod4 + o send client to next screen

    • this moves a client window to the next screen!

So to answer your question, you will probably need to first Mod4 + Control + j to the next screen, and then Mod4 + j through the clients on that screen/tag until the one you want is in focus.

apoh
  • 131
1

You can also configure the keys in .config/awesome/rc.lua.

The default binding Mod4 + o only moves a client to the screen on the right. You can also add a keybinding to move to the left.

In the following example, I mapped Mod4 + Control + [j|k] to move the focus to the screen left/right. And if you also hold down the Shift key then it also moves the currently focused window along with it.

globalkeys = gears.table.join(
-- ...

awful.key({ modkey, "Control" }, "j",
            function () awful.screen.focus_relative( 1) end,
            {description = "focus the next screen", group = "screen"}),


awful.key({ modkey, "Control" }, "k",
            function () awful.screen.focus_relative(-1) end,
            {description = "focus the previous screen", group = "screen"}),

-- ...

)

clientkeys = gears.table.join(

-- ...

awful.key({ modkey, "Control", "Shift" }, "k",
            function (c) c:move_to_screen(c.screen.index - 1) end,
            {description = "move to screen left", group = "client"}),

awful.key({ modkey, "Control", "Shift" }, "j",
            function (c) c:move_to_screen(c.screen.index + 1) end,
            {description = "move to screen right", group = "client"}),

-- ...

)

gitaarik
  • 720
  • 8
  • 19