Loosen restrictions on commands, update docs

Closes #531
This commit is contained in:
Drew DeVault 2016-03-27 12:41:42 -04:00
parent 59a1c5c28c
commit eacf3d0396
4 changed files with 22 additions and 16 deletions

2
config
View File

@ -18,7 +18,7 @@ set $menu dmenu_run
### Output configuration ### Output configuration
# #
# Default wallpaper - CC-BY-NC from Netzlemming http://netzlemming.deviantart.com/art/Field-of-Barley-05240017-307176737 # Default wallpaper (more resolutions are available in /usr/share/sway/)
output * bg /usr/share/sway/Sway_Wallpaper_Blue_1920x1080.png fill output * bg /usr/share/sway/Sway_Wallpaper_Blue_1920x1080.png fill
# #
# Example output configuration: # Example output configuration:

View File

@ -215,11 +215,8 @@ static struct cmd_results *cmd_bindsym(int argc, char **argv) {
struct cmd_results *error = NULL; struct cmd_results *error = NULL;
if ((error = checkarg(argc, "bindsym", EXPECTED_MORE_THAN, 1))) { if ((error = checkarg(argc, "bindsym", EXPECTED_MORE_THAN, 1))) {
return error; return error;
} else if (!config->reading) {
return cmd_results_new(CMD_FAILURE, "bindsym", "Can only be used in config file.");
} }
struct sway_binding *binding = malloc(sizeof(struct sway_binding)); struct sway_binding *binding = malloc(sizeof(struct sway_binding));
binding->keys = create_list(); binding->keys = create_list();
binding->modifiers = 0; binding->modifiers = 0;
@ -283,11 +280,8 @@ static struct cmd_results *cmd_bindcode(int argc, char **argv) {
struct cmd_results *error = NULL; struct cmd_results *error = NULL;
if ((error = checkarg(argc, "bindcode", EXPECTED_MORE_THAN, 1))) { if ((error = checkarg(argc, "bindcode", EXPECTED_MORE_THAN, 1))) {
return error; return error;
} else if (!config->reading) {
return cmd_results_new(CMD_FAILURE, "bindcode", "Can only be used in config file.");
} }
struct sway_binding *binding = malloc(sizeof(struct sway_binding)); struct sway_binding *binding = malloc(sizeof(struct sway_binding));
binding->keys = create_list(); binding->keys = create_list();
binding->modifiers = 0; binding->modifiers = 0;

View File

@ -11,8 +11,8 @@ sway-input - input configuration file and commands
Description Description
----------- -----------
Sway allows for configuration of libinput devices. Sway allows for configuration of libinput devices through _input { }_ blocks in
your config file.
Commands Commands
-------- --------

View File

@ -16,7 +16,8 @@ on startup. These commands usually consist of setting your preferences and
setting key bindings. An example config is likely present in /etc/sway/config setting key bindings. An example config is likely present in /etc/sway/config
for you to check out. for you to check out.
Some of the commands can also or only be sent at runtime with **sway-msg**(1). These commands can be executed in your config file, via **sway-msg**(1), or via
the bindsym command.
Commands Commands
-------- --------
@ -26,13 +27,14 @@ The following commands may only be used in the configuration file.
**bar** <block of commands>:: **bar** <block of commands>::
Append _{_ to this command, the following lines will be commands that Append _{_ to this command, the following lines will be commands that
configure **swaybar**, and _}_ on its own line to close the block. configure **swaybar**, and _}_ on its own line to close the block.
+
See **sway-bar**(5) for details.
**bindsym** <key combo> <command>:: **input** <input device> <block of commands>::
Binds _key combo_ to execute _command_ when pressed. You may use XKB key Append _{_ to this command, the following lines will be commands to configure
names here (**xev**(1) is a good tool for discovering them). An example the named input device, and _}_ on its own line will close the block.
bindsym command would be _bindsym Mod1+Shift+f exec firefox_, which would +
execute Firefox if the alt, shift, and F keys are pressed together. Any See **sway-input**(5) for details.
valid sway command is eligible to be bound to a key combo.
**set** <name> <value>:: **set** <name> <value>::
Creates a substitution for _value_ that can be used with $_name_ in other Creates a substitution for _value_ that can be used with $_name_ in other
@ -107,6 +109,16 @@ They are expected to be used with **bindsym** or at runtime through **swaymsg**(
The following commands may be used either in the configuration file The following commands may be used either in the configuration file
or triggered at runtime. or triggered at runtime.
**bindsym** <key combo> <command>::
Binds _key combo_ to execute _command_ when pressed. You may use XKB key
names here (**xev**(1) is a good tool for discovering them). An example
bindsym command would be _bindsym Mod1+Shift+f exec firefox_, which would
execute Firefox if the alt, shift, and F keys are pressed together. Any
valid sway command is eligible to be bound to a key combo.
+
**bindcode** <code> <command> is also available for binding with key codes
instead of key names.
**debuglog** <on|off|toggle>:: **debuglog** <on|off|toggle>::
Enables, disables or toggles logging for debug. The toggle argument cannot Enables, disables or toggles logging for debug. The toggle argument cannot
be used in the configuration file. be used in the configuration file.