mirror of
https://github.com/swaywm/sway.git
synced 2024-11-29 03:11:27 +00:00
Merge branch 'master' into assign-command
This commit is contained in:
commit
66caee645c
|
@ -5,17 +5,24 @@
|
|||
char *read_line(FILE *file) {
|
||||
size_t length = 0, size = 128;
|
||||
char *string = malloc(size);
|
||||
char lastChar = '\0';
|
||||
if (!string) {
|
||||
return NULL;
|
||||
}
|
||||
while (1) {
|
||||
int c = getc(file);
|
||||
if (c == '\n' && lastChar == '\\'){
|
||||
--length; // Ignore last character.
|
||||
lastChar = '\0';
|
||||
continue;
|
||||
}
|
||||
if (c == EOF || c == '\n' || c == '\0') {
|
||||
break;
|
||||
}
|
||||
if (c == '\r') {
|
||||
continue;
|
||||
}
|
||||
lastChar = c;
|
||||
if (length == size) {
|
||||
char *new_string = realloc(string, size *= 2);
|
||||
if (!new_string) {
|
||||
|
|
|
@ -1639,7 +1639,7 @@ static struct cmd_results *cmd_output(int argc, char **argv) {
|
|||
}
|
||||
char *src = join_args(argv + i, argc - i - 1);
|
||||
char *mode = argv[argc - 1];
|
||||
if (wordexp(src, &p, 0) != 0) {
|
||||
if (wordexp(src, &p, 0) != 0 || p.we_wordv[0] == NULL) {
|
||||
return cmd_results_new(CMD_INVALID, "output", "Invalid syntax (%s)", src);
|
||||
}
|
||||
free(src);
|
||||
|
@ -1699,9 +1699,13 @@ static struct cmd_results *cmd_output(int argc, char **argv) {
|
|||
swayc_t *cont = NULL;
|
||||
for (int i = 0; i < root_container.children->length; ++i) {
|
||||
cont = root_container.children->items[i];
|
||||
if (cont->name && strcmp(cont->name, output->name) == 0) {
|
||||
if (cont->name && ((strcmp(cont->name, output->name) == 0) || (strcmp(output->name, "*") == 0))) {
|
||||
apply_output_config(output, cont);
|
||||
break;
|
||||
|
||||
if (strcmp(output->name, "*") != 0) {
|
||||
// stop looking if the output config isn't applicable to all outputs
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2153,12 +2157,26 @@ static int compare_set_qsort(const void *_l, const void *_r) {
|
|||
}
|
||||
|
||||
static struct cmd_results *cmd_set(int argc, char **argv) {
|
||||
char *tmp;
|
||||
int size;
|
||||
struct cmd_results *error = NULL;
|
||||
if (!config->reading) return cmd_results_new(CMD_FAILURE, "set", "Can only be used in config file.");
|
||||
if ((error = checkarg(argc, "set", EXPECTED_AT_LEAST, 2))) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (argv[0][0] != '$') {
|
||||
sway_log(L_INFO, "Warning: variable '%s' doesn't start with $", argv[0]);
|
||||
|
||||
size = asprintf(&tmp, "%s%s", "$", argv[0]);
|
||||
if (size == -1) {
|
||||
return cmd_results_new(CMD_FAILURE, "set", "Not possible to create variable $'%s'", argv[0]);
|
||||
}
|
||||
|
||||
argv[0] = strdup(tmp);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
struct sway_variable *var = NULL;
|
||||
// Find old variable if it exists
|
||||
int i;
|
||||
|
@ -3040,7 +3058,7 @@ static struct cmd_results *bar_cmd_swaybar_command(int argc, char **argv) {
|
|||
}
|
||||
|
||||
static struct cmd_results *bar_cmd_tray_output(int argc, char **argv) {
|
||||
sway_log(L_ERROR, "warning: tray_output is not supported on wayland");
|
||||
sway_log(L_ERROR, "Warning: tray_output is not supported on wayland");
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -403,6 +403,11 @@ static bool load_include_config(const char *path, const char *parent_dir, struct
|
|||
char *real_path = realpath(full_path, NULL);
|
||||
free(full_path);
|
||||
|
||||
if (real_path == NULL) {
|
||||
sway_log(L_DEBUG, "%s not found.", path);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if config has already been included
|
||||
int j;
|
||||
for (j = 0; j < config->config_chain->length; ++j) {
|
||||
|
|
|
@ -19,10 +19,15 @@ Commands
|
|||
--------
|
||||
|
||||
**status_command** <status command>::
|
||||
Executes the bar _status command_ with _sh -c_.
|
||||
Executes the bar _status command_ with _sh -c_. Each line of text printed to
|
||||
stdout from this command will be displayed in the status area of the bar. You
|
||||
can also use the i3bar JSON protocol:
|
||||
+
|
||||
https://i3wm.org/docs/i3bar-protocol.html
|
||||
|
||||
**pango_markup** <enabled|disabled>::
|
||||
Enables or disables pango markup for plaintext statuslines.
|
||||
Enables or disables pango markup for status lines. This has no effect on
|
||||
status lines using the i3bar JSON protocol.
|
||||
|
||||
**id** <bar_id>::
|
||||
Sets the ID of the bar.
|
||||
|
@ -112,4 +117,4 @@ channel.
|
|||
See Also
|
||||
--------
|
||||
|
||||
**sway**(5) **sway-input**(5)
|
||||
**sway**(5)
|
||||
|
|
|
@ -37,7 +37,8 @@ Commands
|
|||
Enables or disables middle click emulation.
|
||||
|
||||
**input** <identifier> natural_scroll <enabled|disabled>::
|
||||
Enables or disables natural scrolling for the specified input device.
|
||||
Enables or disables natural (inverted) scrolling for the specified input
|
||||
device.
|
||||
|
||||
**input** <identifier> pointer_accel <[-1,1]>::
|
||||
Changes the pointer acceleration for the specified input device.
|
||||
|
@ -51,4 +52,4 @@ Commands
|
|||
See Also
|
||||
--------
|
||||
|
||||
**sway**(5) **sway-bar**(5)
|
||||
**sway**(5)
|
||||
|
|
|
@ -52,7 +52,7 @@ You may run sway from an ongoing x11 session to run it within x. Otherwise, you
|
|||
can run sway on a tty and it will use your outputs directly.
|
||||
|
||||
*Important note for nvidia users*: The proprietary nvidia driver does _not_ have
|
||||
support for Wayland as of 2016-03-27. Use nouveau.
|
||||
support for Wayland as of 2016-06-10. Use nouveau.
|
||||
|
||||
Commands
|
||||
--------
|
||||
|
@ -60,7 +60,7 @@ Commands
|
|||
If sway is currently running, you may run _sway [command]_ to send _command_ to
|
||||
the running instance of sway. The same commands you would use in the config file
|
||||
are valid here (see **sway**(5)). For compatibility reasons, you may also issue
|
||||
commands with **sway-msg**(1) or **i3-msg**(1) (or even with **i3**(1), probably).
|
||||
commands with **swaymsg**(1) or **i3-msg**(1) (or even with **i3**(1), probably).
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
@ -69,11 +69,14 @@ If _-c_ is not specified, sway will look in several locations for your config
|
|||
file. The suggested location for your config file is ~/.config/sway/config.
|
||||
~/.sway/config will also work, and the rest of the usual XDG config locations
|
||||
are supported. If no sway config is found, sway will attempt to load an i3
|
||||
config from all the config locations i3 supports. At last, sway looks for a
|
||||
config file in a fallback directory, which is /etc/sway/ by default. A standard
|
||||
config from all the config locations i3 supports. Sway looks for a config file in
|
||||
a fallback directory as a last resort, which is /etc/sway/ by default. A standard
|
||||
configuration file is installed at this location. If still nothing is found,
|
||||
you will receive an error.
|
||||
|
||||
To write your own config, it's suggested that you copy the default config file to
|
||||
the location of your choosing and start there.
|
||||
|
||||
For information on the config file format, see **sway**(5).
|
||||
|
||||
Authors
|
||||
|
@ -86,4 +89,4 @@ source contributors. For more information about sway development, see
|
|||
See Also
|
||||
--------
|
||||
|
||||
**sway**(5) **swaymsg**(1) **swaygrab**(1) **sway-input** (5) **sway-bar** (5)
|
||||
**sway**(5) **swaymsg**(1) **swaygrab**(1) **sway-input**(5) **sway-bar**(5)
|
||||
|
|
110
sway/sway.5.txt
110
sway/sway.5.txt
|
@ -16,7 +16,13 @@ on startup. These commands usually consist of setting your preferences and
|
|||
setting key bindings. An example config is likely present in /etc/sway/config
|
||||
for you to check out.
|
||||
|
||||
These commands can be executed in your config file, via **sway-msg**(1), or via
|
||||
Lines in the configuration file might be extended through multiple lines by
|
||||
adding a '\' character at the end of line. e.g.:
|
||||
|
||||
bindsym Shift+XF86AudioRaiseVolume exec pactl set-sink-volume \
|
||||
$(pactl list sinks | grep -B 1 RUNNING | sed '1q;d' | sed 's/[^0-9]\+//g') +5%
|
||||
|
||||
These commands can be executed in your config file, via **swaymsg**(1), or via
|
||||
the bindsym command.
|
||||
|
||||
Commands
|
||||
|
@ -30,53 +36,28 @@ The following commands may only be used in the configuration file.
|
|||
+
|
||||
See **sway-bar**(5) for details.
|
||||
|
||||
**input** <input device> <block of commands>::
|
||||
Append _{_ to this command, the following lines will be commands to configure
|
||||
the named input device, and _}_ on its own line will close the block.
|
||||
+
|
||||
See **sway-input**(5) for details.
|
||||
|
||||
**set** <name> <value>::
|
||||
Creates a substitution for _value_ that can be used with $_name_ in other
|
||||
commands.
|
||||
Sets variable $name to _value_. You can use the new variable in the arguments
|
||||
of future commands.
|
||||
|
||||
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).
|
||||
|
||||
**border** <normal|pixel> [<n>]::
|
||||
Set border style for focused window. _normal_ includes a border of thickness
|
||||
_n_ and a title bar. _pixel_ is just the border without title bar. Default is
|
||||
_normal_ with border thickness 2.
|
||||
_n_ and a title bar. _pixel_ is a border without title bar _n_ pixels thick.
|
||||
Default is _normal_ with border thickness 2.
|
||||
|
||||
**border** <none|toggle>::
|
||||
Set border style for focused window to _none_ or _toggle_ between the
|
||||
available border styles: _normal_, _pixel_, _none_.
|
||||
|
||||
**new_window** <normal|none|pixel> [<n>]::
|
||||
Set default border style for new windows.
|
||||
|
||||
**new_float** <normal|none|pixel> [<n>]::
|
||||
Set default border style for new floating windows. This does only apply to
|
||||
windows that are spawned in floating mode.
|
||||
|
||||
**exit**::
|
||||
Exit sway and end your Wayland session.
|
||||
|
||||
**floating** <enable|disable|toggle>::
|
||||
Make focused view floating, non-floating, or the opposite of what it is now.
|
||||
|
||||
**floating_maximum_size** <width> x <height>::
|
||||
Specifies the maximum dimensions of floating windows.
|
||||
Uses the container dimensions as default.
|
||||
-1 x -1 will remove any restriction on dimentions.
|
||||
0 x 0 has the same behavior as not setting any value.
|
||||
If in conflict this option has precedence over floating_minimum_size.
|
||||
|
||||
**floating_minimum_size** <width> x <height>::
|
||||
Specifies the minimum dimensions of floating windows.
|
||||
Default parameters are 75 x 50.
|
||||
-1 and 0 are invalid parameters, default will be used instead.
|
||||
|
||||
**focus** <direction>::
|
||||
Direction may be one of _up_, _down_, _left_, _right_, or _parent_. The
|
||||
directional focus commands will move the focus in that direction. The parent
|
||||
|
@ -95,9 +76,6 @@ They are expected to be used with **bindsym** or at runtime through **swaymsg**(
|
|||
**fullscreen**::
|
||||
Toggles fullscreen status for the focused view.
|
||||
|
||||
**hide_edge_borders** <none|vertical|horizontal|both>::
|
||||
Hide window borders adjacent to the screen edges. Default is _none_.
|
||||
|
||||
**layout** <mode>::
|
||||
Sets the layout mode of the focused container. _mode_ can be one of _splith_,
|
||||
_splitv_, _toggle split_, _stacking_ or _tabbed_.
|
||||
|
@ -134,8 +112,8 @@ They are expected to be used with **bindsym** or at runtime through **swaymsg**(
|
|||
Equivalent to **split toggle**.
|
||||
|
||||
**sticky** <enable|disable|toggle>::
|
||||
If enabled and the windows is floating it will always be present on the active
|
||||
workspace on that output.
|
||||
"Sticks" a floating window to the current output so that it shows up on all
|
||||
workspaces.
|
||||
|
||||
The following commands may be used either in the configuration file
|
||||
or triggered at runtime.
|
||||
|
@ -149,7 +127,7 @@ 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
|
||||
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.
|
||||
+
|
||||
|
@ -195,18 +173,18 @@ The default colors are:
|
|||
[options="header"]
|
||||
|===========================================================================
|
||||
|color_class |border |background |text |indicator |child_border
|
||||
|background |n/a |#ffffffff |n/a |n/a |n/a
|
||||
|focused |#4c7899ff |#285577ff |#ffffffff |#2e9ef4ff |#285577ff
|
||||
|focused_inactive |#333333ff |#5f676aff |#ffffffff |#484e50ff |#5f676aff
|
||||
|unfocused |#333333ff |#222222ff |#888888ff |#292d2eff |#222222ff
|
||||
|urgent |#2f343aff |#900000ff |#ffffffff |#900000ff |#900000ff
|
||||
|placeholder |#000000ff |#0c0c0cff |#ffffffff |#000000ff |#0c0c0cff
|
||||
|background |n/a |#ffffff |n/a |n/a |n/a
|
||||
|focused |#4c7899 |#285577 |#ffffff |#2e9ef4 |#285577
|
||||
|focused_inactive |#333333 |#5f676a |#ffffff |#484e50 |#5f676a
|
||||
|unfocused |#333333 |#222222 |#888888 |#292d2e |#222222
|
||||
|urgent |#2f343a |#900000 |#ffffff |#900000 |#900000
|
||||
|placeholder |#000000 |#0c0c0c |#ffffff |#000000 |#0c0c0c
|
||||
|===========================================================================
|
||||
--
|
||||
|
||||
**debuglog** <on|off|toggle>::
|
||||
Enables, disables or toggles logging for debug. The toggle argument cannot
|
||||
be used in the configuration file.
|
||||
Enables, disables or toggles debug logging. The toggle argument cannot be used
|
||||
in the configuration file.
|
||||
|
||||
**exec** <shell command>::
|
||||
Executes _shell command_ with sh.
|
||||
|
@ -215,21 +193,32 @@ The default colors are:
|
|||
Like exec, but the shell command will be executed _again_ after *reload* or
|
||||
*restart* is executed.
|
||||
|
||||
**floating_maximum_size** <width> x <height>::
|
||||
Specifies the maximum dimensions of floating windows.
|
||||
Uses the container dimensions as default.
|
||||
-1 x -1 will remove any restriction on dimentions.
|
||||
0 x 0 has the same behavior as not setting any value.
|
||||
If in conflict this option has precedence over floating_minimum_size.
|
||||
|
||||
**floating_minimum_size** <width> x <height>::
|
||||
Specifies the minimum dimensions of floating windows.
|
||||
Default parameters are 75 x 50.
|
||||
-1 and 0 are invalid parameters, default will be used instead.
|
||||
|
||||
**floating_modifier** <modifier> [normal|inverse]::
|
||||
When the _modifier_ key is held down, you may use left click to drag floating
|
||||
When the _modifier_ key is held down, you may hold left click to move floating
|
||||
windows, and right click to resize them. Unlike i3, this modifier may also be
|
||||
used to resize and move windows that are tiled. With the _inverse_ mode
|
||||
enabled, left click is used for resizing and right click for dragging. The
|
||||
mode paramenter is optional and defaults to _normal_ if it isn't defined.
|
||||
|
||||
**floating_scroll** <up|down|left|right> [command]::
|
||||
Sets the command to be executed on scrolling in the specified
|
||||
direction while holding the floating modifier. Resets the
|
||||
command, when given no arguments.
|
||||
Sets a command to be executed when the mouse wheel is scrolled in the
|
||||
specified direction while holding the floating modifier. Resets the command,
|
||||
when given no arguments.
|
||||
|
||||
**focus_follows_mouse** <yes|no>::
|
||||
If set to _yes_, the currently focused view will change as you move your
|
||||
mouse around the screen to the view that ends up underneath your mouse.
|
||||
If set to _yes_, moving your mouse over a window will focus that window.
|
||||
|
||||
**for_window** <criteria> <command>::
|
||||
Whenever a window that matches _criteria_ appears, run list of commands. See
|
||||
|
@ -256,6 +245,15 @@ The default colors are:
|
|||
workspace (or current workspace), and _current_ changes gaps for the current
|
||||
view or workspace.
|
||||
|
||||
**hide_edge_borders** <none|vertical|horizontal|both>::
|
||||
Hide window borders adjacent to the screen edges. Default is _none_.
|
||||
|
||||
**input** <input device> <block of commands>::
|
||||
Append _{_ to this command, the following lines will be commands to configure
|
||||
the named input device, and _}_ on its own line will close the block.
|
||||
+
|
||||
See **sway-input**(5) for details.
|
||||
|
||||
**smart_gaps** <on|off>::
|
||||
If smart_gaps are _on_ then gaps will only be enabled if a workspace has more
|
||||
than one child container.
|
||||
|
@ -269,8 +267,20 @@ The default colors are:
|
|||
When _output_: place mouse at center of newly focused window when changing
|
||||
output. When _none_: don't move mouse.
|
||||
|
||||
**new_window** <normal|none|pixel> [<n>]::
|
||||
Set default border style for new windows.
|
||||
|
||||
**new_float** <normal|none|pixel> [<n>]::
|
||||
Set default border style for new floating windows. This only applies to
|
||||
windows that are spawned in floating mode, not windows that become floating
|
||||
after the fact.
|
||||
|
||||
**output** <name> <resolution|res> <WIDTHxHEIGHT>::
|
||||
Configures the specified output to use the given resolution.
|
||||
+
|
||||
_Note_: sway does not currently support modesetting. Your output's native
|
||||
resolution will be used and the screen will be scaled from the resolution
|
||||
specified to your native resolution.
|
||||
|
||||
**output** <name> <position|pos> <X,Y>::
|
||||
Configures the specified output to be arranged at the given position.
|
||||
|
|
Loading…
Reference in a new issue