aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-06-04 22:24:34 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-06-05 10:08:00 -0400
commit067fe9d0472ca24328a962e8704d4e843f2a8af1 (patch)
tree2ea56856183e855ca2681834d21516b2c2351341 /sway/commands.c
parentMerge pull request #2095 from emersion/fullscreen-damage-only-visible (diff)
downloadsway-067fe9d0472ca24328a962e8704d4e843f2a8af1.tar.gz
sway-067fe9d0472ca24328a962e8704d4e843f2a8af1.tar.zst
sway-067fe9d0472ca24328a962e8704d4e843f2a8af1.zip
Support runtime var expansion and set at runtime
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 3a86ae53..464c9932 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -112,6 +112,7 @@ static struct cmd_handler handlers[] = {
112 { "mouse_warping", cmd_mouse_warping }, 112 { "mouse_warping", cmd_mouse_warping },
113 { "output", cmd_output }, 113 { "output", cmd_output },
114 { "seat", cmd_seat }, 114 { "seat", cmd_seat },
115 { "set", cmd_set },
115 { "show_marks", cmd_show_marks }, 116 { "show_marks", cmd_show_marks },
116 { "workspace", cmd_workspace }, 117 { "workspace", cmd_workspace },
117 { "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth }, 118 { "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth },
@@ -120,7 +121,6 @@ static struct cmd_handler handlers[] = {
120/* Config-time only commands. Keep alphabetized */ 121/* Config-time only commands. Keep alphabetized */
121static struct cmd_handler config_handlers[] = { 122static struct cmd_handler config_handlers[] = {
122 { "default_orientation", cmd_default_orientation }, 123 { "default_orientation", cmd_default_orientation },
123 { "set", cmd_set },
124 { "swaybg_command", cmd_swaybg_command }, 124 { "swaybg_command", cmd_swaybg_command },
125 { "workspace_layout", cmd_workspace_layout }, 125 { "workspace_layout", cmd_workspace_layout },
126}; 126};
@@ -270,6 +270,13 @@ struct cmd_results *execute_command(char *_exec, struct sway_seat *seat) {
270 goto cleanup; 270 goto cleanup;
271 } 271 }
272 272
273 // Var replacement, for all but first argument of set
274 for (int i = handler->handle == cmd_set ? 2 : 1; i < argc; ++i) {
275 argv[i] = do_var_replacement(argv[i]);
276 unescape_string(argv[i]);
277 strip_quotes(argv[i]);
278 }
279
273 if (!config->handler_context.using_criteria) { 280 if (!config->handler_context.using_criteria) {
274 // without criteria, the command acts upon the focused 281 // without criteria, the command acts upon the focused
275 // container 282 // container