From 2006d20d45eaa091c737067004ec7421a0cfc730 Mon Sep 17 00:00:00 2001
From: simonb <simonb>
Date: Sun, 5 Aug 2007 03:10:04 +0000
Subject: remember on the class AND instance name by default

---
 ChangeLog       | 4 ++++
 src/Remember.cc | 9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 59314be..6222d3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
  (Format: Year/Month/Day)
 Changes for 1.0.0:
 *07/08/05:
+   * When saving window info for rememberm use class name AND instance name.
+     This should fix firefox/thunderbird issues, but note that mplayer (nogui)
+     sets the vo driver name as the instance name. (Simon)
+     Remember.cc
    * Fix menu heading encoding (Simon) 
      sf.net bug #1712583: NLS:Non-latin characters displayed incorrectly in menu title
      MenuCreator.cc
diff --git a/src/Remember.cc b/src/Remember.cc
index aec9921..31b416a 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -318,15 +318,22 @@ Application * Remember::add(WinClient &winclient) {
     ClientPattern *p = new ClientPattern();
     Application *app = new Application(0);
 
-    // by default, we match against the WMClass of a window.
+    // by default, we match against the WMClass of a window (instance and class strings)
+    string win_name  = p->getProperty(ClientPattern::NAME,  winclient);
     string win_class = p->getProperty(ClientPattern::CLASS, winclient);
 
     // replace special chars like ( ) and [ ] with \( \) and \[ \]
+    win_name = FbTk::StringUtil::replaceString(win_name, "(", "\\(");
+    win_name = FbTk::StringUtil::replaceString(win_name, ")", "\\)");
+    win_name = FbTk::StringUtil::replaceString(win_name, "[", "\\[");
+    win_name = FbTk::StringUtil::replaceString(win_name, "]", "\\]");
+
     win_class = FbTk::StringUtil::replaceString(win_class, "(", "\\(");
     win_class = FbTk::StringUtil::replaceString(win_class, ")", "\\)");
     win_class = FbTk::StringUtil::replaceString(win_class, "[", "\\[");
     win_class = FbTk::StringUtil::replaceString(win_class, "]", "\\]");
 
+    p->addTerm(win_name,  ClientPattern::NAME);
     p->addTerm(win_class, ClientPattern::CLASS);
     m_clients[&winclient] = app;
     p->addMatch();
-- 
cgit v0.11.2