mirror of
https://github.com/gwenhael-le-moine/sway-patched-tray-menu.git
synced 2024-12-27 21:58:16 +01:00
2a684cad5f
Patch tested by compiling with `__attribute__ ((format (printf, 2, 3)))` applied to `cmd_results_new`. String usage constants have been converted from pointers to arrays when encountered. General handler format strings were sometimes modified to include the old input string, especially for unknown command errors.
32 lines
927 B
C
32 lines
927 B
C
#include <wlr/util/log.h>
|
|
#include "log.h"
|
|
#include "sway/input/input-manager.h"
|
|
#include "sway/input/seat.h"
|
|
#include "sway/tree/container.h"
|
|
#include "sway/tree/view.h"
|
|
#include "sway/tree/workspace.h"
|
|
#include "sway/commands.h"
|
|
|
|
static void close_container_iterator(struct sway_container *con, void *data) {
|
|
if (con->view) {
|
|
view_close(con->view);
|
|
}
|
|
}
|
|
|
|
struct cmd_results *cmd_kill(int argc, char **argv) {
|
|
if (!root->outputs->length) {
|
|
return cmd_results_new(CMD_INVALID,
|
|
"Can't run this command while there's no outputs connected.");
|
|
}
|
|
struct sway_container *con = config->handler_context.container;
|
|
struct sway_workspace *ws = config->handler_context.workspace;
|
|
|
|
if (con) {
|
|
close_container_iterator(con, NULL);
|
|
container_for_each_child(con, close_container_iterator, NULL);
|
|
} else {
|
|
workspace_for_each_container(ws, close_container_iterator, NULL);
|
|
}
|
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
|
}
|