aboutsummaryrefslogtreecommitdiffhomepage
path: root/freedowm.py
diff options
context:
space:
mode:
authorMarvin Borner2019-05-30 18:46:20 +0200
committerMarvin Borner2019-05-30 18:46:20 +0200
commit23be5d8cb3750d2be955e00505839711eb1aeab4 (patch)
tree4cb7faae5d48edf4f4b24effd89d5677a9c737ad /freedowm.py
parent618f23ec750af85d1ad283fa0b6509b215163d78 (diff)
Fixed border focus spam
Diffstat (limited to 'freedowm.py')
-rw-r--r--freedowm.py29
1 files changed, 10 insertions, 19 deletions
diff --git a/freedowm.py b/freedowm.py
index e59fe11..5a069bb 100644
--- a/freedowm.py
+++ b/freedowm.py
@@ -97,8 +97,6 @@ class FreedoWM(object):
self.tiling_windows[self.monitor_id].append(child)
def update_windows(self):
- new_focus = False
-
# Configure new window
if self.event.type == X.CreateNotify:
if not self.ignore_actions:
@@ -143,31 +141,24 @@ class FreedoWM(object):
if self.window_focused() and not self.ignore_actions:
if hasattr(self.event, "child") and self.event.child != X.NONE \
and self.event.child != self.currently_focused:
- new_focus = True
+ if self.currently_focused is not None:
+ self.log("RESET BORDER")
+ self.set_border(self.currently_focused, self.colors["INACTIVE_BORDER"])
+ self.log("FOCUS BORDER")
self.currently_focused = self.event.child
+ self.set_border(self.currently_focused, self.colors["ACTIVE_BORDER"])
self.currently_focused.configure(stack_mode=X.Above)
self.program_stack_index = self.program_stack.index(self.currently_focused)
elif self.root.query_pointer().child not in (self.currently_focused, X.NONE):
- new_focus = True
+ if self.currently_focused is not None:
+ self.log("RESET BORDER")
+ self.set_border(self.currently_focused, self.colors["INACTIVE_BORDER"])
+ self.log("FOCUS BORDER")
self.currently_focused = self.root.query_pointer().child
+ self.set_border(self.currently_focused, self.colors["ACTIVE_BORDER"])
self.currently_focused.configure(stack_mode=X.Above)
self.program_stack_index = self.program_stack.index(self.currently_focused)
- # Set all windows to un-focused borders
- if self.event.type == X.FocusOut and not self.ignore_actions or new_focus:
- for child in self.root.query_tree().children:
- self.log("RESET BORDERS")
- self.set_border(child, self.colors["INACTIVE_BORDER"])
-
- # Set focused window border
- if self.event.type == X.FocusIn and not self.ignore_actions or new_focus:
- child = self.root.query_pointer().child
- self.currently_focused = child
- if child != 0:
- self.log("FOCUS")
- child.configure(stack_mode=X.Above)
- self.set_border(child, self.colors["ACTIVE_BORDER"])
-
self.display.sync()
# Check for actions until exit