all repos — fluxbox @ a9103a89cbcfc553617888fd16df4349e1097d77

custom fork of the fluxbox windowmanager

remember role too by default
simonb simonb
commit

a9103a89cbcfc553617888fd16df4349e1097d77

parent

2006d20d45eaa091c737067004ec7421a0cfc730

2 files changed, 21 insertions(+), 16 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,9 +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) + * When saving window info for rememberm use class name AND instance name, + AND role if present. (Simon) + - This should fix firefox/thunderbird issues, but note that mplayer + (nogui) sets the vo driver name as the instance name. Remember.cc * Fix menu heading encoding (Simon) sf.net bug #1712583: NLS:Non-latin characters displayed incorrectly in menu title
M src/Remember.ccsrc/Remember.cc

@@ -76,6 +76,18 @@

namespace { +// replace special chars like ( ) and [ ] with \( \) and \[ \] +static string escapeRememberChars(string str) { + if (str.empty()) + return str; + + str = FbTk::StringUtil::replaceString(str, "(", "\\("); + str = FbTk::StringUtil::replaceString(str, ")", "\\)"); + str = FbTk::StringUtil::replaceString(str, "[", "\\["); + str = FbTk::StringUtil::replaceString(str, "]", "\\]"); + return str; +} + bool getuint(const char *val, unsigned int &ret) { return (sscanf(val, "%u", &ret) == 1); }

@@ -319,22 +331,14 @@ ClientPattern *p = new ClientPattern();

Application *app = new Application(0); // 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, "]", "\\]"); + string win_name = ::escapeRememberChars(p->getProperty(ClientPattern::NAME, winclient)); + string win_class = ::escapeRememberChars(p->getProperty(ClientPattern::CLASS, winclient)); + string win_role = ::escapeRememberChars(p->getProperty(ClientPattern::ROLE, winclient)); p->addTerm(win_name, ClientPattern::NAME); p->addTerm(win_class, ClientPattern::CLASS); + if (!win_role.empty()) + p->addTerm(win_role, ClientPattern::ROLE); m_clients[&winclient] = app; p->addMatch(); m_pats->push_back(make_pair(p, app));