diff --git a/sway/commands.c b/sway/commands.c index 96245c8ae..7721c6fba 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "stringop.h" #include "layout.h" @@ -118,6 +119,22 @@ static bool cmd_exec_always(struct sway_config *config, int argc, char **argv) { if(cleanup == false) { signal(SIGCHLD, cmd_exec_cleanup); cleanup = true; + /* Set it so filedescriptors are closed for executed programs */ + int flag_out = fcntl(STDOUT_FILENO, F_GETFD); + int flag_in = fcntl(STDIN_FILENO, F_GETFD); + int flag_err = fcntl(STDERR_FILENO, F_GETFD); + if (flag_out != -1) { + flag_out |= FD_CLOEXEC; + fcntl(STDOUT_FILENO, F_SETFD, flag_out); + } + if (flag_in != -1) { + flag_in |= FD_CLOEXEC; + fcntl(STDIN_FILENO, F_SETFD, flag_in); + } + if (flag_err != -1) { + flag_err |= FD_CLOEXEC; + fcntl(STDERR_FILENO, F_SETFD, flag_err); + } } if (checkarg(argc, "exec_always", EXPECTED_MORE_THEN, 0) == false) { @@ -287,7 +304,7 @@ static bool cmd_log_colors(struct sway_config *config, int argc, char **argv) { } static bool cmd_fullscreen(struct sway_config *config, int argc, char **argv) { - if (checkarg(argc, "fullscreen", EXPECTED_SAME_AS, 1) == false) { + if (checkarg(argc, "fullscreen", EXPECTED_SAME_AS, 0) == false) { return false; } diff --git a/sway/movement.c b/sway/movement.c index a55d0350d..166e65084 100644 --- a/sway/movement.c +++ b/sway/movement.c @@ -5,7 +5,7 @@ #include "layout.h" #include "movement.h" -int move_focus(enum movement_direction direction) { +bool move_focus(enum movement_direction direction) { swayc_t *current = get_focused_container(&root_container); swayc_t *parent = current->parent; @@ -14,12 +14,12 @@ int move_focus(enum movement_direction direction) { parent = parent->parent; if (parent->type == C_ROOT) { sway_log(L_DEBUG, "Focus cannot move to parent"); - return 1; + return false; } else { sway_log(L_DEBUG, "Moving focus away from %p", current); unfocus_all(parent); focus_view(parent); - return 0; + return true; } } @@ -56,7 +56,7 @@ int move_focus(enum movement_direction direction) { } else { unfocus_all(&root_container); focus_view(parent->children->items[desired]); - return 0; + return true; } } if (!can_move) { @@ -65,7 +65,7 @@ int move_focus(enum movement_direction direction) { parent = parent->parent; if (parent->type == C_ROOT) { // Nothing we can do - return 1; + return false; } } } diff --git a/sway/movement.h b/sway/movement.h index a527674cb..dd7018770 100644 --- a/sway/movement.h +++ b/sway/movement.h @@ -12,6 +12,6 @@ enum movement_direction { MOVE_PARENT }; -int move_focus(enum movement_direction direction); +bool move_focus(enum movement_direction direction); #endif