mirror of
https://github.com/swaywm/sway.git
synced 2026-04-29 06:46:22 -04:00
Merge 6fefe56a97 into aca9f6b2a2
This commit is contained in:
commit
99bb219dbb
2 changed files with 28 additions and 0 deletions
|
|
@ -86,6 +86,7 @@ static sway_cmd cmd_resize;
|
||||||
static sway_cmd cmd_resize_set;
|
static sway_cmd cmd_resize_set;
|
||||||
static sway_cmd cmd_scratchpad;
|
static sway_cmd cmd_scratchpad;
|
||||||
static sway_cmd cmd_set;
|
static sway_cmd cmd_set;
|
||||||
|
static sway_cmd cmd_setenv;
|
||||||
static sway_cmd cmd_smart_gaps;
|
static sway_cmd cmd_smart_gaps;
|
||||||
static sway_cmd cmd_split;
|
static sway_cmd cmd_split;
|
||||||
static sway_cmd cmd_splith;
|
static sway_cmd cmd_splith;
|
||||||
|
|
@ -2305,6 +2306,29 @@ static struct cmd_results *cmd_set(int argc, char **argv) {
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set environment variables for sway session
|
||||||
|
**/
|
||||||
|
static struct cmd_results *cmd_setenv(int argc, char **argv) {
|
||||||
|
int env;
|
||||||
|
struct cmd_results *error = NULL;
|
||||||
|
|
||||||
|
if ((error = checkarg(argc, "setenv", EXPECTED_AT_LEAST, 2))) {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argv[0][0] == '$') {
|
||||||
|
memmove(argv[0], argv[0]+1, strlen(argv[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
env = setenv(argv[0], argv[1], 1);
|
||||||
|
if (env == -1) {
|
||||||
|
return cmd_results_new(CMD_FAILURE, "setenv", "Variable name contains '=' or has size 0.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static struct cmd_results *_do_split(int argc, char **argv, int layout) {
|
static struct cmd_results *_do_split(int argc, char **argv, int layout) {
|
||||||
char *name = layout == L_VERT ? "splitv" :
|
char *name = layout == L_VERT ? "splitv" :
|
||||||
layout == L_HORIZ ? "splith" : "split";
|
layout == L_HORIZ ? "splith" : "split";
|
||||||
|
|
@ -2689,6 +2713,7 @@ static struct cmd_handler handlers[] = {
|
||||||
{ "scratchpad", cmd_scratchpad },
|
{ "scratchpad", cmd_scratchpad },
|
||||||
{ "seamless_mouse", cmd_seamless_mouse },
|
{ "seamless_mouse", cmd_seamless_mouse },
|
||||||
{ "set", cmd_set },
|
{ "set", cmd_set },
|
||||||
|
{ "setenv", cmd_setenv },
|
||||||
{ "smart_gaps", cmd_smart_gaps },
|
{ "smart_gaps", cmd_smart_gaps },
|
||||||
{ "split", cmd_split },
|
{ "split", cmd_split },
|
||||||
{ "splith", cmd_splith },
|
{ "splith", cmd_splith },
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,9 @@ The following commands may only be used in the configuration file.
|
||||||
Sets variable $name to _value_. You can use the new variable in the arguments
|
Sets variable $name to _value_. You can use the new variable in the arguments
|
||||||
of future commands.
|
of future commands.
|
||||||
|
|
||||||
|
**setenv** <name> <value>::
|
||||||
|
Creates an environment variable that can be used during sway session.
|
||||||
|
|
||||||
The following commands cannot be used directly in the configuration file.
|
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).
|
They are expected to be used with **bindsym** or at runtime through **swaymsg**(1).
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue