[kupfer: 3/53] windows: Show number of windows on workspace in description
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer: 3/53] windows: Show number of windows on workspace in description
- Date: Thu, 24 Mar 2011 16:30:48 +0000 (UTC)
commit 7933c6705af65f34ca84130eddffccf375136ca7
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Thu Mar 24 17:22:32 2011 +0100
windows: Show number of windows on workspace in description
kupfer/plugin/windows.py | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/kupfer/plugin/windows.py b/kupfer/plugin/windows.py
index 37e1470..242ff2d 100644
--- a/kupfer/plugin/windows.py
+++ b/kupfer/plugin/windows.py
@@ -243,9 +243,17 @@ class Workspace (Leaf):
def get_description(self):
screen = wnck.screen_get_default()
if screen:
- wspc = screen.get_active_workspace()
- if wspc == self.object:
- return _("Active workspace")
+ n_windows = sum([1 for w in screen.get_windows()
+ if w.get_workspace() == self.object])
+
+ w_msg = (ngettext("%d window", "%d windows", n_windows) % n_windows)
+
+ active_wspc = screen.get_active_workspace()
+ if active_wspc == self.object:
+ return _("Active workspace") + " (%s)" % w_msg
+ if n_windows:
+ return u"(%s)" % w_msg
+ return None
class ActivateWorkspace (Action):
rank_adjust = 5
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]