]> git.sur5r.net Git - i3/i3/blobdiff - src/output.c
_con_move_to_con: don't change focus when moving to active workspace
[i3/i3] / src / output.c
index e3c54a67274e31821be38e7ecd62663b4bca363e..571c01cfa49e7f19f98f0da23adc31aea8b8b10c 100644 (file)
@@ -44,6 +44,14 @@ Output *get_output_from_string(Output *current_output, const char *output_str) {
     return get_output_by_name(output_str, true);
 }
 
+/*
+ * Retrieves the primary name of an output.
+ *
+ */
+char *output_primary_name(Output *output) {
+    return SLIST_FIRST(&output->names_head)->name;
+}
+
 Output *get_output_for_con(Con *con) {
     Con *output_con = con_get_output(con);
     if (output_con == NULL) {
@@ -91,7 +99,14 @@ void output_push_sticky_windows(Con *to_focus) {
                     continue;
 
                 if (con_is_sticky(current)) {
-                    con_move_to_workspace(current, visible_ws, true, false, current != to_focus->parent);
+                    bool ignore_focus = (to_focus == NULL) || (current != to_focus->parent);
+                    con_move_to_workspace(current, visible_ws, true, false, ignore_focus);
+                    if (!ignore_focus) {
+                        Con *current_ws = con_get_workspace(focused);
+                        con_activate(con_descend_focused(current));
+                        /* Pushing sticky windows shouldn't change the focused workspace. */
+                        con_activate(con_descend_focused(current_ws));
+                    }
                 }
             }
         }