Repository: qtile/qtile

Issue:
Blender window cannot be focused by click.
# Issue description
Since 532dc72f5ce76eb2c7d3d5e97902df7c3feb7f1c Blender(any version) window cannot be focused with a mouse.

# Qtile version
7f2439a0aafb5f1109acf06684c9968853528c67

# Configuration
Tested with default config.py and **follow_mouse_focus = False**


Discussion:
Does focus work fine with mouse movement when `follow_mouse_focus` is True?

On 201226 12:55, leschalu wrote:
># Issue description
>Since 532dc72f5ce76eb2c7d3d5e97902df7c3feb7f1c Blender(any version) window cannot be focused with a mouse.
>
># Qtile version
>7f2439a0aafb5f1109acf06684c9968853528c67
>
># Configuration
>Tested with default config.py and **follow_mouse_focus = False**
>
>-- 
>You are receiving this because you are subscribed to this thread.
>Reply to this email directly or view it on GitHub:
>https://github.com/qtile/qtile/issues/2044

> Does focus work fine with mouse movement when `follow_mouse_focus` is True?
> […](#)
> On 201226 12:55, leschalu wrote: # Issue description Since [532dc72](https://github.com/qtile/qtile/commit/532dc72f5ce76eb2c7d3d5e97902df7c3feb7f1c) Blender(any version) window cannot be focused with a mouse. # Qtile version [7f2439a](https://github.com/qtile/qtile/commit/7f2439a0aafb5f1109acf06684c9968853528c67) # Configuration Tested with default config.py and **follow_mouse_focus = False** -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: #2044

Yes with **follow_mouse_focus = True** works as expected.
This should fix it:
```
diff --git a/libqtile/core/manager.py b/libqtile/core/manager.py
index 68211692..b6c15af2 100644
--- a/libqtile/core/manager.py
+++ b/libqtile/core/manager.py
@@ -749,8 +749,8 @@ class Qtile(CommandObject):
             try:
                 if window.group.screen is not self.current_screen:
                     self.focus_screen(window.group.screen.index, warp=False)
-                    self.current_group.focus(window, False)
-                    window.focus(False)
+                self.current_group.focus(window, False)
+                window.focus(False)
             except AttributeError:
                 # probably clicked an internal window
                 screen = self.find_screen(e.root_x, e.root_y)
```
Can you confirm? Looks like I made a mistake in the indentation of these lines.

If all good, I'll add some better testing to ensure this kind of thing happens again.

Resolving patch:
diff --git a/libqtile/core/manager.py b/libqtile/core/manager.py
--- a/libqtile/core/manager.py
+++ b/libqtile/core/manager.py
@@ -749,8 +749,8 @@ def _focus_by_click(self, e):
             try:
                 if window.group.screen is not self.current_screen:
                     self.focus_screen(window.group.screen.index, warp=False)
-                    self.current_group.focus(window, False)
-                    window.focus(False)
+                self.current_group.focus(window, False)
+                window.focus(False)
             except AttributeError:
                 # probably clicked an internal window
                 screen = self.find_screen(e.root_x, e.root_y)


Test patch: