all repos — fluxbox @ 4e64d45e1678f525fe20b4a53fb9539a58f18176

custom fork of the fluxbox windowmanager

add [transient] tag to apps file to match transient windows
Mark Tiefenbruck mark@fluxbox.org
commit

4e64d45e1678f525fe20b4a53fb9539a58f18176

parent

e5d43edb8ebd472b680a5b4a96dfa1fcf1ef2260

M ChangeLogChangeLog

@@ -1,5 +1,8 @@

(Format: Year/Month/Day) Changes for 1.1 +*08/08/19: + * Add new [transient] tag to apps file to match transient windows (Mark) + ClientPattern.cc/hh Remember.cc *08/08/18: * Combined code for MoveTo key command and saved window positions (Mark) Side effects:
M doc/asciidoc/fluxbox.1doc/asciidoc/fluxbox.1

@@ -1,11 +1,11 @@

.\" Title: fluxbox .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/> -.\" Date: 08/18/2008 +.\" Date: 08/19/2008 .\" Manual: .\" Source: .\" -.TH "FLUXBOX" "1" "08/18/2008" "" "" +.TH "FLUXBOX" "1" "08/19/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only)

@@ -1213,7 +1213,7 @@ \.\.\.

[end] .fi .RE -Each app\-name can be a string, or a regular expression\. By default the name is matched against a window\'s WM_CLASS property (the first string in it, called the "instance")\. You can match against the title, instance name (default), class name, or role (the WM_WINDOW_ROLE property) by explicitly specifying it\. You can also specify multiple matches, which must ALL match for the properties to be applied\. If a count is supplied in curly brackets at the end of the app line, then the entry will only match at most that many at any time (default is to match all matching windows)\. +Each app\-name can be a string, or a regular expression\. By default the name is matched against a window\'s WM_CLASS property (the first string in it, called the "instance")\. You can match against the title, instance name (default), class name, or role (the WM_WINDOW_ROLE property) by explicitly specifying it\. You can also specify multiple matches, which must ALL match for the properties to be applied\. If a count is supplied in curly brackets at the end of the app line, then the entry will only match at most that many at any time (default is to match all matching windows)\. Settings associated with an [app] line will not be applied to transient windows\. [transient] may be used instead to match them\. .sp .sp .RS 4

@@ -1404,37 +1404,7 @@ [Layer] {4}

[end] .fi .RE -Parameters in the `apps\' file are case\-sensitive\. Application names are taken from the first X window WM_CLASS attribute by default (WM_NAME = title, WM_WINDOW_ROLE = role)\. You can see this attribute by using the xprop command\. Transient windows are not affected by application settings\. Take care when using regular expressions\. If you are not familiar with regular expressions you can disable this feature by specifying \-\-disable\-regexp during configure\. Plain strings will then be matched\. -.sp -.SH "GROUPS" -Since version 0\.1\.11, fluxbox has a feature called autogrouping, that is apps are automatically grouped together if they are in the same group\. NOTE: this feature is deprecated since version 0\.9\.1 in favor of grouping using the `apps\' file, since it is much more powerful\. -.sp -You can create groups simply by editing the ~/\.fluxbox/groups file\. This file takes the format of: -.sp -.sp -.RS 4 -.nf -<app1> <app2> <app3> <\.\.\.> <appN> -.fi -.RE -where elements can be found with this command: -.sp -.sp -.RS 4 -.nf -$> xprop WM_CLASS -.fi -.RE -Just type this command into a terminal and use the mouse to click on the desired app and it will tell you what to write as an element (use the first of the two names returned)\. Each line forms a different group, e\.g\.: -.sp -.sp -.RS 4 -.nf -Navigator nedit -xterm -.fi -.RE -This will create two groups, one with netscape and nedit, and one with xterm\. The new window will only group itself to other windows on the same workspace and to the last window that was focused\. +Parameters in the `apps\' file are case\-sensitive\. Application names are taken from the first X window WM_CLASS attribute by default (WM_NAME = title, WM_WINDOW_ROLE = role)\. You can see this attribute by using the xprop command\. Take care when using regular expressions\. If you are not familiar with regular expressions you can disable this feature by specifying \-\-disable\-regexp during configure\. Plain strings will then be matched\. .sp .SH "THE SLIT" The slit is a special fluxbox window frame that can contain dockable applications, e\.g\. \fIbbtools\fR or \fIwmapps\fR\.
M doc/asciidoc/fluxbox.txtdoc/asciidoc/fluxbox.txt

