1SWAY(5) SWAY(5)
2
3
4
6 sway - configuration file and commands
7
9 A sway configuration file is a list of sway commands that are executed
10 by sway on startup. These commands usually consist of setting your
11 preferences and setting key bindings. An example config is likely
12 present in /etc/sway/config for you to check out.
13
14 Lines in the configuration file might be extended through multiple
15 lines by adding a \ character at the end of line. e.g.:
16
17 bindsym Shift+XF86AudioRaiseVolume exec pactl set-sink-volume \
18 $(pactl list sinks | grep -B 1 RUNNING | sed '1q;d' | sed 's/[^0-9]\+//g') +5%
19
20 These commands can be executed in your config file, via swaymsg(1), or
21 via the bindsym command.
22
24 The following commands may only be used in the configuration file.
25
26 bar <block of commands>
27 Append { to this command, the following lines will be commands that
28 configure swaybar, and } on its own line to close the block.
29
30 See sway-bar(5) for details.
31
32 default_orientation <horizontal|vertical|auto>
33 Sets the default container layout for tiled containers.
34
35 set <name> <value>
36 Sets variable $name to value. You can use the new variable in the
37 arguments of future commands.
38
39 The following commands cannot be used directly in the configuration
40 file. They are expected to be used with bindsym or at runtime through
41 swaymsg(1).
42
43 border <normal|pixel> [<n>]
44 Set border style for focused window. normal includes a border of
45 thickness n and a title bar. pixel is a border without title bar n
46 pixels thick. Default is normal with border thickness 2.
47
48 border <none|toggle>
49 Set border style for focused window to none or toggle between the
50 available border styles: normal, pixel, none.
51
52 clipboard <content>
53 Store content in the system clipboard, with a MIME type of
54 "text/plain"
55
56 exit
57 Exit sway and end your Wayland session.
58
59 floating <enable|disable|toggle>
60 Make focused view floating, non-floating, or the opposite of what
61 it is now.
62
63 focus <direction>
64 Direction may be one of up, down, left, right, next, prev, parent,
65 or child. The directional focus commands will move the focus in
66 that direction. The next and prev directions will focus the next,
67 respectively previous, element in the current container. The parent
68 focus command will change the focus to the parent of the currently
69 focused container, which is useful, for example, to open a sibling
70 of the parent container, or to move the entire container around.
71
72 focus output <direction|name>
73 Direction may be one of up, down, left, right. The directional
74 focus commands will move the focus to the output in that direction.
75 When name is given, the focus is changed to the output with that
76 name.
77
78 focus mode_toggle
79 Toggles focus between floating view and tiled view.
80
81 fullscreen
82 Toggles fullscreen status for the focused view.
83
84 layout <mode>
85 Sets the layout mode of the focused container. mode can be one of
86 splith, splitv, toggle split, stacking, tabbed.
87
88 layout auto <mode>
89 Sets layout to one of the auto modes, i.e. one of left, right, top,
90 or bottom.
91
92 layout auto <next|prev>
93 Cycles between available auto layouts.
94
95 layout auto [master|ncol] [inc|set] <n>
96 Modify the number of master elements, respectively slave columns,
97 in the focused container. <n> can be a positive or negative
98 integer. These commands only have an effect if the focused
99 container uses one of the "auto" layouts.
100
101 layout toggle split
102 Cycles between available split layouts.
103
104 move <left|right|up|down> <[px]>
105 Moves the focused container left, right, up, or down. If the window
106 is floating it moves it px in that direction, defaulting to 10.
107 Tiled containers are moved the same regardless of the px argument.
108
109 move <next|prev|first>
110 Moving to prev or next swaps the container with its sibling in the
111 same container. Move first exchanges the focused element in an auto
112 layout with the first element, i.e. promotes the focused element to
113 master position.
114
115 move <container|window> to workspace <name>
116 Moves the focused container to the workspace identified by name.
117 name may be a special workspace name. See workspace.
118
119 move <container|window|workspace> to output <name|direction>
120 Moves the focused container or workspace to the output identified
121 by name or direction. direction may be one of up, down, left,
122 right.
123
124 move [to] scratchpad
125 Moves the focused window to the scratchpad.
126
127 reload
128 Reloads the sway config file without restarting sway.
129
130 resize <shrink|grow> <width|height> [<amount>] [px|ppt]
131 Resizes the currently focused container or view by amount. amount
132 is optional: the default value is 10 (either px or ppt depending on
133 the view type). The [px|ppt] parameter is optional. px specifies
134 that amount refers to pixels; ppt specifies that amount refers to
135 percentage points of the current dimension. Floating views use px
136 dimensions by default (but can use ppt if specified); tiled views
137 use ppt dimensions by default (but can use px if specified).
138
139 resize set <width> [px] <height> [px]
140 Sets the width and height of the currently focused container to
141 width pixels and height pixels. The [px] parameters are optional
142 and have no effect. This command only accepts pixel dimensions.
143
144 resize set <width|height> <amount> [px] [<width|height> <amount> [px]]
145 Sets the width and/or height of the currently focused container to
146 amount. The [px] parameters are optional and have no effect. This
147 command only accepts pixel dimensions.
148
149 scratchpad show
150 Shows a window from the scratchpad. Repeatedly using this command
151 will cycle through the windows in the scratchpad.
152
153 split <vertical|v|horizontal|h|toggle|t>
154 Splits the current container, vertically or horizontally. If
155 toggled, then the current container is split opposite to the parent
156 container.
157
158 splith
159 Equivalent to split horizontal.
160
161 splitv
162 Equivalent to split vertical.
163
164 splitt
165 Equivalent to split toggle.
166
167 sticky <enable|disable|toggle>
168 "Sticks" a floating window to the current output so that it shows
169 up on all workspaces.
170
171 The following commands may be used either in the configuration file or
172 triggered at runtime.
173
174 assign <criteria> [→] <workspace>
175 Assigns views matching criteria (see Criteria section below) to
176 workspace. The → (U+2192) is optional and purely for aesthetics.
177 This command is exactly equivalent to "for_window <criteria> move
178 container to workspace <workspace>".
179
180 bindsym <key combo> <command>
181 Binds key combo to execute command when pressed. You may use XKB
182 key names here (xev(1) is a good tool for discovering them). An
183 example bindsym command would be bindsym Mod1+Shift+f exec firefox,
184 which would execute Firefox if the alt, shift, and F keys are
185 pressed together. Any valid sway command is eligible to be bound to
186 a key combo.
187
188 bindcode <code> <command> is also available for binding with key
189 codes instead of key names.
190
191 client.<color_class> <border> <background> <text> <indicator>
192 <child_border>
193 The client commands control the colors of the view borders and
194 title bars. All client commands require five color values. (The one
195 exception is client.background which requires one color value.) If
196 you only want to specify a subset, supply default colors for all
197 the others. Colors must be defined in hex. i.e. #rrggbb or
198 #rrggbbaa, when including the alpha channel.
199
200 The command tokens are:
201
202 color_class
203 Specifies the view to which the colors apply.
204
205 client.background
206 The color a view will be painted, underneath the client
207 itself. This will only be visible if a client does not
208 fully cover its allocated view space. This command only
209 requires one color. Note: This is not currently
210 implemented.
211
212 client.focused
213 The view that has focus.
214
215 client.focused_inactive
216 A view that has focus within its container, but the
217 container is not focused.
218
219 client.placeholder
220 Used when drawing placeholder view contents. Only
221 background and text colors are used. Note: This is not
222 currently implemented.
223
224 client.unfocused
225 A view that does not have focus.
226
227 client.urgent
228 A view with an urgency hint. Note: This is not currently
229 implemented.
230
231 border
232 The border around the title bar.
233
234 background
235 The background of the title bar.
236
237 text
238 The text color of the title bar.
239
240 indicator
241 The color used to indicate where a new view will open. In a
242 tiled container, this would paint the right border of the
243 current view if a new view would be opened to the right.
244
245 child_border
246 The border around the view itself.
247
248 The default colors are:
249
250 ┌─────────────────┬─────────┬────────────┬─────────┬───────────┬──────────────┐
251 │color_class │ border │ background │ text │ indicator │ child_border │
252 ├─────────────────┼─────────┼────────────┼─────────┼───────────┼──────────────┤
253 │background │ n/a │ #ffffff │ n/a │ n/a │ n/a │
254 ├─────────────────┼─────────┼────────────┼─────────┼───────────┼──────────────┤
255 │focused │ #4c7899 │ #285577 │ #ffffff │ #2e9ef4 │ #285577 │
256 ├─────────────────┼─────────┼────────────┼─────────┼───────────┼──────────────┤
257 │focused_inactive │ #333333 │ #5f676a │ #ffffff │ #484e50 │ #5f676a │
258 ├─────────────────┼─────────┼────────────┼─────────┼───────────┼──────────────┤
259 │unfocused │ #333333 │ #222222 │ #888888 │ #292d2e │ #222222 │
260 ├─────────────────┼─────────┼────────────┼─────────┼───────────┼──────────────┤
261 │urgent │ #2f343a │ #900000 │ #ffffff │ #900000 │ #900000 │
262 ├─────────────────┼─────────┼────────────┼─────────┼───────────┼──────────────┤
263 │placeholder │ #000000 │ #0c0c0c │ #ffffff │ #000000 │ #0c0c0c │
264 └─────────────────┴─────────┴────────────┴─────────┴───────────┴──────────────┘
265
266 debuglog <on|off|toggle>
267 Enables, disables or toggles debug logging. The toggle argument
268 cannot be used in the configuration file.
269
270 default_border <normal|none|pixel> [<n>]
271 Set default border style for new windows. This command was
272 previously called new_window. While new_window still works, it is
273 considered deprecated and support for it will be removed in the
274 future.
275
276 default_floating_border <normal|none|pixel> [<n>]
277 Set default border style for new floating windows. This only
278 applies to windows that are spawned in floating mode, not windows
279 that become floating after the fact. This command was previously
280 called new_float. While new_float still works, it is considered
281 deprecated and support for it will be removed in the future.
282
283 exec <shell command>
284 Executes shell command with sh.
285
286 exec_always <shell command>
287 Like exec, but the shell command will be executed again after
288 reload or restart is executed.
289
290 floating_maximum_size <width> x <height>
291 Specifies the maximum dimensions of floating windows. Uses the
292 container dimensions as default. -1 x -1 will remove any
293 restriction on dimensions. 0 x 0 has the same behavior as not
294 setting any value. If in conflict, this option has precedence over
295 floating_minimum_size.
296
297 floating_minimum_size <width> x <height>
298 Specifies the minimum dimensions of floating windows. Default
299 parameters are 75 x 50. -1 and 0 are invalid parameters, default
300 will be used instead.
301
302 floating_modifier <modifier> [normal|inverse]
303 When the modifier key is held down, you may hold left click to move
304 floating windows, and right click to resize them. Unlike i3, this
305 modifier may also be used to resize and move windows that are
306 tiled. With the inverse mode enabled, left click is used for
307 resizing and right click for dragging. The mode parameter is
308 optional and defaults to normal if it isn’t defined.
309
310 floating_scroll <up|down|left|right> [command]
311 Sets a command to be executed when the mouse wheel is scrolled in
312 the specified direction while holding the floating modifier. Resets
313 the command, when given no arguments.
314
315 focus_follows_mouse <yes|no>
316 If set to yes, moving your mouse over a window will focus that
317 window.
318
319 font <font>
320 Sets font for use in title bars. Generally the format is something
321 like "Name Style Size" e.g. "Deja Vu Sans Book 12". You can also
322 use Pango font descriptions with "pango:font".
323
324 for_window <criteria> <command>
325 Whenever a window that matches criteria appears, run list of
326 commands. See Criteria section below.
327
328 gaps edge_gaps <on|off|toggle>
329 Whether or not to add gaps between views and workspace edges if
330 amount of inner gap is not zero. When off, no gap is added where
331 the view is aligned to the workspace edge, effectively creating
332 gaps only between views. The toggle argument cannot be used in the
333 configuration file.
334
335 gaps <amount>
336 Sets default amount pixels as the gap between each view, and around
337 each workspace.
338
339 gaps <inner|outer> <amount>
340 Sets default amount pixels as the inner or outer gap, where the
341 former affects spacing between views and the latter affects the
342 space around each workspace.
343
344 gaps <inner|outer> <all|workspace|current> <set|plus|minus> <amount>
345 Changes the gaps for the inner or outer gap. all changes the gaps
346 for all views or workspace, workspace changes gaps for all views in
347 current workspace (or current workspace), and current changes gaps
348 for the current view or workspace.
349
350 hide_edge_borders <none|vertical|horizontal|both|smart>
351 Hide window borders adjacent to the screen edges. Default is none.
352
353 input <input device> <block of commands>
354 Append { to this command, the following lines will be commands to
355 configure the named input device, and } on its own line will close
356 the block.
357
358 input * <block of commands> may be used to match all input devices.
359
360 See sway-input(5) for details.
361
362 kill
363 Kills (force-closes) the currently-focused container and all of its
364 children.
365
366 smart_gaps <on|off>
367 If smart_gaps are on then gaps will only be enabled if a workspace
368 has more than one child container.
369
370 mark <--add|--replace> <--toggle> <identifier>
371 Marks are arbitrary labels that can be used to identify certain
372 windows and then jump to them at a later time. By default, the mark
373 command sets identifier as the only mark on a window. By specifying
374 --add, mark will add identifier to the list of current marks. If
375 --toggle is specified mark will remove identifier if it is already
376 a label. Marks may be found by using a criteria. See the Criteria
377 section below.
378
379 mode <mode_name>
380 Switches to the given mode_name. The default mode is simply
381 default. To create a new mode append { to this command, the
382 following lines will be keybindings for that mode, and } on its own
383 line to close the block.
384
385 mouse_warping <output|none>
386 When output: place mouse at center of newly focused window when
387 changing output. When none: don’t move mouse.
388
389 no_focus <criteria>
390 Prevents windows matching <criteria> from being focused
391 automatically when they’re created. This does not apply to the
392 first window in a workspace.
393
394 output <name> <resolution|res> <WIDTHxHEIGHT>
395 Configures the specified output to use the given resolution.
396
397 Note: sway does not currently support setting the output mode. Your
398 output’s native resolution will be used and the screen will be
399 scaled from the resolution specified to your native resolution.
400
401 output <name> <position|pos> <X,Y>
402 Configures the specified output to be arranged at the given
403 position.
404
405 output <name> scale <I>
406 Configures the specified output to be scaled up by the specified
407 integer scaling factor (usually 2 for HiDPI screens).
408
409 output <name> <background|bg> <file> <mode>
410 Sets the wallpaper for the given output to the specified file,
411 using the given scaling mode (one of "stretch", "fill", "fit",
412 "center", "tile").
413
414 output <name> <background|bg> <color> solid_color
415 Sets the background of the given output to the specified color.
416 color should be specified as an #rrggbb (no alpha) color.
417
418 output <name> disable
419 Disables the specified output.
420
421 NOTES FOR THE OUTPUT COMMAND
422 You may combine output commands into one, like so:
423
424 output HDMI-A-1 res 1920x1080 pos 1920,0 bg ~/wallpaper.png stretch
425
426 You can get a list of output names like so:
427
428 swaymsg -t get_outputs
429
430 You may also match any output by using the output name "*". Be sure
431 to add this output config after the others, or it will be matched
432 instead of the others.
433
434 seamless_mouse <on|off>
435 Change output seamlessly when pointer touches edge of output.
436 Outputs need to be configured with perfectly aligned adjacent
437 positions for this option to have any effect.
438
439 show_marks <on|off>
440 If show_marks is on then marks will be showed in the window
441 decoration. However, any mark that starts with an underscore will
442 not be drawn even if the option is on. The default option is on.
443
444 unmark <identifier>
445 Unmark will remove identifier from the list of current marks on a
446 window. If no identifier is specified, then unmark will remove all
447 marks.
448
449 workspace [number] <name>
450 Switches to the specified workspace. The string "number" is
451 optional. The workspace name, if unquoted, may not contain the
452 string "output", as sway will assume that the command is moving a
453 workspace to an output, as described below.
454
455 workspace <prev|next>
456 Switches to the next workspace on the current output or on the next
457 output if currently on the last workspace.
458
459 workspace <prev_on_output|next_on_output>
460 Switches to the next workspace on the current output.
461
462 workspace <name> output <output>
463 Specifies that the workspace named name should appear on the
464 specified output.
465
466 workspace_auto_back_and_forth <yes|no>
467 When yes, repeating a workspace switch command will switch back to
468 the prior workspace. For example, if you are currently on workspace
469 1, switch to workspace 2, then invoke the "workspace 2" command
470 again, you will be returned to workspace 1. Defaults to no.
471
472 workspace_layout <default|stacking|tabbed|auto|auto left|auto
473 right|auto top|auto bottom>:: Specifies the start layout for new
474 workspaces.
475
476 include <path>
477 Includes a sub config file by path. path can be either a full path
478 or a path relative to the parent config.
479
481 A criteria is a string in the form of e.g.:
482
483 [class="[Rr]egex.*" title="some title"]
484
485 The string contains one or more (space separated) attribute/value
486 pairs. They are used by some commands to choose which views to execute
487 actions on. All attributes must match for the criteria to match.
488
489 Criteria may be used with either the for_window or assign commands to
490 specify operations to perform on new views. A criteria may also be used
491 to perform specific commands (ones that normally act upon one window)
492 on all views that match that criteria. For example:
493
494 Focus on a window with the mark "IRC": [con_mark="IRC"] focus
495
496 Kill all windows with the title "Emacs": [class="Emacs"] kill
497
498 Mark all Firefox windows with "Browser": [class="Firefox"] mark Browser
499
500 Currently supported attributes:
501
502 class
503 Compare value against the window class. Can be a regular
504 expression. If value is focused, then the window class must be the
505 same as that of the currently focused window.
506
507 con_id
508 Compare against the internal container ID, which you can find via
509 IPC.
510
511 con_mark
512 Compare against the window marks. Can be a regular expression.
513
514 floating
515 Matches against floating windows.
516
517 id
518 Compare value against the app id. Can be a regular expression.
519
520 title
521 Compare against the window title. Can be a regular expression. If
522 value is focused then the window title must be the same as that of
523 the currently focused window.
524
525 tiling
526 Matches against tiling windows.
527
528 workspace
529 Compare against the workspace name for this view. Can be a regular
530 expression. If the value is focused, then all the views on the
531 currently focused workspace matches.
532
534 sway(1) sway-input(5) sway-bar(5)
535
536
537
538 02/07/2019 SWAY(5)