diff --git a/ChangeLog b/ChangeLog index 8f0a6bc3..d754d004 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 1.1 +*08/06/08: + * Add (urgent=yes|no) option to client patterns (Mark) + ClientPattern.cc/hh *08/06/06: * Allow window menu items in ordinary menus (Mark) MenuCreator.cc/hh diff --git a/src/AttentionNoticeHandler.cc b/src/AttentionNoticeHandler.cc index 999b9d4e..26dd4b5c 100644 --- a/src/AttentionNoticeHandler.cc +++ b/src/AttentionNoticeHandler.cc @@ -119,6 +119,11 @@ void AttentionNoticeHandler::update(FbTk::Subject *subj) { } -bool AttentionNoticeHandler::isDemandingAttention(Focusable &client) { - return m_attentions.find(&client) != m_attentions.end(); +bool AttentionNoticeHandler::isDemandingAttention(const Focusable &client) { + NoticeMap::iterator it = m_attentions.begin(), it_end = m_attentions.end(); + for (; it != it_end; ++it) { + if (it->first == &client) + return true; + } + return false; } diff --git a/src/AttentionNoticeHandler.hh b/src/AttentionNoticeHandler.hh index a2ebb23a..3a98b090 100644 --- a/src/AttentionNoticeHandler.hh +++ b/src/AttentionNoticeHandler.hh @@ -47,7 +47,7 @@ public: /// removes the client from the attention map void update(FbTk::Subject *subj); - bool isDemandingAttention(Focusable &client); + bool isDemandingAttention(const Focusable &client); private: NoticeMap m_attentions; diff --git a/src/ClientPattern.cc b/src/ClientPattern.cc index d037bb4e..c08a5746 100644 --- a/src/ClientPattern.cc +++ b/src/ClientPattern.cc @@ -22,6 +22,7 @@ #include "ClientPattern.hh" +#include "fluxbox.hh" #include "FocusControl.hh" #include "Layer.hh" #include "Screen.hh" @@ -132,6 +133,8 @@ ClientPattern::ClientPattern(const char *str, bool default_no_transient): prop = HEAD; } else if (strcasecmp(memstr.c_str(), "layer") == 0) { prop = LAYER; + } else if (strcasecmp(memstr.c_str(), "urgent") == 0) { + prop = URGENT; } else { prop = NAME; expr = match; @@ -244,6 +247,8 @@ string ClientPattern::toString() const { case LAYER: pat.append("layer="); break; + case URGENT: + pat.append("urgent="); } pat.append((*it)->orig); @@ -403,6 +408,10 @@ string ClientPattern::getProperty(WinProperty prop, const Focusable &client) { case LAYER: return fbwin ? ::Layer::getString(fbwin->layerNum()) : ""; break; + case URGENT: + return Fluxbox::instance()->attentionHandler() + .isDemandingAttention(client) ? "yes" : "no"; + break; } return client.getWMClassName(); } diff --git a/src/ClientPattern.hh b/src/ClientPattern.hh index 1e08f35f..1fd2722f 100644 --- a/src/ClientPattern.hh +++ b/src/ClientPattern.hh @@ -53,7 +53,7 @@ public: enum WinProperty { TITLE, CLASS, NAME, ROLE, TRANSIENT, MAXIMIZED, MINIMIZED, SHADED, STUCK, FOCUSHIDDEN, ICONHIDDEN, - WORKSPACE, WORKSPACENAME, HEAD, LAYER + WORKSPACE, WORKSPACENAME, HEAD, LAYER, URGENT }; /// Does this client match this pattern?