Skip to content

Commit

Permalink
Redraw bar on current_screen_change
Browse files Browse the repository at this point in the history
Closes #452
  • Loading branch information
tych0 committed Jul 29, 2014
1 parent a19a1af commit 5c913fc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions libqtile/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ def restart_on_randr(qtile, ev):
"""
return self._subscribe("screen_change", func)

def current_screen_change(self, func):
"""
Called when the current screen (i.e. the screen with focus)
changes; no arguments.
"""
return self._subscribe("current_screen_change", func)

subscribe = Subscribe()


Expand Down
5 changes: 4 additions & 1 deletion libqtile/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,11 @@ def toScreen(self, n):
"""
if len(self.screens) < n - 1:
return
old = self.currentScreen
self.currentScreen = self.screens[n]
self.currentGroup.focus(self.currentWindow, True)
if old != self.currentScreen:
hook.fire("current_screen_change")
self.currentGroup.focus(self.currentWindow, True)

def moveToGroup(self, group):
"""
Expand Down
1 change: 1 addition & 0 deletions libqtile/widget/groupbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def hook_response(*args, **kwargs):
hook.subscribe.client_killed(hook_response)
hook.subscribe.setgroup(hook_response)
hook.subscribe.group_window_add(hook_response)
hook.subscribe.current_screen_change(hook_response)

def drawbox(self, offset, text, bordercolor, textcolor, rounded=False,
block=False, width=None):
Expand Down

0 comments on commit 5c913fc

Please sign in to comment.