@@ -1139,7 +1139,8 @@ name, or role (the WM_WINDOW_ROLE property) by explicitly specifying it. You can

also specify multiple matches, which must ALL match for the properties to be applied. If a count is supplied in curly brackets at the end of the app line, then the entry will only match at most that many at any time (default is to -match all matching windows). +match all matching windows). Settings associated with an [app] line will not be +applied to transient windows. [transient] may be used instead to match them. ................................................................... # match a standard xterm

@@ -1298,41 +1299,9 @@

Parameters in the `apps' file are case-sensitive. Application names are taken from the first X window WM_CLASS attribute by default (WM_NAME = title, WM_WINDOW_ROLE = role). You can see this attribute by using the xprop -command. Transient windows are not affected by application settings. Take care -when using regular expressions. If you are not familiar with regular -expressions you can disable this feature by specifying --disable-regexp during -configure. Plain strings will then be matched. - -GROUPS ------- -Since version 0.1.11, fluxbox has a feature called autogrouping, that is apps -are automatically grouped together if they are in the same group. NOTE: this -feature is deprecated since version 0.9.1 in favor of grouping using the -`apps' file, since it is much more powerful. - -You can create groups simply by editing the ~/.fluxbox/groups file. This file -takes the format of: - - <app1> <app2> <app3> <...> <appN> - -where elements can be found with this command: - -.................. -$> xprop WM_CLASS -.................. - -Just type this command into a terminal and use the mouse to click on the -desired app and it will tell you what to write as an element (use the first of -the two names returned). Each line forms a different group, e.g.: - -................ -Navigator nedit -xterm -................ - -This will create two groups, one with netscape and nedit, and one with xterm. -The new window will only group itself to other windows on the same workspace -and to the last window that was focused. +command. Take care when using regular expressions. If you are not familiar with +regular expressions you can disable this feature by specifying --disable-regexp +during configure. Plain strings will then be matched. THE SLIT --------
M doc/fluxbox.1.indoc/fluxbox.1.in

@@ -1,11 +1,11 @@

.\" Title: fluxbox .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/> -.\" Date: 08/18/2008 +.\" Date: 08/19/2008 .\" Manual: .\" Source: .\" -.TH "FLUXBOX" "1" "08/18/2008" "" "" +.TH "FLUXBOX" "1" "08/19/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only)

@@ -1213,7 +1213,7 @@ \.\.\.

[end] .fi .RE -Each app\-name can be a string, or a regular expression\. By default the name is matched against a window\'s WM_CLASS property (the first string in it, called the "instance")\. You can match against the title, instance name (default), class name, or role (the WM_WINDOW_ROLE property) by explicitly specifying it\. You can also specify multiple matches, which must ALL match for the properties to be applied\. If a count is supplied in curly brackets at the end of the app line, then the entry will only match at most that many at any time (default is to match all matching windows)\. +Each app\-name can be a string, or a regular expression\. By default the name is matched against a window\'s WM_CLASS property (the first string in it, called the "instance")\. You can match against the title, instance name (default), class name, or role (the WM_WINDOW_ROLE property) by explicitly specifying it\. You can also specify multiple matches, which must ALL match for the properties to be applied\. If a count is supplied in curly brackets at the end of the app line, then the entry will only match at most that many at any time (default is to match all matching windows)\. Settings associated with an [app] line will not be applied to transient windows\. [transient] may be used instead to match them\. .sp .sp .RS 4

@@ -1404,37 +1404,7 @@ [Layer] {4}

