summaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
authorWilliam McKinnon <[email protected]>2022-04-26 21:44:51 -0400
committerGitHub <[email protected]>2022-04-26 21:44:51 -0400
commit4660771f6a25b93062df0698634059f893ae1999 (patch)
treeb7135d20119a42d8381fb65004f476750d6212fd /sway/commands
parentccda4dae0f9b77b9760d6fdf178e0f0e2571cde0 (diff)
parent5543acff06981639086bc9a0fc9b608796a23e84 (diff)
Merge pull request #1 from swaywm/v1.7
V1.7
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/bar/hidden_state.c2
-rw-r--r--sway/commands/bar/mode.c2
-rw-r--r--sway/commands/client.c16
-rw-r--r--sway/commands/exec_always.c2
-rw-r--r--sway/commands/focus.c8
-rw-r--r--sway/commands/move.c4
-rw-r--r--sway/commands/output.c7
-rw-r--r--sway/commands/output/render_bit_depth.c29
-rw-r--r--sway/commands/smart_gaps.c7
-rw-r--r--sway/commands/swap.c5
10 files changed, 74 insertions, 8 deletions
diff --git a/sway/commands/bar/hidden_state.c b/sway/commands/bar/hidden_state.c
index 1f08a5d2..8b661e3a 100644
--- a/sway/commands/bar/hidden_state.c
+++ b/sway/commands/bar/hidden_state.c
@@ -54,7 +54,7 @@ struct cmd_results *bar_cmd_hidden_state(int argc, char **argv) {
}
const char *state = argv[0];
- if (config->reading) {
+ if (config->current_bar) {
error = bar_set_hidden_state(config->current_bar, state);
} else {
const char *id = argc == 2 ? argv[1] : NULL;
diff --git a/sway/commands/bar/mode.c b/sway/commands/bar/mode.c
index 8b3fb275..7c2f423b 100644
--- a/sway/commands/bar/mode.c
+++ b/sway/commands/bar/mode.c
@@ -58,7 +58,7 @@ struct cmd_results *bar_cmd_mode(int argc, char **argv) {
}
const char *mode = argv[0];
- if (config->reading) {
+ if (config->current_bar) {
error = bar_set_mode(config->current_bar, mode);
} else {
const char *id = argc == 2 ? argv[1] : NULL;
diff --git a/sway/commands/client.c b/sway/commands/client.c
index dd0694df..77263145 100644
--- a/sway/commands/client.c
+++ b/sway/commands/client.c
@@ -18,6 +18,12 @@ static struct cmd_results *handle_command(int argc, char **argv, char *cmd_name,
return error;
}
+ if (argc > 3 && strcmp(cmd_name, "client.focused_tab_title") == 0) {
+ sway_log(SWAY_ERROR,
+ "Warning: indicator and child_border colors have no effect for %s",
+ cmd_name);
+ }
+
struct border_colors colors = {0};
const char *ind_hex = argc > 3 ? argv[3] : default_indicator;
const char *child_hex = argc > 4 ? argv[4] : argv[1]; // def to background
@@ -80,3 +86,13 @@ struct cmd_results *cmd_client_noop(int argc, char **argv) {
sway_log(SWAY_INFO, "Warning: %s is ignored by sway", argv[-1]);
return cmd_results_new(CMD_SUCCESS, NULL);
}
+
+struct cmd_results *cmd_client_focused_tab_title(int argc, char **argv) {
+ struct cmd_results *result = handle_command(argc, argv,
+ "client.focused_tab_title",
+ &config->border_colors.focused_tab_title, "#2e9ef4ff");
+ if (result && result->status == CMD_SUCCESS) {
+ config->has_focused_tab_title = true;
+ }
+ return result;
+}
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c
index fce337d5..b35065c1 100644
--- a/sway/commands/exec_always.c
+++ b/sway/commands/exec_always.c
@@ -7,6 +7,7 @@
#include <signal.h>
#include "sway/commands.h"
#include "sway/config.h"
+#include "sway/server.h"
#include "sway/tree/container.h"
#include "sway/tree/root.h"
#include "sway/tree/workspace.h"
@@ -53,6 +54,7 @@ struct cmd_results *cmd_exec_process(int argc, char **argv) {
// Fork process
if ((pid = fork()) == 0) {
// Fork child process again
+ restore_nofile_limit();
setsid();
sigset_t set;
sigemptyset(&set);
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 6771ca2f..b8d28480 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -267,6 +267,11 @@ static struct cmd_results *focus_mode(struct sway_workspace *ws,
new_focus = seat_get_focus_inactive_tiling(seat, ws);
}
if (new_focus) {
+ struct sway_container *new_focus_view =
+ seat_get_focus_inactive_view(seat, &new_focus->node);
+ if (new_focus_view) {
+ new_focus = new_focus_view;
+ }
seat_set_focus_container(seat, new_focus);
// If we're on the floating layer and the floating container area
@@ -446,7 +451,8 @@ struct cmd_results *cmd_focus(int argc, char **argv) {
return cmd_results_new(CMD_FAILURE, "");
}
struct sway_node *next_focus = NULL;
- if (container_is_floating(container)) {
+ if (container_is_floating(container) &&
+ container->pending.fullscreen_mode == FULLSCREEN_NONE) {
next_focus = node_get_in_direction_floating(container, seat, direction);
} else {
next_focus = node_get_in_direction_tiling(container, seat, direction, descend);
diff --git a/sway/commands/move.c b/sway/commands/move.c
index f2702fa1..1a05a7a6 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -874,6 +874,10 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) {
return cmd_results_new(CMD_INVALID, "Invalid x position specified");
}
+ if (argc < 1) {
+ return cmd_results_new(CMD_FAILURE, expected_position_syntax);
+ }
+
struct movement_amount ly = { .amount = 0, .unit = MOVEMENT_UNIT_INVALID };
// Y direction
num_consumed_args = parse_movement_amount(argc, argv, &ly);
diff --git a/sway/commands/output.c b/sway/commands/output.c
index d8ef2885..125df5a7 100644
--- a/sway/commands/output.c
+++ b/sway/commands/output.c
@@ -18,6 +18,7 @@ static const struct cmd_handler output_handlers[] = {
{ "modeline", output_cmd_modeline },
{ "pos", output_cmd_position },
{ "position", output_cmd_position },
+ { "render_bit_depth", output_cmd_render_bit_depth },
{ "res", output_cmd_mode },
{ "resolution", output_cmd_mode },
{ "scale", output_cmd_scale },
@@ -33,9 +34,9 @@ struct cmd_results *cmd_output(int argc, char **argv) {
return error;
}
- // The NOOP-1 output is a dummy output used when there's no outputs
+ // The HEADLESS-1 output is a dummy output used when there's no outputs
// connected. It should never be configured.
- if (strcasecmp(argv[0], root->noop_output->wlr_output->name) == 0) {
+ if (strcasecmp(argv[0], root->fallback_output->wlr_output->name) == 0) {
return cmd_results_new(CMD_FAILURE,
"Refusing to configure the no op output");
}
@@ -52,7 +53,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
if (!sway_output) {
return cmd_results_new(CMD_FAILURE, "Unknown output");
}
- if (sway_output == root->noop_output) {
+ if (sway_output == root->fallback_output) {
return cmd_results_new(CMD_FAILURE,
"Refusing to configure the no op output");
}
diff --git a/sway/commands/output/render_bit_depth.c b/sway/commands/output/render_bit_depth.c
new file mode 100644
index 00000000..c419321e
--- /dev/null
+++ b/sway/commands/output/render_bit_depth.c
@@ -0,0 +1,29 @@
+#include <drm_fourcc.h>
+#include <strings.h>
+#include "sway/commands.h"
+#include "sway/config.h"
+
+struct cmd_results *output_cmd_render_bit_depth(int argc, char **argv) {
+ if (!config->handler_context.output_config) {
+ return cmd_results_new(CMD_FAILURE, "Missing output config");
+ }
+ if (!argc) {
+ return cmd_results_new(CMD_INVALID, "Missing bit depth argument.");
+ }
+
+ if (strcmp(*argv, "8") == 0) {
+ config->handler_context.output_config->render_bit_depth =
+ RENDER_BIT_DEPTH_8;
+ } else if (strcmp(*argv, "10") == 0) {
+ config->handler_context.output_config->render_bit_depth =
+ RENDER_BIT_DEPTH_10;
+ } else {
+ return cmd_results_new(CMD_INVALID,
+ "Invalid bit depth. Must be a value in (8|10).");
+ }
+
+ config->handler_context.leftovers.argc = argc - 1;
+ config->handler_context.leftovers.argv = argv + 1;
+ return NULL;
+}
+
diff --git a/sway/commands/smart_gaps.c b/sway/commands/smart_gaps.c
index b27f9ccd..a6d165dc 100644
--- a/sway/commands/smart_gaps.c
+++ b/sway/commands/smart_gaps.c
@@ -15,7 +15,12 @@ struct cmd_results *cmd_smart_gaps(int argc, char **argv) {
return error;
}
- config->smart_gaps = parse_boolean(argv[0], config->smart_gaps);
+ if (strcmp(argv[0], "inverse_outer") == 0) {
+ config->smart_gaps = SMART_GAPS_INVERSE_OUTER;
+ } else {
+ config->smart_gaps = parse_boolean(argv[0], config->smart_gaps)
+ ? SMART_GAPS_ON : SMART_GAPS_OFF;
+ }
arrange_root();
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index ce5e5128..9355944d 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -126,10 +126,10 @@ void container_swap(struct sway_container *con1, struct sway_container *con2) {
}
enum sway_fullscreen_mode fs1 = con1->pending.fullscreen_mode;
- enum sway_fullscreen_mode fs2 = con2->pending.fullscreen_mode;
if (fs1) {
container_fullscreen_disable(con1);
}
+ enum sway_fullscreen_mode fs2 = con2->pending.fullscreen_mode;
if (fs2) {
container_fullscreen_disable(con2);
}
@@ -247,6 +247,9 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
} else if (!current) {
error = cmd_results_new(CMD_FAILURE,
"Can only swap with containers and views");
+ } else if (current == other) {
+ error = cmd_results_new(CMD_FAILURE,
+ "Cannot swap a container with itself");
} else if (container_has_ancestor(current, other)
|| container_has_ancestor(other, current)) {
error = cmd_results_new(CMD_FAILURE,