summaryrefslogtreecommitdiff
path: root/sway/commands/default_dim_inactive.c
diff options
context:
space:
mode:
authorfamfo <[email protected]>2023-02-15 01:19:02 +0000
committerGitHub <[email protected]>2023-02-14 20:19:02 -0500
commit9f20a5263814f325035d3569768060e04c7dcb96 (patch)
treefc95512b91dd6f4cde541495ea8bea442ad8c041 /sway/commands/default_dim_inactive.c
parente78fc3364b0440ff82becbec4ae57458374a145f (diff)
Implement for_window support for dim_inactive (#109)
* Implement for_window support for dim_inactive * Update file names, add check if the container is null, add docs * Fix typo * Update meson.build * Update commands.c * Update render.c * Update container.c * Update render.c * Update container.h
Diffstat (limited to 'sway/commands/default_dim_inactive.c')
-rw-r--r--sway/commands/default_dim_inactive.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/sway/commands/default_dim_inactive.c b/sway/commands/default_dim_inactive.c
new file mode 100644
index 00000000..04d8acdf
--- /dev/null
+++ b/sway/commands/default_dim_inactive.c
@@ -0,0 +1,30 @@
+#include <string.h>
+#include "sway/commands.h"
+#include "sway/config.h"
+#include "log.h"
+#include "sway/output.h"
+
+
+struct cmd_results *cmd_default_dim_inactive(int argc, char **argv) {
+ struct cmd_results *error = NULL;
+ if ((error = checkarg(argc, "default_dim_inactive", EXPECTED_EQUAL_TO, 1))) {
+ return error;
+ }
+
+ char *err;
+ float val = strtof(argv[0], &err);
+ if (*err || val < 0.0f || val > 1.0f) {
+ return cmd_results_new(CMD_INVALID, "default_dim_inactive float invalid");
+ }
+
+ config->default_dim_inactive = val;
+
+ if (config->active) {
+ for (int i = 0; i < root->outputs->length; ++i) {
+ struct sway_output *output = root->outputs->items[i];
+ output_damage_whole(output);
+ }
+ }
+
+ return cmd_results_new(CMD_SUCCESS, NULL);
+}