[end] .fi .RE -Parameters in the `apps\' file are case\-sensitive\. Application names are taken from the first X window WM_CLASS attribute by default (WM_NAME = title, WM_WINDOW_ROLE = role)\. You can see this attribute by using the xprop command\. Transient windows are not affected by application settings\. Take care when using regular expressions\. If you are not familiar with regular expressions you can disable this feature by specifying \-\-disable\-regexp during configure\. Plain strings will then be matched\. -.sp -.SH "GROUPS" -Since version 0\.1\.11, fluxbox has a feature called autogrouping, that is apps are automatically grouped together if they are in the same group\. NOTE: this feature is deprecated since version 0\.9\.1 in favor of grouping using the `apps\' file, since it is much more powerful\. -.sp -You can create groups simply by editing the ~/\.fluxbox/groups file\. This file takes the format of: -.sp -.sp -.RS 4 -.nf -<app1> <app2> <app3> <\.\.\.> <appN> -.fi -.RE -where elements can be found with this command: -.sp -.sp -.RS 4 -.nf -$> xprop WM_CLASS -.fi -.RE -Just type this command into a terminal and use the mouse to click on the desired app and it will tell you what to write as an element (use the first of the two names returned)\. Each line forms a different group, e\.g\.: -.sp -.sp -.RS 4 -.nf -Navigator nedit -xterm -.fi -.RE -This will create two groups, one with netscape and nedit, and one with xterm\. The new window will only group itself to other windows on the same workspace and to the last window that was focused\. +Parameters in the `apps\' file are case\-sensitive\. Application names are taken from the first X window WM_CLASS attribute by default (WM_NAME = title, WM_WINDOW_ROLE = role)\. You can see this attribute by using the xprop command\. Take care when using regular expressions\. If you are not familiar with regular expressions you can disable this feature by specifying \-\-disable\-regexp during configure\. Plain strings will then be matched\. .sp .SH "THE SLIT" The slit is a special fluxbox window frame that can contain dockable applications, e\.g\. \fIbbtools\fR or \fIwmapps\fR\.
M src/ClientPattern.ccsrc/ClientPattern.cc

@@ -58,7 +58,7 @@ m_matchlimit(0),

m_nummatches(0) {} // parse the given pattern (to end of line) -ClientPattern::ClientPattern(const char *str, bool default_no_transient): +ClientPattern::ClientPattern(const char *str): m_matchlimit(0), m_nummatches(0) {

