aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/output.c1
-rw-r--r--sway/commands/output/scale_filter.c34
2 files changed, 35 insertions, 0 deletions
diff --git a/sway/commands/output.c b/sway/commands/output.c
index db2acb50..2790bd63 100644
--- a/sway/commands/output.c
+++ b/sway/commands/output.c
@@ -19,6 +19,7 @@ static struct cmd_handler output_handlers[] = {
{ "res", output_cmd_mode },
{ "resolution", output_cmd_mode },
{ "scale", output_cmd_scale },
+ { "scale_filter", output_cmd_scale_filter },
{ "subpixel", output_cmd_subpixel },
{ "toggle", output_cmd_toggle },
{ "transform", output_cmd_transform },
diff --git a/sway/commands/output/scale_filter.c b/sway/commands/output/scale_filter.c
new file mode 100644
index 00000000..fa1e8e0d
--- /dev/null
+++ b/sway/commands/output/scale_filter.c
@@ -0,0 +1,34 @@
+#include <string.h>
+#include "log.h"
+#include "sway/commands.h"
+#include "sway/config.h"
+#include "sway/output.h"
+
+struct cmd_results *output_cmd_scale_filter(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 scale_filter argument.");
+ }
+
+
+ enum scale_filter_mode scale_filter;
+ if (strcmp(*argv, "linear") == 0) {
+ scale_filter = SCALE_FILTER_LINEAR;
+ } else if (strcmp(*argv, "nearest") == 0) {
+ scale_filter = SCALE_FILTER_NEAREST;
+ } else if (strcmp(*argv, "smart") == 0) {
+ scale_filter = SCALE_FILTER_SMART;
+ } else {
+ return cmd_results_new(CMD_INVALID, "Invalid output scale_filter.");
+ }
+
+ struct output_config *oc = config->handler_context.output_config;
+ config->handler_context.leftovers.argc = argc - 1;
+ config->handler_context.leftovers.argv = argv + 1;
+
+ oc->scale_filter = scale_filter;
+ return NULL;
+}