From 0c09bc24ffad9a662537c5cd94550ef0e14b36bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=C3=ABl=20Beutot?= Date: Tue, 29 Dec 2020 21:45:39 +0100 Subject: [PATCH 1/3] Fix workspace assignements after output changes Fix #4261 The previous method was modifying the same list it was iterating upon causing an erronous iteration and thus not every workspace got assigned back to were they should (only the first one). --- src/randr.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/randr.c b/src/randr.c index 8e000ca62..b4d1d0941 100644 --- a/src/randr.c +++ b/src/randr.c @@ -439,28 +439,31 @@ void init_ws_for_output(Output *output) { Con *previous_focus = con_get_workspace(focused); /* Iterate over all workspaces and check if any of them should be assigned - * to this output. */ - Con *output_con; - TAILQ_FOREACH (output_con, &(croot->nodes_head), nodes) { - if (con_is_internal(output_con)) { + * to this output. + * Note: in order to do that we iterate over all_cons and not using another + * list that would be updated during iteration by the + * workspace_move_to_output function. */ + Con *workspace; + TAILQ_FOREACH (workspace, &all_cons, all_cons) { + if (workspace->type != CT_WORKSPACE || con_is_internal(workspace)) { continue; } - Con *workspace; - TAILQ_FOREACH (workspace, &(output_get_content(output_con)->nodes_head), nodes) { - Con *workspace_out = get_assigned_output(workspace->name, workspace->num); - if (output->con != workspace_out) { - continue; - } + Con *workspace_out = get_assigned_output(workspace->name, workspace->num); - DLOG("Moving workspace \"%s\" from output \"%s\" to \"%s\" due to assignment\n", - workspace->name, workspace_out->name, output_primary_name(output)); - /* Need to copy output's rect since content is not yet rendered. We - * can't call render_con here because render_output only proceeds - * if a workspace exists. */ - content->rect = output->con->rect; - workspace_move_to_output(workspace, output); + if (output->con != workspace_out) { + continue; } + + DLOG("Moving workspace \"%s\" from output \"%s\" to \"%s\" due to assignment\n", + workspace->name, output_primary_name(get_output_for_con(workspace)), + output_primary_name(output)); + + /* Need to copy output's rect since content is not yet rendered. We + * can't call render_con here because render_output only proceeds + * if a workspace exists. */ + content->rect = output->con->rect; + workspace_move_to_output(workspace, output); } /* Temporarily set the focused container, might not be initialized yet. */ From b35be841316712aac048f3823560726691863986 Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Sat, 2 Jan 2021 21:47:12 +0100 Subject: [PATCH 2/3] Comment-out duplicate i3-dmenu-desktop bindcode Fixes #4304 --- etc/config.keycodes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/config.keycodes b/etc/config.keycodes index aa79901bf..a02c0046d 100644 --- a/etc/config.keycodes +++ b/etc/config.keycodes @@ -51,7 +51,7 @@ bindcode $mod+40 exec --no-startup-id dmenu_run # bindcode $mod+40 exec rofi -modi drun,run -show drun # There also is i3-dmenu-desktop which only displays applications shipping a # .desktop file. It is a wrapper around dmenu, so you need that installed. -bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop +# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop # change focus bindcode $mod+44 focus left From 77d5bbb9b572b3e6680f2248b915594a7c06c435 Mon Sep 17 00:00:00 2001 From: Imran Virani <32938830+ImranVirani@users.noreply.github.com> Date: Wed, 27 Jan 2021 16:06:29 -0500 Subject: [PATCH 3/3] Properly quote rofi call in i3 config --- etc/config | 2 +- etc/config.keycodes | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/config b/etc/config index 19cb8c484..ce22fd3d1 100644 --- a/etc/config +++ b/etc/config @@ -54,7 +54,7 @@ bindsym Mod1+Shift+q kill # start dmenu (a program launcher) bindsym Mod1+d exec --no-startup-id dmenu_run # A more modern dmenu replacement is rofi: -# bindsym Mod1+d exec rofi -modi drun,run -show drun +# bindsym Mod1+d exec "rofi -modi drun,run -show drun" # There also is i3-dmenu-desktop which only displays applications shipping a # .desktop file. It is a wrapper around dmenu, so you need that installed. # bindsym Mod1+d exec --no-startup-id i3-dmenu-desktop diff --git a/etc/config.keycodes b/etc/config.keycodes index a02c0046d..f76d5a714 100644 --- a/etc/config.keycodes +++ b/etc/config.keycodes @@ -48,7 +48,7 @@ bindcode $mod+Shift+24 kill # start dmenu (a program launcher) bindcode $mod+40 exec --no-startup-id dmenu_run # A more modern dmenu replacement is rofi: -# bindcode $mod+40 exec rofi -modi drun,run -show drun +# bindcode $mod+40 exec "rofi -modi drun,run -show drun" # There also is i3-dmenu-desktop which only displays applications shipping a # .desktop file. It is a wrapper around dmenu, so you need that installed. # bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop