From 18dbfe699a61b64239f7397246e015c9ebfb36ce Mon Sep 17 00:00:00 2001 From: Orestis Date: Sun, 7 Oct 2018 21:24:09 +0300 Subject: [PATCH] userguide: Mention know issues for assign (#3434) Fixes #3222 Fixes #3293 Related to #2060 --- docs/userguide | 25 +++++++++++++++++-------- src/config_directives.c | 10 ++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/docs/userguide b/docs/userguide index 9c601e88..da5d9873 100644 --- a/docs/userguide +++ b/docs/userguide @@ -755,14 +755,23 @@ set_from_resource $black i3wm.color0 #000000 To automatically make a specific window show up on a specific workspace, you can use an *assignment*. You can match windows by using any criteria, -see <>. It is recommended that you match on window classes -(and instances, when appropriate) instead of window titles whenever possible -because some applications first create their window, and then worry about -setting the correct title. Firefox with Vimperator comes to mind. The window -starts up being named Firefox, and only when Vimperator is loaded does the -title change. As i3 will get the title as soon as the application maps the -window (mapping means actually displaying it on the screen), you’d need to have -to match on 'Firefox' in this case. +see <>. The difference between +assign+ and ++for_window move to workspace+ is that the former will only be +executed when the application maps the window (mapping means actually displaying +it on the screen) but the latter will be executed whenever a window changes its +properties to something that matches the specified criteria. + +Thus, it is recommended that you match on window classes (and instances, when +appropriate) instead of window titles whenever possible because some +applications first create their window, and then worry about setting the correct +title. Firefox with Vimperator comes to mind. The window starts up being named +Firefox, and only when Vimperator is loaded does the title change. As i3 will +get the title as soon as the application maps the window, you’d need to have to +match on 'Firefox' in this case. +Another known issue is with Spotify, which doesn't set the class hints when +mapping the window, meaning you'll have to use a +for_window+ rule to assign +Spotify to a specific workspace. +Finally, using +assign [tiling]+ and +assign [floating]+ is not supported. You can also assign a window to show up on a specific output. You can use RandR names such as +VGA1+ or names relative to the output with the currently focused diff --git a/src/config_directives.c b/src/config_directives.c index dfbb52d8..5c85197f 100644 --- a/src/config_directives.c +++ b/src/config_directives.c @@ -406,6 +406,11 @@ CFGFUN(assign_output, const char *output) { return; } + if (current_match->window_mode != WM_ANY) { + ELOG("Assignments using window mode (floating/tiling) is not supported\n"); + return; + } + DLOG("New assignment, using above criteria, to output \"%s\".\n", output); Assignment *assignment = scalloc(1, sizeof(Assignment)); match_copy(&(assignment->match), current_match); @@ -420,6 +425,11 @@ CFGFUN(assign, const char *workspace, bool is_number) { return; } + if (current_match->window_mode != WM_ANY) { + ELOG("Assignments using window mode (floating/tiling) is not supported\n"); + return; + } + if (is_number && ws_name_to_number(workspace) == -1) { ELOG("Could not parse initial part of \"%s\" as a number.\n", workspace); return;