@@ -112,7 +112,6 @@ } else if (strcasecmp(memstr.c_str(), "role") == 0) {

prop = ROLE; } else if (strcasecmp(memstr.c_str(), "transient") == 0) { prop = TRANSIENT; - default_no_transient = false; } else if (strcasecmp(memstr.c_str(), "maximized") == 0) { prop = MAXIMIZED; } else if (strcasecmp(memstr.c_str(), "minimized") == 0) {

@@ -147,9 +146,6 @@ if (pos == 0 && !had_error) {

// no match terms given, this is not allowed had_error = true; } - - if (default_no_transient) - had_error = !addTerm("no", TRANSIENT); if (!had_error) { // otherwise, we check for a number
M src/ClientPattern.hhsrc/ClientPattern.hh

@@ -43,7 +43,7 @@ * Create the pattern from the given string as it would appear in the

* apps file. the bool value returns the character at which * there was a parse problem, or -1. */ - explicit ClientPattern(const char * str, bool default_no_transient = false); + explicit ClientPattern(const char * str); ~ClientPattern();
M src/Remember.ccsrc/Remember.cc

@@ -73,7 +73,7 @@ \*------------------------------------------------------------------*/

class Application { public: - Application(bool grouped, ClientPattern *pat = 0); + Application(bool transient, bool grouped, ClientPattern *pat = 0); void reset(); void forgetWorkspace() { workspace_remember = false; } void forgetHead() { head_remember = false; }

@@ -182,7 +182,7 @@

bool fullscreenstate_remember; bool fullscreenstate; - bool is_grouped; + bool is_transient, is_grouped; FbTk::RefCount<ClientPattern> group_pattern; };

@@ -192,8 +192,8 @@

-Application::Application(bool grouped, ClientPattern *pat) - : is_grouped(grouped), group_pattern(pat) +Application::Application(bool transient, bool grouped, ClientPattern *pat): + is_transient(transient), is_grouped(grouped), group_pattern(pat) { reset(); }

@@ -571,13 +571,14 @@ We REMOVE and delete any matching patterns from the old list, as they're

effectively moved into the new */ -Application* findMatchingPatterns(ClientPattern *pat, Remember::Patterns *patlist, bool is_group, ClientPattern *match_pat = 0) { +Application* findMatchingPatterns(ClientPattern *pat, Remember::Patterns *patlist, bool transient, bool is_group, ClientPattern *match_pat = 0) { Remember::Patterns::iterator it = patlist->begin(); Remember::Patterns::iterator it_end = patlist->end(); for (; it != it_end; ++it) { if (*it->first == *pat && is_group == it->second->is_grouped && + transient == it->second->is_transient && ((match_pat == 0 && *it->second->group_pattern == 0) || (match_pat && *match_pat == **it->second->group_pattern))) {

@@ -664,7 +665,8 @@ return wc_it->second;

else { Patterns::iterator it = m_pats->begin(); for (; it != m_pats->end(); it++) - if (it->first->match(winclient)) { + if (it->first->match(winclient) && + it->second->is_transient == winclient.isTransient()) { it->first->addMatch(); m_clients[&winclient] = it->second; return it->second;

@@ -676,7 +678,7 @@ }

Application * Remember::add(WinClient &winclient) { ClientPattern *p = new ClientPattern(); - Application *app = new Application(false); + Application *app = new Application(winclient.isTransient(), false); // by default, we match against the WMClass of a window (instance and class strings) string win_name = ::escapeRememberChars(p->getProperty(ClientPattern::NAME, winclient));

@@ -687,7 +689,6 @@ p->addTerm(win_name, ClientPattern::NAME);

p->addTerm(win_class, ClientPattern::CLASS); if (!win_role.empty()) p->addTerm(win_role, ClientPattern::ROLE); - p->addTerm(winclient.isTransient() ? "yes" : "no", ClientPattern::TRANSIENT); m_clients[&winclient] = app; p->addMatch(); m_pats->push_back(make_pair(p, app));

@@ -739,16 +740,21 @@ int pos = FbTk::StringUtil::getStringBetween(key,

line.c_str(), '[', ']'); - if (pos > 0 && strcasecmp(key.c_str(), "app") == 0) { - ClientPattern *pat = new ClientPattern(line.c_str() + pos, true); + if (pos > 0 && (strcasecmp(key.c_str(), "app") == 0 || + strcasecmp(key.c_str(), "transient") == 0)) { + ClientPattern *pat = new ClientPattern(line.c_str() + pos); if (!in_group) { if ((err = pat->error()) == 0) { - Application *app = findMatchingPatterns(pat, old_pats, false); + bool transient = (strcasecmp(key.c_str(), + "transient") == 0); + Application *app = findMatchingPatterns(pat, + old_pats, transient, false); if (app) { app->reset(); reused_apps.insert(app); - } else - app = new Application(false); + } else { + app = new Application(transient, false); + } m_pats->push_back(make_pair(pat, app)); row += parseApp(apps_file, *app);

@@ -769,7 +775,7 @@ m_startups.push_back(line.substr(pos));

} else if (pos > 0 && strcasecmp(key.c_str(), "group") == 0) { in_group = true; if (line.find('(') != string::npos) - pat = new ClientPattern(line.c_str() + pos, true); + pat = new ClientPattern(line.c_str() + pos); } else if (in_group) { // otherwise assume that it is the start of the attributes Application *app = 0;

@@ -777,12 +783,13 @@ // search for a matching app

list<ClientPattern *>::iterator it = grouped_pats.begin(); list<ClientPattern *>::iterator it_end = grouped_pats.end(); while (!app && it != it_end) { - app = findMatchingPatterns(*it, old_pats, in_group, pat); + app = findMatchingPatterns(*it, old_pats, false, + in_group, pat); ++it; } if (!app) - app = new Application(in_group, pat); + app = new Application(false, in_group, pat); else reused_apps.insert(app);

@@ -885,11 +892,13 @@ Patterns::iterator git = m_pats->begin();

Patterns::iterator git_end = m_pats->end(); for (; git != git_end; git++) { if (git->second == &a) { - apps_file << " [app]"<<git->first->toString()<<endl; + apps_file << (a.is_transient ? " [transient]" : " [app]") << + git->first->toString()<<endl; } } } else { - apps_file << "[app]"<<it->first->toString()<<endl; + apps_file << (a.is_transient ? "[transient]" : "[app]") << + it->first->toString()<<endl; } if (a.workspace_remember) { apps_file << " [Workspace]\t{" << a.workspace << "}" << endl;