mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 16:36:26 +01:00
Merge pull request #2795 from RedSoxFan/swaynag-disable
Allow swaynag to be disabled
This commit is contained in:
commit
16e727a654
4 changed files with 23 additions and 6 deletions
|
@ -9,12 +9,17 @@ struct cmd_results *cmd_swaynag_command(int argc, char **argv) {
|
|||
return error;
|
||||
}
|
||||
|
||||
if (config->swaynag_command) {
|
||||
free(config->swaynag_command);
|
||||
free(config->swaynag_command);
|
||||
config->swaynag_command = NULL;
|
||||
|
||||
char *new_command = join_args(argv, argc);
|
||||
if (strcmp(new_command, "-") != 0) {
|
||||
config->swaybg_command = new_command;
|
||||
wlr_log(WLR_DEBUG, "Using custom swaynag command: %s",
|
||||
config->swaynag_command);
|
||||
} else {
|
||||
free(new_command);
|
||||
}
|
||||
config->swaynag_command = join_args(argv, argc);
|
||||
wlr_log(WLR_DEBUG, "Using custom swaynag command: %s",
|
||||
config->swaynag_command);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
@ -137,6 +137,7 @@ void free_config(struct sway_config *config) {
|
|||
free(config->floating_scroll_right_cmd);
|
||||
free(config->font);
|
||||
free(config->swaybg_command);
|
||||
free(config->swaynag_command);
|
||||
free((char *)config->current_config_path);
|
||||
free((char *)config->current_config);
|
||||
free(config);
|
||||
|
@ -167,7 +168,7 @@ static void set_color(float dest[static 4], uint32_t color) {
|
|||
}
|
||||
|
||||
static void config_defaults(struct sway_config *config) {
|
||||
config->swaynag_command = strdup("swaynag");
|
||||
if (!(config->swaynag_command = strdup("swaynag"))) goto cleanup;
|
||||
config->swaynag_config_errors = (struct swaynag_instance){
|
||||
.args = "--type error "
|
||||
"--message 'There are errors in your config file' "
|
||||
|
|
|
@ -81,6 +81,9 @@ The following commands may only be used in the configuration file.
|
|||
arguments. This should be placed at the top of the config for the best
|
||||
results.
|
||||
|
||||
It can be disabled by setting the command to a single dash:
|
||||
_swaynag\_command -_
|
||||
|
||||
The following commands cannot be used directly in the configuration file.
|
||||
They are expected to be used with *bindsym* or at runtime through *swaymsg*(1).
|
||||
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
|
||||
bool swaynag_spawn(const char *swaynag_command,
|
||||
struct swaynag_instance *swaynag) {
|
||||
if (!swaynag_command) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (swaynag->detailed) {
|
||||
if (pipe(swaynag->fd) != 0) {
|
||||
wlr_log(WLR_ERROR, "Failed to create pipe for swaynag");
|
||||
|
@ -58,6 +62,10 @@ void swaynag_kill(struct swaynag_instance *swaynag) {
|
|||
|
||||
void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag,
|
||||
const char *fmt, ...) {
|
||||
if (!swaynag_command) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!swaynag->detailed) {
|
||||
wlr_log(WLR_ERROR, "Attempting to write to non-detailed swaynag inst");
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue