X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=scripts%2Ffocus.py;h=e9a974b5f0ebd1da395ef583fce81a8c6c966e51;hb=6e2f3f9f8a2b4b83648c9c8b9993d321b3f60a79;hp=5e7c0d28dbdf900b65053c70b11654c915167562;hpb=cb5eb0d560759cebce3279cb28d942166e0e9a7a;p=chaz%2Fopenbox diff --git a/scripts/focus.py b/scripts/focus.py index 5e7c0d28..e9a974b5 100644 --- a/scripts/focus.py +++ b/scripts/focus.py @@ -53,7 +53,9 @@ def _focused(data): if data.client: # move it to the top - _remove(data.client) + try: + _remove(data.client) + except ValueError: pass # happens if _focused comes before _newwindow _clients.insert(0, data.client) elif FALLBACK: # pass around focus @@ -63,6 +65,11 @@ def _focused(data): break def _newwindow(data): + # make sure its not already in the list + win = data.client.window() + for i in range(len(_clients)): + if _clients[i].window() == win: + return _clients.append(data.client) def _closewindow(data):