# Calculate format=diff
diff --git a/plugin-desktopswitch/desktopswitch.cpp b/plugin-desktopswitch/desktopswitch.cpp
index bba5f7a..ad9cceb 100644
--- a/plugin-desktopswitch/desktopswitch.cpp
+++ b/plugin-desktopswitch/desktopswitch.cpp
@@ -111,6 +111,7 @@ void DesktopSwitch::shortcutRegistered()
 
 void DesktopSwitch::onWindowChanged(WId id, NET::Properties properties, NET::Properties2 properties2)
 {
+    DesktopSwitchButton *button = NULL;
     if (properties.testFlag(NET::WMState) && isWindowHighlightable(id))
     {
         KWindowInfo info = KWindowInfo(id, NET::WMDesktop | NET::WMState);
@@ -119,9 +120,25 @@ void DesktopSwitch::onWindowChanged(WId id, NET::Properties properties, NET::Pro
             return;
         else
         {
-            DesktopSwitchButton *button = static_cast<DesktopSwitchButton *>(m_buttons->button(desktop - 1));
-            if(button)
-                button->setUrgencyHint(id, info.hasState(NET::DemandsAttention));
+            if(info.hasState(NET::DemandsAttention))
+            {
+                button = static_cast<DesktopSwitchButton *>(m_buttons->button(desktop - 1));
+                if(button)
+                    button->setUrgencyHint(id, true);
+            }
+            else
+            {
+                int i = 0;
+                const int current_cnt = m_buttons->buttons().count();
+                const int border = qMin(current_cnt, m_desktopCount);
+                // drop urgency for window from all desktops
+                for ( ; i < border; ++i)
+                {
+                    button = static_cast<DesktopSwitchButton *>(m_buttons->button(i));
+                    if(button)
+                        button->setUrgencyHint(id, false);
+                }
+            }
         }
     }
 }
