summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsimonb <simonb>2007-08-05 03:20:38 (GMT)
committersimonb <simonb>2007-08-05 03:20:38 (GMT)
commita9103a89cbcfc553617888fd16df4349e1097d77 (patch)
tree646453cbd3cdf4eb162053584a77c15473ad2946 /src
parent2006d20d45eaa091c737067004ec7421a0cfc730 (diff)
downloadfluxbox_lack-a9103a89cbcfc553617888fd16df4349e1097d77.zip
fluxbox_lack-a9103a89cbcfc553617888fd16df4349e1097d77.tar.bz2
remember role too by default
Diffstat (limited to 'src')
-rw-r--r--src/Remember.cc30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/Remember.cc b/src/Remember.cc
index 31b416a..2de6d86 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -76,6 +76,18 @@ using std::dec;
76 76
77namespace { 77namespace {
78 78
79// replace special chars like ( ) and [ ] with \( \) and \[ \]
80static string escapeRememberChars(string str) {
81 if (str.empty())
82 return str;
83
84 str = FbTk::StringUtil::replaceString(str, "(", "\\(");
85 str = FbTk::StringUtil::replaceString(str, ")", "\\)");
86 str = FbTk::StringUtil::replaceString(str, "[", "\\[");
87 str = FbTk::StringUtil::replaceString(str, "]", "\\]");
88 return str;
89}
90
79bool getuint(const char *val, unsigned int &ret) { 91bool getuint(const char *val, unsigned int &ret) {
80 return (sscanf(val, "%u", &ret) == 1); 92 return (sscanf(val, "%u", &ret) == 1);
81} 93}
@@ -319,22 +331,14 @@ Application * Remember::add(WinClient &winclient) {
319 Application *app = new Application(0); 331 Application *app = new Application(0);
320 332
321 // by default, we match against the WMClass of a window (instance and class strings) 333 // by default, we match against the WMClass of a window (instance and class strings)
322 string win_name = p->getProperty(ClientPattern::NAME, winclient); 334 string win_name = ::escapeRememberChars(p->getProperty(ClientPattern::NAME, winclient));
323 string win_class = p->getProperty(ClientPattern::CLASS, winclient); 335 string win_class = ::escapeRememberChars(p->getProperty(ClientPattern::CLASS, winclient));
324 336 string win_role = ::escapeRememberChars(p->getProperty(ClientPattern::ROLE, winclient));
325 // replace special chars like ( ) and [ ] with \( \) and \[ \]
326 win_name = FbTk::StringUtil::replaceString(win_name, "(", "\\(");
327 win_name = FbTk::StringUtil::replaceString(win_name, ")", "\\)");
328 win_name = FbTk::StringUtil::replaceString(win_name, "[", "\\[");
329 win_name = FbTk::StringUtil::replaceString(win_name, "]", "\\]");
330
331 win_class = FbTk::StringUtil::replaceString(win_class, "(", "\\(");
332 win_class = FbTk::StringUtil::replaceString(win_class, ")", "\\)");
333 win_class = FbTk::StringUtil::replaceString(win_class, "[", "\\[");
334 win_class = FbTk::StringUtil::replaceString(win_class, "]", "\\]");
335 337
336 p->addTerm(win_name, ClientPattern::NAME); 338 p->addTerm(win_name, ClientPattern::NAME);
337 p->addTerm(win_class, ClientPattern::CLASS); 339 p->addTerm(win_class, ClientPattern::CLASS);
340 if (!win_role.empty())
341 p->addTerm(win_role, ClientPattern::ROLE);
338 m_clients[&winclient] = app; 342 m_clients[&winclient] = app;
339 p->addMatch(); 343 p->addMatch();
340 m_pats->push_back(make_pair(p, app)); 344 m_pats->push_back(make_pair(p, app));