summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-05-12 09:27:24 -0400
committerLibravatar GitHub <noreply@github.com>2018-05-12 09:27:24 -0400
commit867190e0828a139fa4529cde60d033a9389df42c (patch)
treec986cca12ecdb3e3ac4d94d38205028788315889
parentMerge pull request #1959 from RyanDwyer/ipc-get-seats (diff)
parentMerge remote-tracking branch 'origin/master' into scdoc (diff)
downloadsway-867190e0828a139fa4529cde60d033a9389df42c.tar.gz
sway-867190e0828a139fa4529cde60d033a9389df42c.tar.zst
sway-867190e0828a139fa4529cde60d033a9389df42c.zip
Merge pull request #1958 from swaywm/scdoc
Port man pages to scdoc
-rw-r--r--.build.yml1
-rw-r--r--README.de.md2
-rw-r--r--README.el.md2
-rw-r--r--README.fr.md2
-rw-r--r--README.it.md2
-rw-r--r--README.ja.md2
-rw-r--r--README.md2
-rw-r--r--README.pt.md2
-rw-r--r--README.ru.md2
-rw-r--r--README.uk.md2
-rw-r--r--meson.build30
-rw-r--r--sway/sway-bar.5.scd (renamed from sway/sway-bar.5.txt)140
-rw-r--r--sway/sway-input.5.scd (renamed from sway/sway-input.5.txt)109
-rw-r--r--sway/sway-security.7.txt242
-rw-r--r--sway/sway.1.scd95
-rw-r--r--sway/sway.1.txt109
-rw-r--r--sway/sway.5.scd582
-rw-r--r--sway/sway.5.txt521
-rw-r--r--swaygrab/json.c144
-rw-r--r--swaygrab/main.c298
-rw-r--r--swaygrab/swaygrab.1.txt76
-rw-r--r--swaylock/swaylock.1.scd103
-rw-r--r--swaymsg/swaymsg.1.scd66
23 files changed, 983 insertions, 1551 deletions
diff --git a/.build.yml b/.build.yml
index 3cfb7483..14433311 100644
--- a/.build.yml
+++ b/.build.yml
@@ -12,6 +12,7 @@ packages:
12 - gdk-pixbuf2 12 - gdk-pixbuf2
13 - libinput 13 - libinput
14 - libxkbcommon 14 - libxkbcommon
15 - scdoc
15sources: 16sources:
16 - https://github.com/swaywm/sway 17 - https://github.com/swaywm/sway
17 - https://github.com/swaywm/wlroots 18 - https://github.com/swaywm/wlroots
diff --git a/README.de.md b/README.de.md
index d63d8318..206a1040 100644
--- a/README.de.md
+++ b/README.de.md
@@ -58,7 +58,6 @@ Abhängigkeiten:
58* xwayland 58* xwayland
59* libinput >= 1.6.0 59* libinput >= 1.6.0
60* libcap 60* libcap
61* asciidoc
62* pcre 61* pcre
63* json-c >= 0.13 62* json-c >= 0.13
64* pango 63* pango
@@ -67,6 +66,7 @@ Abhängigkeiten:
67* pam ** 66* pam **
68* imagemagick (erforderlich für Bildaufnahme mit swaygrab) 67* imagemagick (erforderlich für Bildaufnahme mit swaygrab)
69* ffmpeg (erforderlich für Videoaufnahme swaygrab) 68* ffmpeg (erforderlich für Videoaufnahme swaygrab)
69* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (erforderlich für man pages)
70 70
71_\*Nur erforderlich für swaybar, swaybg, und swaylock_ 71_\*Nur erforderlich für swaybar, swaybg, und swaylock_
72 72
diff --git a/README.el.md b/README.el.md
index 682dbc84..5c70beff 100644
--- a/README.el.md
+++ b/README.el.md
@@ -51,7 +51,6 @@ To username μου στο Freenode είναι kon14 και θα με βρείτ
51* xwayland 51* xwayland
52* libinput >= 1.6.0 52* libinput >= 1.6.0
53* libcap 53* libcap
54* asciidoc
55* pcre 54* pcre
56* json-c >= 0.13 55* json-c >= 0.13
57* pango 56* pango
@@ -60,6 +59,7 @@ To username μου στο Freenode είναι kon14 και θα με βρείτ
60* pam ** 59* pam **
61* imagemagick (αναγκαίο για καταγραφή εικόνας μέσω του swaygrab) 60* imagemagick (αναγκαίο για καταγραφή εικόνας μέσω του swaygrab)
62* ffmpeg (αναγκαίο για καταγραφή video μέσω του swaygrab) 61* ffmpeg (αναγκαίο για καταγραφή video μέσω του swaygrab)
62* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages)
63 63
64_\*Απαιτείται μόνο για swaybar, swaybg, and swaylock_ 64_\*Απαιτείται μόνο για swaybar, swaybg, and swaylock_
65 65
diff --git a/README.fr.md b/README.fr.md
index 360fe618..0d2573f9 100644
--- a/README.fr.md
+++ b/README.fr.md
@@ -53,7 +53,6 @@ Installez les dépendances :
53* xwayland 53* xwayland
54* libinput >= 1.6.0 54* libinput >= 1.6.0
55* libcap 55* libcap
56* asciidoc
57* pcre 56* pcre
58* json-c >= 0.13 57* json-c >= 0.13
59* pango 58* pango
@@ -62,6 +61,7 @@ Installez les dépendances :
62* pam ** 61* pam **
63* imagemagick (requis pour la capture d'image avec swaygrab) 62* imagemagick (requis pour la capture d'image avec swaygrab)
64* ffmpeg (requis pour la capture vidéo avec swaygrab) 63* ffmpeg (requis pour la capture vidéo avec swaygrab)
64* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (requis pour les pages man)
65 65
66_\*Uniquement requis pour swaybar, swaybg, and swaylock_ 66_\*Uniquement requis pour swaybar, swaybg, and swaylock_
67 67
diff --git a/README.it.md b/README.it.md
index 94dc96c6..0d81ea54 100644
--- a/README.it.md
+++ b/README.it.md
@@ -54,7 +54,6 @@ Installa queste dipendenze:
54* xwayland 54* xwayland
55* libinput >= 1.6.0 55* libinput >= 1.6.0
56* libcap 56* libcap
57* asciidoc
58* pcre 57* pcre
59* json-c >= 0.13 58* json-c >= 0.13
60* pango 59* pango
@@ -63,6 +62,7 @@ Installa queste dipendenze:
63* pam ** 62* pam **
64* imagemagick (richiesto per catturare immagini con swaygrab) 63* imagemagick (richiesto per catturare immagini con swaygrab)
65* ffmpeg (rrichiesto per catturare video con swaygrab) 64* ffmpeg (rrichiesto per catturare video con swaygrab)
65* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (rrichiesto per man pages)
66 66
67_\*Richiesto solo per swaybar, swaybg, e swaylock_ 67_\*Richiesto solo per swaybar, swaybg, e swaylock_
68 68
diff --git a/README.ja.md b/README.ja.md
index 42d31b86..476d7472 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -44,7 +44,6 @@ Swayは沢山のディストリビューションで提供されています。"
44* xwayland 44* xwayland
45* libinput >= 1.6.0 45* libinput >= 1.6.0
46* libcap 46* libcap
47* asciidoc
48* pcre 47* pcre
49* json-c >= 0.13 48* json-c >= 0.13
50* pango 49* pango
@@ -53,6 +52,7 @@ Swayは沢山のディストリビューションで提供されています。"
53* pam ** 52* pam **
54* imagemagick (swaygrabでスクリーンショットを撮るのに必要です) 53* imagemagick (swaygrabでスクリーンショットを撮るのに必要です)
55* ffmpeg (swaygrabで画面を録画するのに必要です) 54* ffmpeg (swaygrabで画面を録画するのに必要です)
55* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (manで必要です)
56 56
57_\*swaybar,swaybg,swaylockでのみ必要です_ 57_\*swaybar,swaybg,swaylockでのみ必要です_
58 58
diff --git a/README.md b/README.md
index 30911765..49140fb8 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,6 @@ Install dependencies:
51* xwayland 51* xwayland
52* libinput >= 1.6.0 52* libinput >= 1.6.0
53* libcap 53* libcap
54* asciidoc
55* pcre 54* pcre
56* json-c >= 0.13 55* json-c >= 0.13
57* pango 56* pango
@@ -61,6 +60,7 @@ Install dependencies:
61* dbus >= 1.10 *** 60* dbus >= 1.10 ***
62* imagemagick (required for image capture with swaygrab) 61* imagemagick (required for image capture with swaygrab)
63* ffmpeg (required for video capture with swaygrab) 62* ffmpeg (required for video capture with swaygrab)
63* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages)
64 64
65_\*Only required for swaybar, swaybg, and swaylock_ 65_\*Only required for swaybar, swaybg, and swaylock_
66 66
diff --git a/README.pt.md b/README.pt.md
index 98ad72e3..d1ef245f 100644
--- a/README.pt.md
+++ b/README.pt.md
@@ -60,7 +60,6 @@ Antes de iniciar a compilação, instale as dependências:
60* xwayland 60* xwayland
61* libinput >= 1.6.0 61* libinput >= 1.6.0
62* libcap 62* libcap
63* asciidoc
64* pcre 63* pcre
65* json-c >= 0.13 64* json-c >= 0.13
66* pango 65* pango
@@ -69,6 +68,7 @@ Antes de iniciar a compilação, instale as dependências:
69* pam ** 68* pam **
70* imagemagick (capturar imagem com o swaygrab) 69* imagemagick (capturar imagem com o swaygrab)
71* ffmpeg (capturar vídeo com o swaygrab) 70* ffmpeg (capturar vídeo com o swaygrab)
71* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (man pages)
72 72
73_\*Dependência apenas de swaybar, swaybg, e swaylock_ 73_\*Dependência apenas de swaybar, swaybg, e swaylock_
74 74
diff --git a/README.ru.md b/README.ru.md
index 7329303e..3b3de19a 100644
--- a/README.ru.md
+++ b/README.ru.md
@@ -55,7 +55,6 @@ Sway доступен во многих дистрибутивах и наход
55* xwayland 55* xwayland
56* libinput >= 1.6.0 56* libinput >= 1.6.0
57* libcap 57* libcap
58* asciidoc
59* pcre 58* pcre
60* json-c >= 0.13 59* json-c >= 0.13
61* pango 60* pango
@@ -65,6 +64,7 @@ Sway доступен во многих дистрибутивах и наход
65* dbus >= 1.10 *** 64* dbus >= 1.10 ***
66* imagemagick (требуется для захвата изображений через swaygrab) 65* imagemagick (требуется для захвата изображений через swaygrab)
67* ffmpeg (требуется для захвата видео через swaygrab) 66* ffmpeg (требуется для захвата видео через swaygrab)
67* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages)
68 68
69_\*Требуется только для swaybar, swaybg и swaylock_ 69_\*Требуется только для swaybar, swaybg и swaylock_
70 70
diff --git a/README.uk.md b/README.uk.md
index 81bc70fa..55698487 100644
--- a/README.uk.md
+++ b/README.uk.md
@@ -60,7 +60,6 @@ Sway доступний у багатьох дистрибутивах Linux (а
60* xwayland 60* xwayland
61* libinput >= 1.6.0 61* libinput >= 1.6.0
62* libcap 62* libcap
63* asciidoc
64* pcre 63* pcre
65* json-c >= 0.13 64* json-c >= 0.13
66* pango 65* pango
@@ -69,6 +68,7 @@ Sway доступний у багатьох дистрибутивах Linux (а
69* pam ** 68* pam **
70* imagemagick (для захоплення зображень за допомогою swaygrab) 69* imagemagick (для захоплення зображень за допомогою swaygrab)
71* ffmpeg (для захоплення відео за допомогою swaygrab) 70* ffmpeg (для захоплення відео за допомогою swaygrab)
71* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages)
72 72
73_\*Лише для swaybar, swaybg та swaylock_ 73_\*Лише для swaybar, swaybg та swaylock_
74 74
diff --git a/meson.build b/meson.build
index f59d29b3..a1f406ec 100644
--- a/meson.build
+++ b/meson.build
@@ -40,7 +40,6 @@ libpam = cc.find_library('pam')
40math = cc.find_library('m') 40math = cc.find_library('m')
41rt = cc.find_library('rt') 41rt = cc.find_library('rt')
42git = find_program('git', required: false) 42git = find_program('git', required: false)
43a2x = find_program('a2x', required: false)
44 43
45conf_data = configuration_data() 44conf_data = configuration_data()
46 45
@@ -48,31 +47,30 @@ if gdk_pixbuf.found()
48 conf_data.set('HAVE_GDK_PIXBUF', true) 47 conf_data.set('HAVE_GDK_PIXBUF', true)
49endif 48endif
50 49
51if a2x.found() 50scdoc = find_program('scdoc', required: false)
51
52if scdoc.found()
53 sh = find_program('sh')
52 mandir = get_option('mandir') 54 mandir = get_option('mandir')
53 man_files = [ 55 man_files = [
54 'sway/sway.1.txt', 56 'sway/sway.1.scd',
55 'sway/sway.5.txt', 57 'sway/sway.5.scd',
56 'sway/sway-bar.5.txt', 58 'sway/sway-bar.5.scd',
57 'sway/sway-input.5.txt', 59 'sway/sway-input.5.scd',
58 'sway/sway-security.7.txt', 60 'swaylock/swaylock.1.scd',
59 'swaymsg/swaymsg.1.txt', 61 'swaymsg/swaymsg.1.scd',
60 ] 62 ]
61 foreach filename : man_files 63 foreach filename : man_files
62 topic = filename.split('.')[-3].split('/')[-1] 64 topic = filename.split('.')[-3].split('/')[-1]
63 section = filename.split('.')[-2] 65 section = filename.split('.')[-2]
66 output = '@0@.@1@'.format(topic, section)
64 67
65 custom_target( 68 custom_target(
66 'man-@0@-@1@'.format(topic, section), 69 output,
67 input: filename, 70 input: filename,
68 output: '@BASENAME@', 71 output: output,
69 command: [ 72 command: [
70 a2x, 73 sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.path(), output)
71 '--no-xmllint',
72 '--doctype', 'manpage',
73 '--format', 'manpage',
74 '--destination-dir', meson.current_build_dir(),
75 '@INPUT@'
76 ], 74 ],
77 install: true, 75 install: true,
78 install_dir: '@0@/man@1@'.format(mandir, section) 76 install_dir: '@0@/man@1@'.format(mandir, section)
diff --git a/sway/sway-bar.5.txt b/sway/sway-bar.5.scd
index 99238952..a61e2829 100644
--- a/sway/sway-bar.5.txt
+++ b/sway/sway-bar.5.scd
@@ -1,159 +1,147 @@
1///// 1sway-bar(5)
2vim:set ts=4 sw=4 tw=82 noet: 2
3///// 3# NAME
4sway-bar (5) 4
5============
6
7Name
8----
9sway-bar - bar configuration file and commands 5sway-bar - bar configuration file and commands
10 6
11Description 7# DESCRIPTION
12-----------
13 8
14Sway allows configuring swaybar in the sway configuration file. 9Sway allows configuring swaybar in the sway configuration file. Swaybar
15Swaybar commands must be used inside a _bar { }_ block in the config file. 10commands must be used inside a _bar { }_ block in the config file.
16 11
12# COMMANDS
17 13
18Commands 14*status\_command* <status command>
19-------- 15 Executes the bar _status command_ with _sh -c_. Each line of text printed
16 to stdout from this command will be displayed in the status area of the
17 bar. You may also use the i3bar JSON protocol:
20 18
21**status_command** <status command>::
22 Executes the bar _status command_ with _sh -c_. Each line of text printed to
23 stdout from this command will be displayed in the status area of the bar. You
24 may also use the i3bar JSON protocol:
25 +
26 https://i3wm.org/docs/i3bar-protocol.html 19 https://i3wm.org/docs/i3bar-protocol.html
27 20
28**pango_markup** <enabled|disabled>:: 21*pango\_markup* enabled|disabled
29 Enables or disables pango markup for status lines. This has no effect on 22 Enables or disables pango markup for status lines. This has no effect on
30 status lines using the i3bar JSON protocol. 23 status lines using the i3bar JSON protocol.
31 24
32**id** <bar_id>:: 25*id* <bar\_id>
33 Sets the ID of the bar. 26 Sets the ID of the bar.
34 27
35**position** <top|bottom>:: 28*position* top|bottom
36 Sets position of the bar. Default is _bottom_. 29 Sets position of the bar. Default is _bottom_.
37 30
38**output** <output>:: 31*output* <output>
39 Restrict the bar to a certain output, can be specified multiple times. If the 32 Restrict the bar to a certain output, can be specified multiple times. If
40 output command is omitted, the bar will be displayed on all outputs. 33 the output command is omitted, the bar will be displayed on all outputs.
41 34
42**swaybar_command** <command>:: 35*swaybar\_command* <command>
43 Executes custom bar command, default is _swaybar_. 36 Executes custom bar command. Default is _swaybar_.
44 37
45**font** <font>:: 38*font* <font>
46 Specifies the font to be used in the bar. 39 Specifies the font to be used in the bar.
47 40
48**separator_symbol** <symbol>:: 41*separator\_symbol* <symbol>
49 Specifies the separator symbol to separate blocks on the bar. 42 Specifies the separator symbol to separate blocks on the bar.
50 43
51**wrap_scroll** <yes|no>:: 44*wrap\_scroll* yes|no
52 Enables or disables wrapping when scrolling through workspaces with the 45 Enables or disables wrapping when scrolling through workspaces with the
53 scroll wheel. Default is _no_. 46 scroll wheel. Default is _no_.
54 47
55**workspace_buttons** <yes|no>:: 48*workspace\_buttons* yes|no
56 Enables or disables workspace buttons on the bar. Default is _yes_. 49 Enables or disables workspace buttons on the bar. Default is _yes_.
57 50
58**strip_workspace_numbers** <yes|no>:: 51*strip\_workspace\_numbers* yes|no
59 If set to _yes_, then workspace numbers will be omitted from the workspace 52 If set to _yes_, then workspace numbers will be omitted from the workspace
60 button and only the custom name will be shown. Default is _no_. 53 button and only the custom name will be shown. Default is _no_.
61 54
62**binding_mode_indicator** <yes|no>:: 55*binding\_mode\_indicator* yes|no
63 Enable or disable binding mode indicator. Default is _yes_. 56 Enable or disable binding mode indicator. Default is _yes_.
64 57
65**height** <height>:: 58*height* <height>
66 Sets the height of the bar. Default height will match the font size. 59 Sets the height of the bar. Default height will match the font size.
67 60
68Tray 61## TRAY
69----
70 62
71Swaybar provides a system tray where programs such as NetworkManager, VLC, 63Swaybar provides a system tray where third-party applications may place icons.
72Pidgin, etc. can place little icons. The following commands configure 64The following commands configure the tray.
73interaction with the tray or individual icons.
74The _button_ argument in all following commands is a Linux input event code as
75defined in linux/input-event-codes.h. This is because wayland defines button
76codes in this manner.
77 65
78**activate_button** <button>:: 66The _button_ argument in all cases is a platform-specific button code. On Linux
67you can find a list of these at linux/input-event-codes.h.
68
69*activate\_button* <button>
79 Sets the button to be used for the _activate_ (primary click) tray item 70 Sets the button to be used for the _activate_ (primary click) tray item
80 event. The default is BTN_LEFT (0x110). 71 event. The default is BTN\_LEFT (0x110).
81 72
82**context_button** <button>:: 73*context\_button* <button>
83 Sets the button to be used for the _context menu_ (right click) tray item 74 Sets the button to be used for the _context menu_ (right click) tray item
84 event. The default is BTN_RIGHT (0x111). 75 event. The default is BTN\_RIGHT (0x111).
85 76
86**secondary_button** <button>:: 77*secondary\_button* <button>
87 Sets the button to be used for the _secondary_ (middle click) tray item 78 Sets the button to be used for the _secondary_ (middle click) tray item
88 event. The default is BTN_MIDDLE (0x112). 79 event. The default is BTN\_MIDDLE (0x112).
89 80
90**tray_output** none|all|<name>:: 81*tray\_output* none|all|<output>
91 Sets the output that the tray will appear on or none. Unlike i3bar, swaybar 82 Sets the output that the tray will appear on or none. Unlike i3bar, swaybar
92 should be able to show icons on any number of bars and outputs without 83 is able to show icons on any number of bars and outputs without races.
93 races. Because of this, the default value for this is _all_. 84 The default is _all_.
94 85
95**tray_padding** <px> [px]:: 86*tray\_padding* <px> [px]
96 Sets the pixel padding of the system tray. This padding will surround the 87 Sets the pixel padding of the system tray. This padding will surround the
97 tray on all sides and between each item. The default value for _px_ is 2. 88 tray on all sides and between each item. The default value for _px_ is 2.
98 89
99**icon_theme** <name>:: 90*icon\_theme* <name>
100 Sets the icon theme that sway will look for item icons in. This option has 91 Sets the icon theme that sway will look for item icons in. This option has
101 no default value, because sway will always default to the fallback theme, 92 no default value, because sway will always default to the fallback theme,
102 hicolor. 93 hicolor.
103 94
104Colors 95## COLORS
105------
106 96
107Colors are defined within a _colors { }_ block inside a _bar { }_ block. Colors 97Colors are defined within a _colors { }_ block inside a _bar { }_ block. Colors
108must be defined in hex. i.e. _#rrggbb_ or _#rrggbbaa_ when including the alpha 98must be defined in hex: _#RRGGBB_ or _#RRGGBBAA_.
109channel.
110 99
111**background** <color>:: 100*background* <color>
112 Background color of the bar. 101 Background color of the bar.
113 102
114**statusline** <color>:: 103*statusline* <color>
115 Text color to be used for the statusline. 104 Text color to be used for the statusline.
116 105
117**separator** <color>:: 106*separator* <color>
118 Text color to be used for the separator. 107 Text color to be used for the separator.
119 108
120**focused_background** <color>:: 109*focused\_background* <color>
121 Background color of the bar on the currently focused monitor output. If not 110 Background color of the bar on the currently focused monitor output. If not
122 used, the color will be taken from _background_. 111 used, the color will be taken from _background_.
123 112
124**focused_statusline** <color>:: 113*focused\_statusline* <color>
125 Text color to be used for the statusline on the currently focused monitor 114 Text color to be used for the statusline on the currently focused monitor
126 output. If not used, the color will be taken from _statusline_. 115 output. If not used, the color will be taken from _statusline_.
127 116
128**focused_separator** <color>:: 117*focused\_separator* <color>
129 Text color to be used for the separator on the currently focused monitor 118 Text color to be used for the separator on the currently focused monitor
130 output. If not used, the color will be taken from _separator_. 119 output. If not used, the color will be taken from _separator_.
131 120
132**focused_workspace** <border> <background> <text>:: 121*focused\_workspace* <border> <background> <text>
133 Border, background and text color for a workspace button when the workspace 122 Border, background and text color for a workspace button when the workspace
134 has focus. 123 has focus.
135 124
136**active_workspace** <border> <background> <text>:: 125*active\_workspace* <border> <background> <text>
137 Border, background and text color for a workspace button when the workspace is 126 Border, background and text color for a workspace button when the workspace
138 active (visible) on some output, but the focus is on another one. You can only 127 is active (visible) on some output, but the focus is on another one. You
139 tell this apart from the focused workspace when you are using multiple 128 can only tell this apart from the focused workspace when you are using
140 monitors. 129 multiple monitors.
141 130
142**inactive_workspace** <border> <background> <text>:: 131*inactive\_workspace* <border> <background> <text>
143 Border, background and text color for a workspace button when the workspace 132 Border, background and text color for a workspace button when the workspace
144 does not have focus and is not active (visible) on any output. This will be 133 does not have focus and is not active (visible) on any output. This will be
145 the case for most workspaces. 134 the case for most workspaces.
146 135
147**urgent_workspace** <border> <background> <text>:: 136*urgent\_workspace* <border> <background> <text>
148 Border, background and text color for a workspace button when the workspace 137 Border, background and text color for a workspace button when the workspace
149 contains a window with the urgency hint set. 138 contains a window with the urgency hint set.
150 139
151**binding_mode** <border> <background> <text>:: 140*binding\_mode* <border> <background> <text>
152 Border, background and text color for the binding mode indicator. If not used, 141 Border, background and text color for the binding mode indicator. If not used,
153 the colors will be taken from _urgent_workspace_. 142 the colors will be taken from _urgent\_workspace_.
154 143
144# SEE ALSO
155 145
156See Also 146*sway*(5)
157--------
158 147
159**sway**(5)
diff --git a/sway/sway-input.5.txt b/sway/sway-input.5.scd
index c7305503..c07460b1 100644
--- a/sway/sway-input.5.txt
+++ b/sway/sway-input.5.scd
@@ -1,58 +1,50 @@
1///// 1sway-input(5)
2vim:set ft=asciidoc ts=4 sw=4 tw=82 noet: 2
3///// 3# NAME
4sway-input (5) 4
5==============
6
7Name
8----
9sway-input - input configuration file and commands 5sway-input - input configuration file and commands
10 6
11Description 7# DESCRIPTION
12-----------
13 8
14Sway allows for configuration of devices within the sway configuration file. 9Sway allows for configuration of devices within the sway configuration file.
15sway-input commands must be used inside an _input { }_ block in the config. 10sway-input commands must be used inside an _input { }_ block in the config.
16To obtain a list of available device identifiers, run **swaymsg -t get_inputs**. 11To obtain a list of available device identifiers, run *swaymsg -t get\_inputs*.
17 12
18Input Commands 13# INPUT COMMANDS
19--------------
20 14
21Keyboard Configuration 15## KEYBOARD CONFIGURATION
22~~~~~~~~~~~~~~~~~~~~~~
23 16
24For more information on these xkb configuration options, see 17For more information on these xkb configuration options, see
25**xkeyboard-config**(7). 18*xkeyboard-config*(7).
26 19
27**input** <identifier> xkb_layout <layout_name>:: 20*input* <identifier> xkb\_layout <layout\_name>
28 Sets the layout of the keyboard like _us_ or _de_. 21 Sets the layout of the keyboard like _us_ or _de_.
29 22
30**input** <identifier> xkb_model <model_name>:: 23*input* <identifier> xkb\_model <model\_name>
31 Sets the model of the keyboard. This has an influence for some extra keys your 24 Sets the model of the keyboard. This has an influence for some extra keys
32 keyboard might have. 25 your keyboard might have.
33 26
34**input** <identifier> xkb_options <options>:: 27*input* <identifier> xkb\_options <options>
35 Sets extra xkb configuration options for the keyboard. 28 Sets extra xkb configuration options for the keyboard.
36 29
37**input** <identifier> xkb_rules <rules>:: 30*input* <identifier> xkb\_rules <rules>
38 Sets files of rules to be used for keyboard mapping composition. 31 Sets files of rules to be used for keyboard mapping composition.
39 32
40**input** <identifier> xkb_variant <variant>:: 33*input* <identifier> xkb\_variant <variant>
41 Sets the variant of the keyboard like _dvorak_ or _colemak_. 34 Sets the variant of the keyboard like _dvorak_ or _colemak_.
42 35
43Mapping Configuration 36## MAPPING CONFIGURATION
44---------------------
45 37
46**input** <identifier> map_to_output <identifier>:: 38*input* <identifier> map\_to\_output <identifier>
47 Maps inputs from this device to the specified output. Only meaningful if the 39 Maps inputs from this device to the specified output. Only meaningful if the
48 device is a pointer, touch, or drawing tablet device. 40 device is a pointer, touch, or drawing tablet device.
49 41
50**input** <identifier> map_to_region <WxH\@X,Y>:: 42*input* <identifier> map\_to\_region <WxH@X,Y>
51 Maps inputs from this device to the specified region of the global output 43 Maps inputs from this device to the specified region of the global output
52 layout. Only meaningful if the device is a pointer, touch, or drawing tablet 44 layout. Only meaningful if the device is a pointer, touch, or drawing tablet
53 device. 45 device.
54 46
55**input** <identifier> map_from_region <X1xY1> <X2xY2>:: 47*input* <identifier> map\_from\_region <X1xY1> <X2xY2>
56 Ignores inputs from this device that do not occur within the specified 48 Ignores inputs from this device that do not occur within the specified
57 region. Can be in millimeters (e.g. 10x20mm 20x40mm) or in terms of 0..1 49 region. Can be in millimeters (e.g. 10x20mm 20x40mm) or in terms of 0..1
58 (e.g. 0.5x0.5 0.7x0.7). Not all devices support millimeters. Only meaningful 50 (e.g. 0.5x0.5 0.7x0.7). Not all devices support millimeters. Only meaningful
@@ -60,72 +52,69 @@ Mapping Configuration
60 as a drawing tablet or touch screen - most pointers provide events relative 52 as a drawing tablet or touch screen - most pointers provide events relative
61 to the previous frame). 53 to the previous frame).
62 54
63Libinput Configuration 55## LIBINPUT CONFIGURATION
64~~~~~~~~~~~~~~~~~~~~~~
65 56
66**input** <identifier> accel_profile <adaptive|flat>:: 57*input* <identifier> accel\_profile adaptive|flat
67 Sets the pointer acceleration profile for the specified input device. 58 Sets the pointer acceleration profile for the specified input device.
68 59
69**input** <identifier> click_method <none|button_areas|clickfinger>:: 60*input* <identifier> click\_method none|button\_areas|clickfinger
70 Changes the click method for the specified device. 61 Changes the click method for the specified device.
71 62
72**input** <identifier> drag_lock <enabled|disabled>:: 63*input* <identifier> drag\_lock enabled|disabled
73 Enables or disables drag lock for specified input device. 64 Enables or disables drag lock for specified input device.
74 65
75**input** <identifier> dwt <enabled|disabled>:: 66*input* <identifier> dwt enabled|disabled
76 Enables or disables disable-while-typing for the specified input device. 67 Enables or disables disable-while-typing for the specified input device.
77 68
78**input** <identifier> events <enabled|disabled|disabled_on_external_mouse>:: 69*input* <identifier> events enabled|disabled|disabled\_on\_external\_mouse
79 Enables or disables send_events for specified input device. 70 Enables or disables send_events for specified input device. (Disabling
80 (Disabling send_events disables the input device) 71 send_events disables the input device)
81 72
82**input** <identifier> left_handed <enabled|disabled>:: 73*input* <identifier> left\_handed enabled|disabled
83 Enables or disables left handed mode for specified input device. 74 Enables or disables left handed mode for specified input device.
84 75
85**input** <identifier> middle_emulation <enabled|disabled>:: 76*input* <identifier> middle\_emulation enabled|disabled
86 Enables or disables middle click emulation. 77 Enables or disables middle click emulation.
87 78
88**input** <identifier> natural_scroll <enabled|disabled>:: 79*input* <identifier> natural\_scroll enabled|disabled
89 Enables or disables natural (inverted) scrolling for the specified input 80 Enables or disables natural (inverted) scrolling for the specified input
90 device. 81 device.
91 82
92**input** <identifier> pointer_accel <[-1,1]>:: 83*input* <identifier> pointer\_accel [<-1|1>]
93 Changes the pointer acceleration for the specified input device. 84 Changes the pointer acceleration for the specified input device.
94 85
95**input** <identifier> repeat_delay <milliseconds>:: 86*input* <identifier> repeat\_delay <milliseconds>
96 Sets the amount of time a key must be held before it starts repeating. 87 Sets the amount of time a key must be held before it starts repeating.
97 88
98**input** <identifier> repeat_rate <characters per second>:: 89*input* <identifier> repeat\_rate <characters per second>
99 Sets the frequency of key repeats once the repeat_delay has passed. 90 Sets the frequency of key repeats once the repeat\_delay has passed.
100 91
101**input** <identifier> scroll_method <none|two_finger|edge|on_button_down>:: 92*input* <identifier> scroll\_method none|two\_finger|edge|on\_button\_down
102 Changes the scroll method for the specified input device. 93 Changes the scroll method for the specified input device.
103 94
104**input** <identifier> tap <enabled|disabled>:: 95*input* <identifier> tap enabled|disabled
105 Enables or disables tap for specified input device. 96 Enables or disables tap for specified input device.
106 97
107Seat Configuration 98## SEAT CONFIGURATION
108------------------
109 99
110Configure options for multiseat mode. sway-seat commands must be used inside a 100Configure options for multiseat mode. sway-seat commands must be used inside a
111_seat { }_ block in the config. 101_seat { }_ block in the config.
112 102
113A _seat_ is a collection of input devices that act independently of each other. 103A *seat* is a collection of input devices that act independently of each other.
114Seats are identified by name and the default seat is _seat0_ if no seats are 104Seats are identified by name and the default seat is _seat0_ if no seats are
115configured. Each seat has an independent keyboard focus and a separate cursor that 105configured. Each seat has an independent keyboard focus and a separate cursor that
116is controlled by the pointer devices of the seat. This is useful for multiple 106is controlled by the pointer devices of the seat. This is useful for multiple
117people using the desktop at the same time with their own devices (each sitting in 107people using the desktop at the same time with their own devices (each sitting
118their own "seat"). 108in their own "seat").
119 109
120**seat** <name> attach <input_identifier>:: 110*seat* <name> attach <input\_identifier>
121 Attach an input device to this seat by its input identifier. A special value 111 Attach an input device to this seat by its input identifier. A special
122 of _*_ will attach all devices to the seat. 112 value of "\*" will attach all devices to the seat.
123 113
124**seat** <name> fallback <true|false>:: 114*seat* <name> fallback true|false
125 Set this seat as the fallback seat. A fallback seat will attach any device not 115 Set this seat as the fallback seat. A fallback seat will attach any device
126 explicitly attached to another seat (similar to a "default" seat). 116 not explicitly attached to another seat (similar to a "default" seat).
127 117
128See Also 118# SEE ALSO
129--------
130 119
131**sway**(5) 120*sway*(5)
diff --git a/sway/sway-security.7.txt b/sway/sway-security.7.txt
deleted file mode 100644
index 2cb4e76d..00000000
--- a/sway/sway-security.7.txt
+++ /dev/null
@@ -1,242 +0,0 @@
1/////
2vim:set ts=4 sw=4 tw=82 noet:
3/////
4sway-security (7)
5=================
6
7Name
8----
9sway-security - Guidelines for securing your sway install
10
11Security Overview
12-----------------
13
14**Sway is NOT secure**. We are working on it but do not trust that we have it all
15figured out yet. The following man page is provisional.
16
17Securing sway requires careful configuration of your environment, the sort that's
18usually best suited to a distribution maintainer who wants to ship a secure sway
19environment in their distribution. Sway provides a number of means of securing it but
20you must make a few changes external to sway first.
21
22Configuration of security features is limited to files in the security directory
23(this is likely /etc/sway/security.d/*, but depends on your installation prefix).
24Files in this directory must be owned by root:root and chmod 644 or 444. The default
25security configuration is installed to /etc/sway/security.d/00-defaults, and
26should not be modified - it will be updated with the latest recommended security
27defaults between releases. To override the defaults, you should add more files to
28this directory.
29
30Environment security
31--------------------
32
33LD_PRELOAD is a mechanism designed to ruin the security of your system. There are
34a number of strategies for dealing with this, but they all suck a little. In order
35of most practical to least practical:
36
371. Only run important programs via exec. Sway's exec command will ensure that
38 LD_PRELOAD is unset when running programs.
39
402. Remove LD_PRELOAD support from your dynamic loader (requires patching libc).
41 This may break programs that rely on LD_PRELOAD for legitimate functionality,
42 but this is the most effective solution.
43
443. Use static linking for important programs. Of course statically linked programs
45 are unaffected by the dynamic linking security dumpster fire.
46
47Note that should you choose method 1, you MUST ensure that sway itself isn't
48compromised by LD_PRELOAD. It probably isn't, but you can be sure by setting
49/usr/bin/sway to a+s (setuid), which will instruct the dynamic linker not to
50permit LD_PRELOAD for it (and will also run it as root, which sway will shortly
51drop). You could also statically link sway itself.
52
53Note that LD_LIBRARY_PATH has all of these problems, and the same solutions.
54
55Read your log
56-------------
57
58Sway does sanity checks and prints big red warnings to stderr if they fail. Read
59them.
60
61Feature policies
62----------------
63
64Certain sway features are security sensitive and may be configured with security
65policies. These features are:
66
67**background**::
68 Permission for a program to become the background.
69
70**fullscreen**::
71 Permission to become fullscreen. Note that users can always make a window
72 fullscreen themselves with the fullscreen command.
73
74**ipc**::
75 Permission to connect to sway's IPC socket.
76
77**keyboard**::
78 Permission to receive keyboard events (only while they are focused).
79
80**lock**::
81 Permission for a program to act as a screen locker. This involves becoming
82 fullscreen (on all outputs) and receiving _all_ keyboard and mouse input for
83 the duration of the process.
84
85**mouse**::
86 Permission to receive mouse events (only while the mouse is over them).
87
88**panel**::
89 Permission for a program to stick its windows to the sides of the screen.
90
91**screenshot**::
92 Permission to take screenshots or record the screen.
93
94By default, no permissions are granted (though saner defaults are provided in
95/etc/sway/config.d/security). You can use the following configuration options to control
96a program's access:
97
98**permit** <executable> <features...>::
99 Permits <executable> to use <features> (each feature separated by a space).
100 <executable> may be * to affect the default policy, or the full path to the
101 executable file.
102
103**reject** <executable> <features...>::
104 Disallows <executable> from using <features> (each feature separated by a space).
105 <executable> may be * to affect the default policy, or the full path to the
106 executable file.
107
108Note that policy enforcement requires procfs to be mounted at /proc and the sway
109process to be able to access _/proc/[pid]/exe_ (see **procfs(5)** for details on
110this access - setcap cap_sys_ptrace=eip /usr/bin/sway should do the trick). If
111sway is unable to read _/proc/[pid]/exe_, it will apply the default policy.
112
113To work correctly, sway's own programs require the following permissions:
114
115- swaybg: background
116- swaylock: lock, keyboard
117- swaybar: panel, mouse, ipc
118- swaygrab: screenshot, ipc
119
120When you first declare a policy for an executable, it will inherit the default
121policy. Further changes to the default policy will not retroactively affect which
122permissions an earlier policy inherits. You must explicitly reject any features
123from the default policy that you do not want an executable to receive permission
124for.
125
126Command policies
127----------------
128
129You can also control the context from which a command may execute. The different
130contexts you can control are:
131
132**config**::
133 Can be run from your config file.
134
135**binding**::
136 Can be run from bindsym or bindcode commands.
137
138**ipc**::
139 Can be run by IPC clients.
140
141**criteria**::
142 Can be run when evaluating window criteria.
143
144**all**::
145 Shorthand for granting permission in all contexts.
146
147By default a command is allowed to execute in any context. To configure this, open
148a commands block and fill it with policies:
149
150 commands {
151 <name> <contexts...>
152 ...
153 }
154
155For example, you could do this to limit the use of the focus command to just
156binding and criteria:
157
158 commands {
159 focus binding criteria
160 }
161
162Setting a command policy overwrites any previous policy that was in place.
163
164IPC policies
165------------
166
167Disabling IPC access via swaymsg is encouraged if you intend to secure the IPC
168socket, because any program that can execute swaymsg could circumvent its own
169security policy by simply invoking swaymsg.
170
171You can configure which features of IPC are available for particular clients:
172
173 ipc <executable> {
174 ...
175 }
176
177You may use * for <executable> to configure the default policy for all clients.
178Configuring IPC policies for specific executables is not supported on FreeBSD, and
179the default policy will be applied to all IPC connections.
180
181The following commands are available within this block:
182
183**bar-config** <enabled|disabled>::
184 Controls GET_BAR_CONFIG (required for swaybar to work at all).
185
186**command** <enabled|disabled>::
187 Controls executing sway commands via IPC.
188
189**inputs** <enabled|disabled>::
190 Controls GET_INPUTS (input device information).
191
192**marks** <enabled|disabled>::
193 Controls GET_MARKS.
194
195**outputs** <enabled|disabled>::
196 Controls GET_OUTPUTS.
197
198**seats** <enabled|disabled>::
199 Controls GET_SEATS.
200
201**tree** <enabled|disabled>::
202 Controls GET_TREE.
203
204**workspaces** <enabled|disabled>::
205 Controls GET_WORKSPACES.
206
207You can also control which IPC events can be raised with an events block:
208
209 ipc <executable> {
210 events {
211 ...
212 }
213 }
214
215The following commands are valid within an IPC events block:
216
217**binding** <enabled|disabled>::
218 Controls keybinding notifications (disabled by default).
219
220**input** <enabled|disabled>::
221 Controls input device hotplugging notifications.
222
223**mode** <enabled|disabled>::
224 Controls output hotplugging notifications.
225
226**output** <enabled|disabled>::
227 Controls output hotplugging notifications.
228
229**window** <enabled|disabled>::
230 Controls window event notifications.
231
232**workspace** <enabled|disabled>::
233 Controls workspace notifications.
234
235In each of these blocks, you may use * (as in "* enabled" or "* disabled") to
236control access to every feature at once.
237
238Authors
239-------
240Maintained by Drew DeVault <sir@cmpwn.com>, who is assisted by other open
241source contributors. For more information about sway development, see
242<https://github.com/swaywm/sway>.
diff --git a/sway/sway.1.scd b/sway/sway.1.scd
new file mode 100644
index 00000000..5b770cce
--- /dev/null
+++ b/sway/sway.1.scd
@@ -0,0 +1,95 @@
1sway(1)
2
3# NAME
4
5sway - SirCmpwn's Wayland window manager
6
7# SYNOPSIS
8
9*sway* [options...] [command]
10
11# OPTIONS
12
13*-h, --help*
14 Show help message and quit.
15
16*-c, --config* <config>
17 Specifies a config file.
18
19*-C, --validate*
20 Check the validity of the config file, then exit.
21
22*-d, --debug*
23 Enables full logging, including debug information.
24
25*-v, --version*
26 Show the version number and quit.
27
28*-V, --verbose*
29 Enables more verbose logging.
30
31*--get-socketpath*
32 Gets the IPC socket path and prints it, then exits.
33
34# DESCRIPTION
35
36sway was created to fill the need of an i3-like window manager for Wayland. The
37upstream i3 developers have no intention of porting i3 to Wayland, and projects
38proposed by others ended up as vaporware. Many thanks to the i3 folks for
39providing such a great piece of software, so good that your users would rather
40write an entirely new window manager from scratch that behaved _exactly_ like i3
41rather than switch to something else.
42
43You can run sway directly from a tty, or via a Wayland-compatible login manager.
44
45# CONFIGURATION
46
47sway searches for a config file in the following locations, in this order:
48
49. ~/.sway/config
50. $XDG\_CONFIG\_HOME/sway/config (suggested location)
51. ~/.i3/config
52. $XDG\_CONFIG\_HOME/i3/config
53. /etc/sway/config
54. /etc/i3/config
55
56If unset, $XDG\_CONFIG\_HOME defaults to *~/.config*.
57
58An error is raised when no config file is found. The recommended default
59configuration is usually installed to */etc/sway/config*; you are encouraged to
60copy this to *~/.config/sway/config* and edit it from there.
61
62For information on the config file format, see *sway*(5).
63
64# IPC COMMANDS
65
66Though *swaymsg*(1) is generally preferred, you may run *sway* _command_ to
67send _command_ to the running instance of sway. You can also issue commands
68with *i3-msg*(1) or even with *i3*(1).
69
70# ENVIRONMENT
71
72The following environment variables have an effect on sway:
73
74_SWAY\_CURSOR\_THEME_
75 Specifies the name of the cursor theme to use.
76
77_SWAY\_CURSOR\_SIZE_
78 Specifies the size of the cursor to use.
79
80_SWAYSOCK_
81 Specifies the path to the sway IPC socket.
82
83_XKB\_DEFAULT\_RULES_, _XKB\_DEFAULT\_MODEL_, _XKB\_DEFAULT\_LAYOUT_,
84_XKB\_DEFAULT\_VARIANT_, _XKB\_DEFAULT\_OPTIONS_
85 Configures the xkb keyboard settings. See *xkeyboard-config*(7).
86
87# AUTHORS
88
89Maintained by Drew DeVault <sir@cmpwn.com>, who is assisted by other open
90source contributors. For more information about sway development, see
91<https://github.com/swaywm/sway>.
92
93# SEE ALSO
94
95*sway*(5) *swaymsg*(1) *swaygrab*(1) *sway-input*(5) *sway-bar*(5)
diff --git a/sway/sway.1.txt b/sway/sway.1.txt
deleted file mode 100644
index 17fc13da..00000000
--- a/sway/sway.1.txt
+++ /dev/null
@@ -1,109 +0,0 @@
1/////
2vim:set ft=asciidoc ts=4 sw=4 tw=82 noet:
3/////
4:quotes.~:
5
6sway (1)
7========
8
9Name
10----
11sway - SirCmpwn's Wayland window manager
12
13Synopsis
14--------
15'sway' [options] [command]
16
17Options
18-------
19
20*-h, --help*::
21 Show help message and quit.
22
23*-c, \--config* <config>::
24 Specifies a config file.
25
26*-C, \--validate*::
27 Check the validity of the config file, then exit.
28
29*-d, --debug*::
30 Enables full logging, including debug information.
31
32*-v, \--version*::
33 Show the version number and quit.
34
35*-V, --verbose*::
36 Enables more verbose logging.
37
38*--get-socketpath*::
39 Gets the IPC socket path and prints it, then exits.
40
41Description
42-----------
43
44sway was created to fill the need of an i3-like window manager for Wayland. The
45upstream i3 developers have no intention of porting i3 to Wayland, and projects
46proposed by others ended up as vaporware. Many thanks to the i3 folks for
47providing such a great piece of software, so good that your users would rather
48write an entirely new window manager from scratch that behaved _exactly_ like i3
49rather than switch to something else.
50
51Launch sway directly from a tty or via your favorite Wayland-compatible login
52manager.
53
54Commands
55--------
56
57If sway is currently running, you may run _sway [command]_ to send _command_ to
58the running instance of sway. The same commands you would use in the config file
59are valid here (see **sway**(5)). For compatibility reasons, you may also issue
60commands with **swaymsg**(1) or **i3-msg**(1) (or even with **i3**(1), probably).
61
62Configuration
63-------------
64
65The path to a config file can be given via the _-c_ parameter, else
66sway searches for it in the following locations:
67- ~/.sway/config
68- $XDG_CONFIG_HOME/sway/config (suggested location)
69- ~/.i3/config
70- $XDG_CONFIG_HOME/i3/config (XDG_HOME )
71- /etc/sway/config
72- /etc/i3/config
73
74In /etc/sway/config the standard config file is installed.
75An error is raised when no config file is found.
76
77To write your own configuration, it's suggested that you copy the default config file to
78the location of your choosing and start there.
79
80For information on the config file format, see **sway**(5).
81
82Environment
83-----------
84
85The following environment variables have an effect on sway:
86
87*SWAY_CURSOR_THEME*::
88 Specifies the name of the cursor theme to use.
89
90*SWAY_CURSOR_SIZE*::
91 Specifies the size of the cursor to use.
92
93*SWAYSOCK*::
94 Specifies the path to the sway IPC socket.
95
96*XKB_DEFAULT_RULES*, *XKB_DEFAULT_MODEL*, *XKB_DEFAULT_LAYOUT*, *XKB_DEFAULT_VARIANT*, *XKB_DEFAULT_OPTIONS*::
97 Configures the xkb keyboard settings. See xkeyboard-config(7).
98
99Authors
100-------
101
102Maintained by Drew DeVault <sir@cmpwn.com>, who is assisted by other open
103source contributors. For more information about sway development, see
104<https://github.com/swaywm/sway>.
105
106See Also
107--------
108
109**sway**(5) **swaymsg**(1) **swaygrab**(1) **sway-input**(5) **sway-bar**(5)
diff --git a/sway/sway.5.scd b/sway/sway.5.scd
new file mode 100644
index 00000000..2ebdb8ed
--- /dev/null
+++ b/sway/sway.5.scd
@@ -0,0 +1,582 @@
1sway(5)
2
3# NAME
4
5sway - configuration file and commands
6
7# DESCRIPTION
8
9A sway configuration file is a list of sway commands that are executed by sway
10on startup. These commands usually consist of setting your preferences and
11setting key bindings. An example config is likely present in /etc/sway/config
12for you to check out.
13
14Lines in the configuration file might be extended through multiple lines by
15adding a '\\' character at the end of line. e.g.:
16
17```
18bindsym Shift+XF86AudioRaiseVolume exec \\
19 pactl set-sink-volume @DEFAULT_SINK@ -1%
20```
21
22These commands can be executed in your config file, via *swaymsg*(1), or via
23the bindsym command.
24
25# COMMAND CONVENTIONS
26
27Commands are split into several arguments using spaces. You can enclose
28arguments with quotation marks (*"..."* or *'...'*) to add spaces to a single
29argument. You may also run several commands in order by separating each with
30*,* or *;*.
31
32Throughout the documentation, *|* is used to distinguish between arguments for
33which you may only select one. *[...]* is used for optional arguments, and
34*<...>* for arguments where you are expected to supply some value.
35
36# COMMANDS
37
38The following commands may only be used in the configuration file.
39
40*bar {* <commands...> *}*
41 _commands..._ after *{* will be interpreted as bar commands. For
42 details, see *sway-bar*(5). A newline is required between *{* and the
43 first command, and *}* must be alone on a line.
44
45*default\_orientation* horizontal|vertical|auto
46 Sets the default container layout for tiled containers.
47
48*include* <path>
49 Includes another file from _path_. _path_ can be either a full path or a
50 path relative to the parent config, and expands shell syntax (see
51 *wordexp*(3) for details). The same include file can only be included once;
52 subsequent attempts will be ignored.
53
54*set* <name> <value>
55 Sets variable $_name_ to _value_. You can use the new variable in the
56 arguments of future commands.
57
58*swaybg\_command* <command>
59 Executes custom background _command_. Default is _swaybg_. Refer to
60 *output* below for more information.
61
62The following commands cannot be used directly in the configuration file.
63They are expected to be used with *bindsym* or at runtime through *swaymsg*(1).
64
65*border* normal|pixel [<n>]
66 Set border style for focused window. _normal_ includes a border of
67 thickness _n_ and a title bar. _pixel_ is a border without title bar _n_
68 pixels thick. Default is _normal_ with border thickness 2.
69
70*border* none|toggle
71 Set border style for focused window to _none_ or _toggle_ between the
72 available border styles: _normal_, _pixel_, _none_.
73
74*exit*
75 Exit sway and end your Wayland session.
76
77*floating* enable|disable|toggle
78 Make focused view floating, non-floating, or the opposite of what it is now.
79
80*focus* up|right|down|left
81 Moves focus to the next container in the specified direction.
82
83*focus* child
84 Moves focus to the last-focused child of the focused container.
85
86*focus* parent
87 Moves focus to the parent of the focused container.
88
89*focus* output up|right|down|left
90 Moves focus to the next output in the specified direction.
91
92*focus* output <name>
93 Moves focus to the named output.
94
95*focus* mode\_toggle
96 Moves focus between the floating and tiled layers.
97
98*fullscreen*
99 Toggles fullscreen for the focused view.
100
101*layout* splith|splitv|stacking|tabbed
102 Sets the layout mode of the focused container.
103
104*layout* toggle split
105 Switches the focused container between the splitv and splith layouts.
106
107*move* left|right|up|down [<px>]
108 Moves the focused container in the direction specified. If the container,
109 the optional _px_ argument specifies how many pixels to move the container.
110 If unspecified, the default is 10 pixels. Pixels are ignored when moving
111 tiled containers.
112
113*move* container|window to workspace <name>
114 Moves the focused container to the specified workspace.
115
116*move* container|window to workspace prev|next
117 Moves the focused container to the previous or next workspace on this
118 output, or if no workspaces remain, the previous or next output.
119
120*move* container|window to workspace prev\_on\_output|next\_on\_output
121 Moves the focused container to the previous or next workspace on this
122 output, wrapping around if already at the first or last workspace.
123
124*move* container|window|workspace to output <name>
125 Moves the focused container or workspace to the specified output.
126
127*move* container|window|workspace to output up|right|down|left
128 Moves the focused container or workspace to next output in the specified
129 direction.
130
131*move* [to] scratchpad
132 Moves the focused window to the scratchpad.
133
134*reload*
135 Reloads the sway config file and applies any changes.
136
137*resize* shrink|grow width|height [<amount>] [px|ppt]
138 Resizes the currently focused container by _amount_, specified in pixels or
139 percentage points. If omitted, floating containers are resized in px and
140 tiled containers by ppt. If omitted, the default _amount_ is 10.
141
142*resize set* <width> [px] <height> [px]
143 Sets the width and height of the currently focused container to _width_
144 pixels and _height_ pixels. The [px] parameters are optional and have no
145 effect. This command only accepts a size in pixels. Width and height may be
146 specified in either order.
147
148*scratchpad show*
149 Shows a window from the scratchpad. Repeatedly using this command will
150 cycle through the windows in the scratchpad.
151
152*split* vertical|v|horizontal|h|toggle|t
153 Splits the current container, vertically or horizontally. When _toggle_ is
154 specified, the current container is split opposite to the parent
155 container's layout.
156
157*splith*
158 Equivalent to *split horizontal*
159
160*splitv*
161 Equivalent to *split vertical*
162
163*splitt*
164 Equivalent to *split toggle*
165
166*sticky* enable|disable|toggle
167 "Sticks" a floating window to the current output so that it shows up on all
168 workspaces.
169
170The following commands may be used either in the configuration file or at
171runtime.
172
173*assign* <criteria> [→] <workspace>
174 Assigns views matching _criteria_ (see *CRITERIA* for details) to
175 _workspace_. The → (U+2192) is optional and cosmetic. This command is
176 equivalent to:
177
178 for\_window <criteria> move container to workspace <workspace>
179
180*bindsym* <key combo> <command>
181 Binds _key combo_ to execute the sway command _command_ when pressed. You
182 may use XKB key names here (*xev*(1) is a good tool for discovering these).
183
184 Example:
185
186 # Execute firefox when alt, shift, and f are pressed together
187 bindsym Mod1+Shift+f exec firefox
188
189 *bindcode* <code> <command> is also available for binding with key codes
190 instead of key names.
191
192*client.<class>* <border> <background> <text> <indicator> <child\_border>
193 Configures the color of window borders and title bars. All 5 colors are
194 required, with the exception of *client.background*, which requires exactly
195 one. Colors may be specified in hex, either as _#RRGGBB_ or _#RRGGBBAA_.
196
197 The available classes are:
198
199 *client.background*
200 Ignored (present for i3 compatibility).
201
202 *client.focused*
203 The window that has focus.
204
205 *client.focused\_inactive*
206 The most recently focused view within a container which is not focused.
207
208 *client.placeholder*
209 Ignored (present for i3 compatibility).
210
211 *client.unfocused*
212 A view that does not have focus.
213
214 *client.urgent*
215 A view with an urgency hint. *Note*: This is not currently implemented.
216
217 The meaning of each color is:
218
219 _border_
220 The border around the title bar.
221
222 _background_
223 The background of the title bar.
224
225 _text_
226 The text color of the title bar.
227
228 _indicator_
229 The color used to indicate where a new view will open. In a tiled
230 container, this would paint the right border of the current view if a
231 new view would be opened to the right.
232
233 _child\_border_
234 The border around the view itself.
235
236The default colors are:
237
238[- *class*
239:[ _border_
240:[ _background_
241:[ _text_
242:[ _indicator_
243:[ _child\_border_
244|[ *background*
245: n/a
246: #ffffff
247: n/a
248: n/a
249: n/a
250| *focused*
251: #4c7899
252: #285577
253: #ffffff
254: #2e9ef4
255: #285577
256| *focused\_inactive*
257: #333333
258: #5f676a
259: #ffffff
260: #484e50
261: #5f676a
262| *unfocused*
263: #333333
264: #222222
265: #888888
266: #292d2e
267: #222222
268| *urgent*
269: #2f343a
270: #900000
271: #ffffff
272: #900000
273: #900000
274| *placeholder*
275: #000000
276: #0c0c0c
277: #ffffff
278: #000000
279: #0c0c0c
280
281*debuglog* on|off|toggle
282 Enables, disables or toggles debug logging. _toggle_ cannot be used in the
283 configuration file.
284
285*default\_border* normal|none|pixel [<n>]
286 Set default border style for new tiled windows.
287
288*default\_floating\_border* normal|none|pixel [<n>]
289 Set default border style for new floating windows. This only applies to
290 windows that are spawned in floating mode, not windows that become floating
291 afterwards.
292
293*exec* <shell command>
294 Executes _shell command_ with sh.
295
296*exec\_always* <shell command>
297 Like *exec*, but the shell command will be executed _again_ after *reload*.
298
299*floating\_maximum\_size* <width> x <height>
300 Specifies the maximum size of floating windows. -1 x -1 removes the upper
301 limit.
302
303*floating\_minimum\_size* <width> x <height>
304 Specifies the minimum size of floating windows. The default is 75 x 50.
305
306*floating\_modifier* <modifier> [normal|inverse]
307 When the _modifier_ key is held down, you may hold left click to move
308 windows, and right click to resize them. If _inverse_ is specified, left
309 click is used for resizing and right click for moving.
310
311*floating\_scroll* up|right|down|left [command]
312 Sets a command to be executed when the mouse wheel is scrolled in the
313 specified direction while holding the floating modifier. Resets the
314 command, when given no arguments.
315
316*focus\_follows\_mouse* yes|no
317 If set to _yes_, moving your mouse over a window will focus that window.
318
319*font* <font>
320 Sets font for use in title bars in Pango format.
321
322*for\_window* <criteria> <command>
323 Whenever a window that matches _criteria_ appears, run list of commands.
324 See *CRITERIA* for more details.
325
326*gaps* edge\_gaps on|off|toggle
327 When _on_, gaps will be added between windows and workspace edges if the
328 inner gap is nonzero. When _off_, gaps will only be added between views.
329 _toggle_ cannot be used in the configuration file.
330
331*gaps* <amount>
332 Sets _amount_ pixels of gap between windows and around each workspace.
333
334*gaps* inner|outer <amount>
335 Sets default _amount_ pixels of _inner_ or _outer_ gap, where the former
336 affects spacing between views and the latter affects the space around each
337 workspace.
338
339*gaps* inner|outer all|workspace|current set|plus|minus <amount>
340 Changes the gaps for the _inner_ or _outer_ gap. _all_ changes the gaps for
341 all views or workspace, _workspace_ changes gaps for all views in current
342 workspace (or current workspace), and _current_ changes gaps for the current
343 view or workspace.
344
345*hide\_edge\_borders* none|vertical|horizontal|both|smart
346 Hides window borders adjacent to the screen edges. Default is _none_.
347
348*input* <input\_device> *{* <commands...> *}*
349 _commands..._ after *{* will be interpreted as input commands applying to
350 the specified input device. For details, see *sway-input*(5). A newline is
351 required between *{* and the first command, and *}* must be alone on a
352 line.
353
354 \* may be used in lieu of a specific device name to configure all input
355 devices. A list of input device names may be obtained via *swaymsg -t
356 get\_inputs*.
357
358*seat* <seat> *{* <commands...> *}*
359 _commands..._ after *{* will be interpreted as seat commands applying to
360 the specified seat. For details, see *sway-input*(5). A newline is required
361 between *{* and the first command, and *}* must be alone on a line.
362
363*seat* <seat> cursor move|set <x> <y>
364 Move specified seat's cursor relative to current position or wrap to
365 absolute coordinates (with respect to the global coordinate space).
366 Specifying either value as 0 will not update that coordinate.
367
368*seat* <seat> cursor press|release left|right|1|2|3...
369 Simulate pressing (or releasing) the specified mouse button on the
370 specified seat.
371
372*kill*
373 Kills (closes) the currently focused container and all of its children.
374
375*smart\_gaps* on|off
376 If smart\_gaps are _on_ gaps will only be enabled if a workspace has more
377 than one child.
378
379*mark* --add|--replace [--toggle] <identifier>
380 Marks are arbitrary labels that can be used to identify certain windows and
381 then jump to them at a later time. By default, *mark* sets _identifier_ as
382 the only mark on a window. _--add_ will instead add _identifier_ to the
383 list of current marks. If _--toggle_ is specified mark will remove
384 _identifier_ if it is already marked.
385
386*mode* <mode>
387 Switches to the specified mode. The default mode _default_.
388
389*mode* <mode> *{* <commands...> *}*
390 _commands..._ after *{* will be added to the specified mode. A newline is
391 required between *{* and the first command, and *}* must be alone on a
392 line. Only *bindsym* and *bindcode* commands are permitted in mode blocks.
393
394*mouse\_warping* output|none
395 If _output_ is specified, the mouse will be moved to new outputs as you
396 move focus between them. Default is _output_.
397
398*no\_focus* <criteria>
399 Prevents windows matching <criteria> from being focused automatically when
400 they're created. This has no effect on the first window in a workspace.
401
402*output* <name> mode|resolution|res <WIDTHxHEIGHT>[@<RATE>[Hz]]
403 Configures the specified output to use the given mode. Modes are a
404 combination of width and height (in pixels) and a refresh rate that your
405 display can be configured to use. For a list of available modes for each
406 output, use *swaymsg -t get\_outputs*.
407
408 Examples:
409
410 output HDMI-A-1 mode 1920x1080
411
412 output HDMI-A-1 mode 1920x1080@60Hz
413
414*output* <name> position|pos <X,Y>
415 Places the specified output at the specific position in the global
416 coordinate space.
417
418*output* <name> scale <factor>
419 Scales the specified output by the specified scale _factor_. An integer is
420 recommended, but fractional values are also supported. If a fractional
421 value are specified, be warned that it is not possible to faithfully
422 represent the contents of your windows - they will be rendered at the next
423 highest integral scale factor and downscaled. You may be better served by
424 setting an integral scale factor and adjusting the font size of your
425 applications to taste.
426
427*output* <name> background|bg <file> <mode>
428 Sets the wallpaper for the given output to the specified file, using the
429 given scaling mode (one of "stretch", "fill", "fit", "center", "tile").
430
431**output** <name> background|bg <color> solid\_color
432 Sets the background of the given output to the specified color. _color_
433 should be specified as _#RRGGBB_. Alpha is not supported.
434
435**output** <name> transform <transform>
436 Sets the background transform to the given value. Can be one of "90", "180",
437 "270" for rotation; or "flipped", "flipped-90", "flipped-180", "flipped-270"
438 to apply a rotation and flip, or "normal" to apply no transform.
439
440*output* <name> disable|enable
441 Enables or disables the specified output (all outputs are enabled by
442 default).
443
444*NOTES FOR THE OUTPUT COMMANDS*
445
446You may combine output commands into one, like so:
447
448 output HDMI-A-1 mode 1920x1080 pos 1920,0 bg ~/wallpaper.png stretch
449
450You can get a list of output names with *swaymsg -t get\_outputs*. You may also
451match any output by using the output name "\*". Be sure to add this output
452config after the others, or it will be matched instead of the others.
453
454*show\_marks* on|off
455 If *show\_marks* is on, marks will be displayed in the window borders.
456 Any mark that starts with an underscore will not be drawn even if the
457 option is on. The default is _on_.
458
459*opacity* <value>
460 Set the opacity of the window between 0 (completely transparent) and 1
461 (completely opaque).
462
463*unmark* [<identifier>]
464 *unmark* will remove _identifier_ from the list of current marks on a
465 window. If _identifier_ is omitted, all marks are removed.
466
467*workspace* [number] <name>
468 Switches to the specified workspace. The string "number" is optional and is
469 used to sort workspaces.
470
471*workspace* prev|next
472 Switches to the next workspace on the current output or on the next output
473 if currently on the last workspace.
474
475*workspace* prev\_on\_output|next\_on\_output
476 Switches to the next workspace on the current output.
477
478*workspace* <name> output <output>
479 Specifies that workspace _name_ should be shown on the specified _output_.
480
481*workspace\_auto\_back\_and\_forth* yes|no
482 When _yes_, repeating a workspace switch command will switch back to the
483 prior workspace. For example, if you are currently on workspace 1,
484 switch to workspace 2, then invoke the "workspace 2" command again, you
485 will be returned to workspace 1. Default is _no_.
486
487*workspace\_layout* default|stacking|tabbed
488 Specifies the initial layout for new workspaces.
489
490# CRITERIA
491
492A criteria is a string in the form of, for example:
493
494```
495[class="[Rr]egex.*" title="some title"]
496```
497
498The string contains one or more (space separated) attribute/value pairs. They
499are used by some commands to choose which views to execute actions on. All
500attributes must match for the criteria to match.
501
502Criteria may be used with either the *for\_window* or *assign* commands to
503specify operations to perform on new views. A criteria may also be used to
504perform specific commands (ones that normally act upon one window) on all views
505that match that criteria. For example:
506
507Focus on a window with the mark "IRC":
508
509```
510[con_mark="IRC"] focus
511```
512
513Kill all windows with the title "Emacs":
514
515```
516[class="Emacs"] kill
517```
518
519Mark all Firefox windows with "Browser":
520
521```
522[class="Firefox"] mark Browser
523```
524
525The following attributes may be matched with:
526
527*app\_id*
528 Compare value against the app id. Can be a regular expression. If value is
529 \_\_focused\_\_, then the app id must be the same as that of the currently
530 focused window.
531
532*class*
533 Compare value against the window class. Can be a regular expression. If
534 value is \_\_focused\_\_, then the window class must be the same as that of
535 the currently focused window.
536
537*con\_id*
538 Compare against the internal container ID, which you can find via IPC.
539
540*con\_mark*
541 Compare against the window marks. Can be a regular expression.
542
543*floating*
544 Matches floating windows.
545
546*id*
547 Compare value against the X11 window ID. Must be numeric.
548
549*instance*
550 Compare value against the window instance. Can be a regular expression. If
551 value is \_\_focused\_\_, then the window instance must be the same as that
552 of the currently focused window.
553
554*tiling*
555 Matches tiling windows.
556
557*title*
558 Compare against the window title. Can be a regular expression. If value is
559 \_\_focused\_\_, then the window title must be the same as that of the
560 currently focused window.
561
562*urgent*
563 Compares the urgent state of the window. Can be "latest" or "oldest".
564
565*window\_role*
566 Compare against the window role (WM\_WINDOW\_ROLE). Can be a regular
567 expression. If value is \_\_focused\_\_, then the window role must be the
568 same as that of the currently focused window.
569
570*window\_type*
571 Compare against the window type (\_NET\_WM\_WINDOW\_TYPE). Possible values
572 are normal, dialog, utility, toolbar, splash, menu, dropdown\_menu,
573 popup\_menu, tooltip and notification.
574
575*workspace*
576 Compare against the workspace name for this view. Can be a regular
577 expression. If the value is \_\_focused\_\_, then all the views on the
578 currently focused workspace matches.
579
580# SEE ALSO
581
582*sway*(1) *sway-input*(5) *sway-bar*(5)
diff --git a/sway/sway.5.txt b/sway/sway.5.txt
deleted file mode 100644
index 03975349..00000000
--- a/sway/sway.5.txt
+++ /dev/null
@@ -1,521 +0,0 @@
1/////
2vim:set ts=4 sw=4 tw=82 noet:
3/////
4sway (5)
5========
6
7Name
8----
9sway - configuration file and commands
10
11Description
12-----------
13
14A sway configuration file is a list of sway commands that are executed by sway
15on startup. These commands usually consist of setting your preferences and
16setting key bindings. An example config is likely present in /etc/sway/config
17for you to check out.
18
19Lines in the configuration file might be extended through multiple lines by
20adding a '\' character at the end of line. e.g.:
21
22 bindsym Shift+XF86AudioRaiseVolume exec pactl set-sink-volume \
23 $(pactl list sinks | grep -B 1 RUNNING | sed '1q;d' | sed 's/[^0-9]\+//g') +5%
24
25These commands can be executed in your config file, via **swaymsg**(1), or via
26the bindsym command.
27
28Commands
29--------
30
31The following commands may only be used in the configuration file.
32
33**bar** <block of commands>::
34 Append _{_ to this command, the following lines will be commands that
35 configure **swaybar**, and _}_ on its own line to close the block.
36 +
37 See **sway-bar**(5) for details.
38
39**default_orientation** <horizontal|vertical|auto>::
40 Sets the default container layout for tiled containers.
41
42**set** <name> <value>::
43 Sets variable $name to _value_. You can use the new variable in the arguments
44 of future commands.
45
46**swaybg_command** <command>::
47 Executes custom bg command, default is _swaybg_.
48
49The following commands cannot be used directly in the configuration file.
50They are expected to be used with **bindsym** or at runtime through **swaymsg**(1).
51
52**border** <normal|pixel> [<n>]::
53 Set border style for focused window. _normal_ includes a border of thickness
54 _n_ and a title bar. _pixel_ is a border without title bar _n_ pixels thick.
55 Default is _normal_ with border thickness 2.
56
57**border** <none|toggle>::
58 Set border style for focused window to _none_ or _toggle_ between the
59 available border styles: _normal_, _pixel_, _none_.
60
61**exit**::
62 Exit sway and end your Wayland session.
63
64**floating** <enable|disable|toggle>::
65 Make focused view floating, non-floating, or the opposite of what it is now.
66
67**focus** <direction>::
68 Direction may be one of _up_, _down_, _left_, _right_, _next_, _prev_,
69 _parent_, or _child_. The directional focus commands will move the focus
70 in that direction. The _next_ and _prev_ directions will focus the next,
71 respectively previous, element in the current container. The parent
72 focus command will change the focus to the parent of the currently
73 focused container, which is useful, for example, to open a sibling of
74 the parent container, or to move the entire container around.
75
76**focus** output <direction|name>::
77 Direction may be one of _up_, _down_, _left_, _right_. The directional focus
78 commands will move the focus to the output in that direction. When name is
79 given, the focus is changed to the output with that name.
80
81**focus** mode_toggle::
82 Toggles focus between floating view and tiled view.
83
84**fullscreen**::
85 Toggles fullscreen status for the focused view.
86
87**layout** <mode>::
88 Sets the layout mode of the focused container. _mode_ can be one of _splith_,
89 _splitv_, _toggle split_, _stacking_, _tabbed_.
90
91**layout** auto <mode>::
92 Sets layout to one of the auto modes, i.e. one of _left_, _right_, _top_,
93 or _bottom_.
94
95**layout** auto <next|prev>::
96 Cycles between available auto layouts.
97
98**layout** auto [master|ncol] [inc|set] <n>::
99 Modify the number of master elements, respectively slave columns, in the
100 focused container. <n> can be a positive or negative integer. These commands
101 only have an effect if the focused container uses one of the "auto" layouts.
102
103**layout** toggle split::
104 Cycles between available split layouts.
105
106**move** <left|right|up|down> <[px]>::
107 Moves the focused container _left_, _right_, _up_, or _down_. If the window
108 is floating it moves it _px_ in that direction, defaulting to 10. Tiled
109 containers are moved the same regardless of the _px_ argument.
110
111**move** <next|prev|first>::
112 Moving to _prev_ or _next_ swaps the container with its sibling in the same
113 container. Move _first_ exchanges the focused element in an auto layout with
114 the first element, i.e. promotes the focused element to master position.
115
116**move** <container|window> to workspace <name>::
117 Moves the focused container to the workspace identified by _name_.
118 _name_ may be a special workspace name. See **workspace**.
119
120**move** <container|window|workspace> to output <name|direction>::
121 Moves the focused container or workspace to the output identified by _name_ or
122 _direction_. _direction_ may be one of _up_, _down_, _left_, _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_ is
132 optional: the default value is 10 (either px or ppt depending on the view type).
133 The [px|ppt] parameter is optional. _px_ specifies that _amount_ refers to pixels;
134 _ppt_ specifies that _amount_ refers to percentage points of the current
135 size. Floating views use px by default (but can use ppt if specified); tiled
136 views use ppt by default (but can use px if specified).
137
138**resize set** <width> [px] <height> [px]::
139 Sets the width and height of the currently focused container to _width_ pixels
140 and _height_ pixels. The [px] parameters are optional and have no effect. This
141 command only accepts a size in pixels.
142
143**resize set** <width|height> <amount> [px] [<width|height> <amount> [px]]::
144 Sets the _width_ and/or _height_ of the currently focused container to
145 _amount_. The [px] parameters are optional and have no effect. This command
146 only accepts a size in pixels.
147
148**scratchpad show**::
149 Shows a window from the scratchpad. Repeatedly using this command will cycle
150 through the windows in the scratchpad.
151
152**split** <vertical|v|horizontal|h|toggle|t>::
153 Splits the current container, vertically or horizontally. If toggled, then the
154 current container is split opposite to the parent container.
155
156**splith**::
157 Equivalent to **split horizontal**.
158
159**splitv**::
160 Equivalent to **split vertical**.
161
162**splitt**::
163 Equivalent to **split toggle**.
164
165**sticky** <enable|disable|toggle>::
166 "Sticks" a floating window to the current output so that it shows up on all
167 workspaces.
168
169The following commands may be used either in the configuration file
170or triggered at runtime.
171
172**assign** <criteria> [→] <workspace>::
173 Assigns views matching _criteria_ (see **Criteria** section below) to
174 _workspace_. The → (U+2192) is optional and purely for aesthetics. This
175 command is exactly equivalent to "for_window <criteria> move container to
176 workspace <workspace>".
177
178**bindsym** <key combo> <command>::
179 Binds _key combo_ to execute _command_ when pressed. You may use XKB key
180 names here (**xev**(1) is a good tool for discovering them). An example
181 bindsym command would be **bindsym Mod1+Shift+f exec firefox**, which would
182 execute Firefox if the alt, shift, and F keys are pressed together. Any
183 valid sway command is eligible to be bound to a key combo.
184 +
185 **bindcode** <code> <command> is also available for binding with key codes
186 instead of key names.
187
188**client**.<color_class> <border> <background> <text> <indicator> <child_border>::
189 The client commands control the colors of the view borders and title bars. All
190 client commands _require_ five color values. (The one exception is
191 **client.background** which _requires_ one color value.) If you only want to
192 specify a subset, supply default colors for all the others. Colors must be
193 defined in hex. i.e. _#rrggbb_ or _#rrggbbaa_, when including the alpha
194 channel.
195 +
196 The command tokens are:
197 **color_class**::: Specifies the view to which the colors apply.
198 **client.background**:::: The color a view will be painted, underneath the
199 client itself. This will only be visible if a client does not fully
200 cover its allocated view space. This command only requires one color. _Note_:
201 This is not currently implemented.
202 **client.focused**:::: The view that has focus.
203 **client.focused_inactive**:::: A view that has focus within its
204 container, but the container is not focused.
205 **client.placeholder**:::: Used when drawing placeholder view contents.
206 Only background and text colors are used. _Note_: This is not
207 currently implemented.
208 **client.unfocused**:::: A view that does not have focus.
209 **client.urgent**:::: A view with an urgency hint. _Note_: This is not
210 currently implemented.
211 **border**::: The border around the title bar.
212 **background**::: The background of the title bar.
213 **text**::: The text color of the title bar.
214 **indicator**::: The color used to indicate where a new view will open. In a
215 tiled container, this would paint the right border of the current view if
216 a new view would be opened to the right.
217 **child_border**::: The border around the view itself.
218
219+
220The default colors are:
221+
222--
223[options="header"]
224|===========================================================================
225|color_class |border |background |text |indicator |child_border
226|background |n/a |#ffffff |n/a |n/a |n/a
227|focused |#4c7899 |#285577 |#ffffff |#2e9ef4 |#285577
228|focused_inactive |#333333 |#5f676a |#ffffff |#484e50 |#5f676a
229|unfocused |#333333 |#222222 |#888888 |#292d2e |#222222
230|urgent |#2f343a |#900000 |#ffffff |#900000 |#900000
231|placeholder |#000000 |#0c0c0c |#ffffff |#000000 |#0c0c0c
232|===========================================================================
233--
234
235**debuglog** <on|off|toggle>::
236 Enables, disables or toggles debug logging. The toggle argument cannot be used
237 in the configuration file.
238
239**default_border** <normal|none|pixel> [<n>]::
240 Set default border style for new windows. This command was previously called
241 **new_window**. While **new_window** still works, it is considered deprecated
242 and support for it will be removed in the future.
243
244**default_floating_border** <normal|none|pixel> [<n>]::
245 Set default border style for new floating windows. This only applies to
246 windows that are spawned in floating mode, not windows that become floating
247 after the fact. This command was previously called **new_float**. While
248 **new_float** still works, it is considered deprecated and support for it will
249 be removed in the future.
250
251**exec** <shell command>::
252 Executes _shell command_ with sh.
253
254**exec_always** <shell command>::
255 Like exec, but the shell command will be executed _again_ after *reload* or
256 *restart* is executed.
257
258**floating_maximum_size** <width> x <height>::
259 Specifies the maximum size of floating windows.
260 Uses the container size as default.
261 -1 x -1 will remove any restriction on size.
262 0 x 0 has the same behavior as not setting any value.
263 If in conflict, this option has precedence over floating_minimum_size.
264
265**floating_minimum_size** <width> x <height>::
266 Specifies the minimum size of floating windows.
267 Default parameters are 75 x 50.
268 -1 and 0 are invalid parameters, default will be used instead.
269
270**floating_modifier** <modifier> [normal|inverse]::
271 When the _modifier_ key is held down, you may hold left click to move floating
272 windows, and right click to resize them. Unlike i3, this modifier may also be
273 used to resize and move windows that are tiled. With the _inverse_ mode
274 enabled, left click is used for resizing and right click for dragging. The
275 mode parameter is optional and defaults to _normal_ if it isn't defined.
276
277**floating_scroll** <up|down|left|right> [command]::
278 Sets a command to be executed when the mouse wheel is scrolled in the
279 specified direction while holding the floating modifier. Resets the command,
280 when given no arguments.
281
282**focus_follows_mouse** <yes|no>::
283 If set to _yes_, moving your mouse over a window will focus that window.
284
285**font** <font>::
286 Sets font for use in title bars. Generally the format is something like "Name
287 Style Size" e.g. "Deja Vu Sans Book 12". You can also use Pango font
288 descriptions with "pango:font".
289
290**for_window** <criteria> <command>::
291 Whenever a window that matches _criteria_ appears, run list of commands. See
292 **Criteria** section below.
293
294**gaps** edge_gaps <on|off|toggle>::
295 Whether or not to add gaps between views and workspace edges if amount of
296 inner gap is not zero. When _off_, no gap is added where the view is aligned to
297 the workspace edge, effectively creating gaps only between views. The toggle
298 argument cannot be used in the configuration file.
299
300**gaps** <amount>::
301 Sets default _amount_ pixels as the gap between each view, and around each
302 workspace.
303
304**gaps** <inner|outer> <amount>::
305 Sets default _amount_ pixels as the _inner_ or _outer_ gap, where the former
306 affects spacing between views and the latter affects the space around each
307 workspace.
308
309**gaps** <inner|outer> <all|workspace|current> <set|plus|minus> <amount>::
310 Changes the gaps for the _inner_ or _outer_ gap. _all_ changes the gaps for
311 all views or workspace, _workspace_ changes gaps for all views in current
312 workspace (or current workspace), and _current_ changes gaps for the current
313 view or workspace.
314
315**hide_edge_borders** <none|vertical|horizontal|both|smart>::
316 Hide window borders adjacent to the screen edges. Default is _none_.
317
318**input** <input_device> <block of commands>::
319 Append _{_ to this command, the following lines will be commands to configure
320 the named input device, and _}_ on its own line will close the block.
321 +
322 **input * <block of commands>** may be used to match all input devices.
323 +
324 See **sway-input**(5) for details.
325
326**seat** <seat_name> <block of commands>::
327 Append _{_ to this command, the following lines will be commands to configure
328 the named seat, and _}_ on its own line will close the block.
329 See **sway-input**(5) for details.
330
331**seat** <seat_name> cursor <move|set> <x> <y>::
332 Move cursor relatively to current position or set to absolute screen position.
333 A value of 0 causes the axis to be ignored in both commands.
334
335**seat** <seat_name> cursor <press|release> <left|right|1|2|3...>::
336 Simulate press of mouse button specified by left, right, or numerical code.
337
338**kill**::
339 Kills (force-closes) the currently-focused container and all of its children.
340
341**smart_gaps** <on|off>::
342 If smart_gaps are _on_ then gaps will only be enabled if a workspace has more
343 than one child container.
344
345**mark** \<--add|--replace> \<--toggle> <identifier>::
346 Marks are arbitrary labels that can be used to identify certain windows and
347 then jump to them at a later time. By default, the **mark** command sets
348 _identifier_ as the only mark on a window. By specifying _--add_, mark will
349 add _identifier_ to the list of current marks. If _--toggle_ is specified mark
350 will remove _identifier_ if it is already a label. Marks may be found by using
351 a criteria. See the **Criteria** section below.
352
353**mode** <mode_name>::
354 Switches to the given mode_name. The default mode is simply _default_. To
355 create a new mode append _{_ to this command, the following lines
356 will be keybindings for that mode, and _}_ on its own line to close the block.
357
358**mouse_warping** <output|none>::
359 When _output_: place mouse at center of newly focused window when changing
360 output. When _none_: don't move mouse.
361
362**no_focus** <criteria>::
363 Prevents windows matching <criteria> from being focused automatically when
364 they're created. This does not apply to the first window in a workspace.
365
366**output** <name> mode|resolution|res <WIDTHxHEIGHT>[@<RATE>[Hz]]::
367 Configures the specified output to use the given mode. Modes are a combination
368 of width and height (in pixels) and a refresh rate that your display can be
369 configured to use. For a list of available modes, use swaymsg -t get_outputs.
370 +
371 Examples:
372 +
373 output HDMI-A-1 mode 1920x1080
374 +
375 output HDMI-A-1 mode 1920x1080@60Hz
376
377**output** <name> position|pos <X,Y>::
378 Configures the specified output to be arranged at the given position.
379
380**output** <name> scale <I>::
381 Configures the specified output to be scaled up by the specified integer
382 scaling factor (usually 2 for HiDPI screens). Fractional scaling is supported.
383
384**output** <name> background|bg <file> <mode>::
385 Sets the wallpaper for the given output to the specified file, using the given
386 scaling mode (one of "stretch", "fill", "fit", "center", "tile").
387
388**output** <name> background|bg <color> solid_color::
389 Sets the background of the given output to the specified color. _color_ should
390 be specified as an _#rrggbb_ (no alpha) color.
391
392**output** <name> transform <transform>::
393 Sets the background transform to the given value. Can be one of "90", "180",
394 "270" for rotation; or "flipped", "flipped-90", "flipped-180", "flipped-270"
395 to apply a rotation and flip, or "normal" to apply no transform.
396
397**output** <name> disable::
398 Disables the specified output.
399
400**NOTES FOR THE OUTPUT COMMAND**::
401 You may combine output commands into one, like so:
402 +
403 output HDMI-A-1 mode 1920x1080 pos 1920,0 bg ~/wallpaper.png stretch
404 +
405 You can get a list of output names like so:
406 +
407 swaymsg -t get_outputs
408 +
409 You may also match any output by using the output name "*". Be sure to add
410 this output config after the others, or it will be matched instead of the
411 others.
412
413**seamless_mouse** <on|off>::
414 Change output seamlessly when pointer touches edge of output. Outputs need to
415 be configured with perfectly aligned adjacent positions for this option to
416 have any effect.
417
418**show_marks** <on|off>::
419 If **show_marks** is on then marks will be showed in the window decoration.
420 However, any mark that starts with an underscore will not be drawn even if the
421 option is on. The default option is _on_.
422
423**opacity** <value>::
424 Set the opacity of the window between 0 (completely transparent) and 1
425 (completely opaque).
426
427**unmark** <identifier>::
428 **Unmark** will remove _identifier_ from the list of current marks on a window. If
429 no _identifier_ is specified, then **unmark** will remove all marks.
430
431**workspace** [number] <name>::
432 Switches to the specified workspace. The string "number" is optional. The
433 workspace _name_, if unquoted, may not contain the string "output", as sway
434 will assume that the command is moving a workspace to an output, as described
435 below.
436
437**workspace** <prev|next>::
438 Switches to the next workspace on the current output or on the next output
439 if currently on the last workspace.
440
441**workspace** <prev_on_output|next_on_output>::
442 Switches to the next workspace on the current output.
443
444**workspace** <name> output <output>::
445 Specifies that the workspace named _name_ should appear on the specified
446 _output_.
447
448**workspace_auto_back_and_forth** <yes|no>::
449 When _yes_, repeating a workspace switch command will switch back to the
450 prior workspace. For example, if you are currently on workspace 1,
451 switch to workspace 2, then invoke the "workspace 2" command again, you
452 will be returned to workspace 1. Defaults to _no_.
453
454**workspace_layout** <default|stacking|tabbed|auto|auto left|auto right|auto
455 top|auto bottom>:: Specifies the start layout for new workspaces.
456
457**include** <path>::
458 Includes a sub config file by _path_. _path_ can be either a full path or a
459 path relative to the parent config.
460
461Criteria
462--------
463
464A criteria is a string in the form of e.g.:
465
466 [class="[Rr]egex.*" title="some title"]
467
468The string contains one or more (space separated) attribute/value pairs. They
469are used by some commands to choose which views to execute actions on. All attributes
470must match for the criteria to match.
471
472Criteria may be used with either the **for_window** or **assign** commands to
473specify operations to perform on new views. A criteria may also be used to
474perform specific commands (ones that normally act upon one window) on all views
475that match that criteria. For example:
476
477Focus on a window with the mark "IRC":
478 [con_mark="IRC"] focus
479
480Kill all windows with the title "Emacs":
481 [class="Emacs"] kill
482
483Mark all Firefox windows with "Browser":
484 [class="Firefox"] mark Browser
485
486Currently supported attributes:
487
488**class**::
489 Compare value against the window class. Can be a regular expression. If value
490 is _focused_, then the window class must be the same as that of the currently
491 focused window.
492
493**con_id**::
494 Compare against the internal container ID, which you can find via IPC.
495
496**con_mark**::
497 Compare against the window marks. Can be a regular expression.
498
499**floating**::
500 Matches against floating windows.
501
502**id**::
503 Compare value against the app id. Can be a regular expression.
504
505**title**::
506 Compare against the window title. Can be a regular expression. If value is
507 _focused_ then the window title must be the same as that of the currently
508 focused window.
509
510**tiling**::
511 Matches against tiling windows.
512
513**workspace**::
514 Compare against the workspace name for this view. Can be a regular expression.
515 If the value is _focused_, then all the views on the currently focused workspace
516 matches.
517
518See Also
519--------
520
521**sway**(1) **sway-input**(5) **sway-bar**(5)
diff --git a/swaygrab/json.c b/swaygrab/json.c
deleted file mode 100644
index 286085c3..00000000
--- a/swaygrab/json.c
+++ /dev/null
@@ -1,144 +0,0 @@
1#define _XOPEN_SOURCE 700
2#include <string.h>
3#include <stdio.h>
4#include <stdbool.h>
5#include <stdlib.h>
6#include <unistd.h>
7#include "log.h"
8#include "ipc-client.h"
9#include "swaygrab/json.h"
10
11static json_object *tree;
12
13void init_json_tree(int socketfd) {
14 uint32_t len = 0;
15 char *res = ipc_single_command(socketfd, IPC_GET_TREE, NULL, &len);
16 struct json_tokener *tok = json_tokener_new_ex(256);
17 if (!tok) {
18 sway_abort("Unable to get json tokener.");
19 }
20 tree = json_tokener_parse_ex(tok, res, len);
21 if (!tree || tok->err != json_tokener_success) {
22 sway_abort("Unable to parse IPC response as JSON: %s", json_tokener_error_desc(tok->err));
23 }
24 json_object *success;
25 json_object_object_get_ex(tree, "success", &success);
26 if (success && !json_object_get_boolean(success)) {
27 json_object *error;
28 json_object_object_get_ex(tree, "error", &error);
29 sway_abort("IPC request failed: %s", json_object_get_string(error));
30 }
31 json_object_put(success);
32 json_tokener_free(tok);
33}
34
35void free_json_tree() {
36 json_object_put(tree);
37}
38
39static bool is_focused(json_object *c) {
40 json_object *focused;
41 json_object_object_get_ex(c, "focused", &focused);
42 return json_object_get_boolean(focused);
43}
44
45static json_object *get_focused_container_r(json_object *c) {
46 json_object *name;
47 json_object_object_get_ex(c, "name", &name);
48 if (is_focused(c)) {
49 return c;
50 } else {
51 json_object *nodes, *node, *child;
52 json_object_object_get_ex(c, "nodes", &nodes);
53 int i;
54 for (i = 0; i < json_object_array_length(nodes); i++) {
55 node = json_object_array_get_idx(nodes, i);
56
57 if ((child = get_focused_container_r(node))) {
58 return child;
59 }
60 }
61
62 json_object_object_get_ex(c, "floating_nodes", &nodes);
63 for (i = 0; i < json_object_array_length(nodes); i++) {
64 node = json_object_array_get_idx(nodes, i);
65
66 if ((child = get_focused_container_r(node))) {
67 return child;
68 }
69 }
70
71 }
72
73 return NULL;
74}
75
76json_object *get_focused_container() {
77 return get_focused_container_r(tree);
78}
79
80char *get_focused_output() {
81 json_object *outputs, *output, *name;
82 json_object_object_get_ex(tree, "nodes", &outputs);
83 if (!outputs) {
84 sway_abort("Unabled to get focused output. No nodes in tree.");
85 }
86 for (int i = 0; i < json_object_array_length(outputs); i++) {
87 output = json_object_array_get_idx(outputs, i);
88
89 if (get_focused_container_r(output)) {
90 json_object_object_get_ex(output, "name", &name);
91 return strdup(json_object_get_string(name));
92 }
93 }
94
95 return NULL;
96}
97
98char *create_payload(const char *output, struct wlc_geometry *g) {
99 char *payload_str = malloc(256);
100 json_object *payload = json_object_new_object();
101
102 json_object_object_add(payload, "output", json_object_new_string(output));
103 json_object_object_add(payload, "x", json_object_new_int(g->origin.x));
104 json_object_object_add(payload, "y", json_object_new_int(g->origin.y));
105 json_object_object_add(payload, "w", json_object_new_int(g->size.w));
106 json_object_object_add(payload, "h", json_object_new_int(g->size.h));
107
108 snprintf(payload_str, 256, "%s", json_object_to_json_string(payload));
109 return strdup(payload_str);
110}
111
112struct wlc_geometry *get_container_geometry(json_object *container) {
113 struct wlc_geometry *geo = malloc(sizeof(struct wlc_geometry));
114 json_object *rect, *x, *y, *w, *h;
115
116 json_object_object_get_ex(container, "rect", &rect);
117 json_object_object_get_ex(rect, "x", &x);
118 json_object_object_get_ex(rect, "y", &y);
119 json_object_object_get_ex(rect, "width", &w);
120 json_object_object_get_ex(rect, "height", &h);
121
122 geo->origin.x = json_object_get_int(x);
123 geo->origin.y = json_object_get_int(y);
124 geo->size.w = json_object_get_int(w);
125 geo->size.h = json_object_get_int(h);
126
127 return geo;
128}
129
130json_object *get_output_container(const char *output) {
131 json_object *outputs, *json_output, *name;
132 json_object_object_get_ex(tree, "nodes", &outputs);
133
134 for (int i = 0; i < json_object_array_length(outputs); i++) {
135 json_output = json_object_array_get_idx(outputs, i);
136 json_object_object_get_ex(json_output, "name", &name);
137
138 if (strcmp(json_object_get_string(name), output) == 0) {
139 return json_output;
140 }
141 }
142
143 return NULL;
144}
diff --git a/swaygrab/main.c b/swaygrab/main.c
deleted file mode 100644
index 1b699bb9..00000000
--- a/swaygrab/main.c
+++ /dev/null
@@ -1,298 +0,0 @@
1#define _XOPEN_SOURCE 700
2#define _POSIX_C_SOURCE 199309L
3#include <stdio.h>
4#include <stdbool.h>
5#include <stdlib.h>
6#include <string.h>
7#include <getopt.h>
8#include <unistd.h>
9#include <stdint.h>
10#include <math.h>
11#include <time.h>
12#include <sys/wait.h>
13#include <json-c/json.h>
14#include "log.h"
15#include "ipc-client.h"
16#include "util.h"
17#include "swaygrab/json.h"
18
19void sway_terminate(int exit_code) {
20 exit(exit_code);
21}
22
23void grab_and_apply_magick(const char *file, const char *payload,
24 int socketfd, int raw) {
25 uint32_t len = strlen(payload);
26 char *pixels = ipc_single_command(socketfd,
27 IPC_SWAY_GET_PIXELS, payload, &len);
28 uint32_t *u32pixels = (uint32_t *)(pixels + 1);
29 uint32_t width = u32pixels[0];
30 uint32_t height = u32pixels[1];
31 len -= 9;
32 pixels += 9;
33
34 if (width == 0 || height == 0) {
35 // indicates geometry was clamped by WLC because it was outside of the output's area
36 json_object *obj = json_tokener_parse(payload);
37 json_object *output;
38 json_object_object_get_ex(obj, "output", &output);
39 const char *name = json_object_get_string(output);
40 json_object_put(obj);
41 sway_abort("Unknown output %s.", name);
42 }
43
44 if (raw) {
45 fwrite(pixels, 1, len, stdout);
46 fflush(stdout);
47 free(pixels - 9);
48 return;
49 }
50
51 char size[10 + 1 + 10 + 2 + 1]; // int32_t are max 10 digits
52 sprintf(size, "%dx%d+0", width, height);
53
54 pid_t child;
55 int fd[2];
56 pipe(fd);
57
58 if ((child = fork()) < 0) {
59 sway_log(L_ERROR, "Swaygrab failed to fork.");
60 exit(EXIT_FAILURE);
61 } else if (child != 0) {
62 close(fd[0]);
63 write(fd[1], pixels, len);
64 close(fd[1]);
65 free(pixels - 9);
66 waitpid(child, NULL, 0);
67 } else {
68 close(fd[1]);
69 if (dup2(fd[0], 0) != 0) {
70 sway_log(L_ERROR, "Could not fdup the pipe");
71 }
72 close(fd[0]);
73 execlp("convert", "convert", "-depth", "8", "-size", size, "rgba:-", "-flip", file, NULL);
74 sway_log(L_ERROR, "Swaygrab could not run convert.");
75 exit(EXIT_FAILURE);
76 }
77}
78
79void grab_and_apply_movie_magic(const char *file, const char *payload,
80 int socketfd, int raw, int framerate) {
81 if (raw) {
82 sway_log(L_ERROR, "Raw capture data is not yet supported. Proceeding with ffmpeg normally.");
83 }
84
85 uint32_t len = strlen(payload);
86 char *pixels = ipc_single_command(socketfd,
87 IPC_SWAY_GET_PIXELS, payload, &len);
88 uint32_t *u32pixels = (uint32_t *)(pixels + 1);
89 uint32_t width = u32pixels[0];
90 uint32_t height = u32pixels[1];
91 pixels += 9;
92
93 if (width == 0 || height == 0) {
94 // indicates geometry was clamped by WLC because it was outside of the output's area
95 json_object *obj = json_tokener_parse(payload);
96 json_object *output;
97 json_object_object_get_ex(obj, "output", &output);
98 const char *name = json_object_get_string(output);
99 json_object_put(obj);
100 sway_abort("Unknown output %s.", name);
101 }
102
103 char *ffmpeg_opts = getenv("SWAYGRAB_FFMPEG_OPTS");
104 if(!ffmpeg_opts) {
105 ffmpeg_opts = "";
106 }
107
108 const char *fmt = "ffmpeg %s -f rawvideo -framerate %d "
109 "-video_size %dx%d -pixel_format argb "
110 "-i pipe:0 -r %d -vf vflip %s";
111 char *cmd = malloc(strlen(fmt) - 8 /*args*/
112 + strlen(ffmpeg_opts) + numlen(width) + numlen(height)
113 + numlen(framerate) * 2 + strlen(file) + 1);
114 sprintf(cmd, fmt, ffmpeg_opts, framerate, width, height, framerate, file);
115
116 long ns = (long)(1000000000 * (1.0 / framerate));
117 struct timespec start, finish, ts;
118 ts.tv_sec = 0;
119
120 FILE *f = popen(cmd, "w");
121 fwrite(pixels, 1, len, f);
122 free(pixels - 9);
123 int sleep = 0;
124 while (sleep != -1) {
125 clock_gettime(CLOCK_MONOTONIC, &start);
126 len = strlen(payload);
127 pixels = ipc_single_command(socketfd,
128 IPC_SWAY_GET_PIXELS, payload, &len);
129 pixels += 9;
130 len -= 9;
131
132 fwrite(pixels, 1, len, f);
133
134 free(pixels - 9);
135 clock_gettime(CLOCK_MONOTONIC, &finish);
136 ts.tv_nsec = ns;
137 double fts = (double)finish.tv_sec + 1.0e-9*finish.tv_nsec;
138 double sts = (double)start.tv_sec + 1.0e-9*start.tv_nsec;
139 long diff = (fts - sts) * 1000000000;
140 ts.tv_nsec = ns - diff;
141 if (ts.tv_nsec < 0) {
142 ts.tv_nsec = 0;
143 }
144 sleep = nanosleep(&ts, NULL);
145 }
146 fflush(f);
147
148 fclose(f);
149 free(cmd);
150}
151
152char *default_filename(const char *extension) {
153 int ext_len = strlen(extension);
154 int len = 28 + ext_len; // format: "2015-12-17-180040_swaygrab.ext"
155 char *filename = malloc(len * sizeof(char));
156 time_t t = time(NULL);
157
158 struct tm *lt = localtime(&t);
159 strftime(filename, len, "%Y-%m-%d-%H%M%S_swaygrab.", lt);
160 strncat(filename, extension, ext_len);
161
162 return filename;
163}
164
165int main(int argc, char **argv) {
166 static int capture = 0, raw = 0;
167 char *socket_path = NULL;
168 char *output = NULL;
169 int framerate = 30;
170 bool grab_focused = false;
171
172 init_log(L_INFO);
173
174 static struct option long_options[] = {
175 {"help", no_argument, NULL, 'h'},
176 {"capture", no_argument, NULL, 'c'},
177 {"output", required_argument, NULL, 'o'},
178 {"version", no_argument, NULL, 'v'},
179 {"socket", required_argument, NULL, 's'},
180 {"raw", no_argument, NULL, 'r'},
181 {"rate", required_argument, NULL, 'R'},
182 {"focused", no_argument, NULL, 'f'},
183 {0, 0, 0, 0}
184 };
185
186 const char *usage =
187 "Usage: swaygrab [options] [file]\n"
188 "\n"
189 " -h, --help Show help message and quit.\n"
190 " -c, --capture Capture video.\n"
191 " -o, --output <output> Output source.\n"
192 " -v, --version Show the version number and quit.\n"
193 " -s, --socket <socket> Use the specified socket.\n"
194 " -R, --rate <rate> Specify framerate (default: 30)\n"
195 " -r, --raw Write raw rgba data to stdout.\n"
196 " -f, --focused Grab the focused container.\n";
197
198 int c;
199 while (1) {
200 int option_index = 0;
201 c = getopt_long(argc, argv, "hco:vs:R:rf", long_options, &option_index);
202 if (c == -1) {
203 break;
204 }
205 switch (c) {
206 case 'f':
207 grab_focused = true;
208 break;
209 case 's': // Socket
210 socket_path = strdup(optarg);
211 break;
212 case 'r':
213 raw = 1;
214 break;
215 case 'o': // output
216 output = strdup(optarg);
217 break;
218 case 'c':
219 capture = 1;
220 break;
221 case 'R': // Frame rate
222 framerate = atoi(optarg);
223 break;
224 case 'v':
225 fprintf(stdout, "sway version " SWAY_VERSION "\n");
226 exit(EXIT_SUCCESS);
227 break;
228 default:
229 fprintf(stderr, "%s", usage);
230 exit(EXIT_FAILURE);
231 }
232 }
233
234 if (!socket_path) {
235 socket_path = get_socketpath();
236 if (!socket_path) {
237 sway_abort("Unable to retrieve socket path");
238 }
239 }
240
241 char *file = NULL;
242 if (raw) {
243 if (optind >= argc + 1) {
244 sway_abort("Invalid usage. See `man swaygrab` %d %d", argc, optind);
245 }
246 } else if (optind < argc) {
247 file = strdup(argv[optind]);
248 }
249
250 int socketfd = ipc_open_socket(socket_path);
251 free(socket_path);
252
253 init_json_tree(socketfd);
254
255 struct wlc_geometry *geo;
256
257 if (grab_focused) {
258 output = get_focused_output();
259 json_object *con = get_focused_container();
260 json_object *name;
261 json_object_object_get_ex(con, "name", &name);
262 geo = get_container_geometry(con);
263 free(con);
264 } else {
265 if (!output) {
266 output = get_focused_output();
267 }
268 geo = get_container_geometry(get_output_container(output));
269 // the geometry of the output in the get_tree response is relative to a global (0, 0).
270 // we need it to be relative to itself, so set origin to (0, 0) always.
271 geo->origin.x = 0;
272 geo->origin.y = 0;
273 }
274
275 const char *payload = create_payload(output, geo);
276
277 free(geo);
278
279 if (!file) {
280 if (!capture) {
281 file = default_filename("png");
282 } else {
283 file = default_filename("webm");
284 }
285 }
286
287 if (!capture) {
288 grab_and_apply_magick(file, payload, socketfd, raw);
289 } else {
290 grab_and_apply_movie_magic(file, payload, socketfd, raw, framerate);
291 }
292
293 free_json_tree();
294 free(output);
295 free(file);
296 close(socketfd);
297 return 0;
298}
diff --git a/swaygrab/swaygrab.1.txt b/swaygrab/swaygrab.1.txt
deleted file mode 100644
index 8faf43f5..00000000
--- a/swaygrab/swaygrab.1.txt
+++ /dev/null
@@ -1,76 +0,0 @@
1/////
2vim:set ts=4 sw=4 tw=82 noet:
3/////
4:quotes.~:
5
6swaygrab (1)
7============
8
9Name
10----
11swaygrab - Grab image data from the current sway session.
12
13Synopsis
14--------
15'swaygrab' [options] [file]
16
17Grabs pixels from an output and writes them to _file_. The image will be passed to
18ImageMagick convert for processing.
19
20Options
21-------
22
23*-h, --help*::
24 Show help message and quit.
25
26*-c, \--capture*::
27 Captures multiple frames as video and passes them into ffmpeg. Continues until
28 you send SIGTERM (ctrl+c) to swaygrab.
29
30*-o, \--output* <output>::
31 Use the specified _output_. If no output is defined the currently focused
32 output in sway will be used.
33
34*-v, \--version*::
35 Print the version (of swaymsg) and quit.
36
37*-s, --socket* <path>::
38 Use the specified socket path. Otherwise, swaymsg will ask sway where the
39 socket is (which is the value of $SWAYSOCK, then of $I3SOCK).
40
41*-R, --rate* <rate>::
42 Specify a framerate (in frames per second). Used in combination with -c.
43 Default is 30. Must be an integer.
44
45*-r, --raw*::
46 Instead of invoking ImageMagick or ffmpeg, dump raw rgba data to stdout.
47
48*-f, --focused*::
49 Capture only the currently focused container.
50
51Environment Variables
52---------------------
53swaygrab reads the following environment variables.
54
55*SWAYGRAB_FFMPEG_OPTS*::
56 Pass additional arguments to FFmpeg when starting a capture.
57
58Examples
59--------
60
61swaygrab output.png::
62 Grab the contents of currently focused output and write to output.png.
63
64swaygrab -c -o HDMI-A-1 output.webm::
65 Capture a webm of HDMI-A-1.
66
67SWAYGRAB_FFMPEG_OPTS="-f alsa -i pulse" swaygrab -c::
68 Capture the focused output and encode audio from the default recording
69 device.
70
71Authors
72-------
73
74Maintained by Drew DeVault <sir@cmpwn.com>, who is assisted by other open
75source contributors. For more information about sway development, see
76<https://github.com/swaywm/sway>.
diff --git a/swaylock/swaylock.1.scd b/swaylock/swaylock.1.scd
new file mode 100644
index 00000000..2580bff9
--- /dev/null
+++ b/swaylock/swaylock.1.scd
@@ -0,0 +1,103 @@
1swaylock(1)
2
3# NAME
4
5swaylock - Screen locker for Wayland
6
7# SYNOPSIS
8
9_swaylock_ [options...]
10
11Locks your Wayland session.
12
13# OPTIONS
14
15*-h, --help*
16 Show help message and quit.
17
18*-c, --color* <rrggbb[aa]>
19 Turn the screen into the given color. If -i is used, this sets the
20 background of the image to the given color. Defaults to white (FFFFFF), or
21 transparent (00000000) if an image is in use.
22
23*-f, --daemonize*
24 Fork into the background after spawning. Note: this is the default behavior
25 of i3lock.
26
27*-i, --image* [<output>:]<path>
28 Display the given image, optionally only on the given output. Use -c to set
29 a background color.
30
31*--scaling*
32 Scaling mode for images: _stretch_, _fill_, _fit_, _center_, or _tile_.
33
34*-t, --tiling*
35 Same as --scaling=tile.
36
37*-u, --no-unlock-indicator*
38 Disable the unlock indicator.
39
40*-v, --version*
41 Show the version number and quit.
42
43# APPEARANCE
44
45*--bshlcolor* <rrggbb[aa]>
46 Sets the color of backspace highlight segments.
47
48*--font* <font>
49 Sets the font of the text inside the indicator.
50
51*--insidecolor* <rrggbb[aa]>
52 Sets the color of the inside of the indicator when typing or idle.
53
54*--insidevercolor* <rrggbb[aa]>
55 Sets the color of the inside of the indicator when verifying.
56
57*--insidewrongcolor* <rrggbb[aa]>
58 Sets the color of the inside of the indicator when invalid.
59
60*--keyhlcolor* <rrggbb[aa]>
61 Sets the color of keypress highlight segments.
62
63*--linecolor* <rrggbb[aa]>
64 Sets the color of the lines that separate the inside and outside of the
65 indicator.
66
67*-s, --line-uses-inside*
68 Use the color of the inside of the indicator for the line separating the
69 inside and outside of the indicator.
70
71*-r, --line-uses-ring*
72 Use the outer ring's color for the line separating the inside and outside of
73 the indicator.
74
75*--ringcolor* <rrggbb[aa]>
76 Sets the color of the outside of the indicator when typing or idle.
77
78*--ringvercolor* <rrggbb[aa]>
79 Sets the color of the outside of the indicator when verifying.
80
81*--ringwrongcolor* <rrggbb[aa]>
82 Sets the color of the outside of the indicator when invalid.
83
84*--separatorcolor* <rrggbb[aa]>
85 Sets the color of the lines that seperate highlight segments.
86
87*--textcolor* <rrggbb[aa]>
88 Sets the color of the text inside the indicator.
89
90*--indicator-radius* <radius>
91 Sets the radius of the indicator to _radius_ pixels. The default value is
92 50.
93
94*--indicator-thickness* <thickness>
95 Sets the thickness of the indicator to _thickness_ pixels. The default value
96 is 10.
97
98# AUTHORS
99
100Maintained by Drew DeVault <sir@cmpwn.com>, who is assisted by other open
101source contributors. For more information about sway development, see
102https://github.com/swaywm/sway.
103
diff --git a/swaymsg/swaymsg.1.scd b/swaymsg/swaymsg.1.scd
new file mode 100644
index 00000000..1aa6a1b0
--- /dev/null
+++ b/swaymsg/swaymsg.1.scd
@@ -0,0 +1,66 @@
1swaymsg(1)
2
3# NAME
4
5swaymsg - Send messages to a running instance of sway over the IPC socket.
6
7# SYNOPSIS
8
9_swaymsg_ [options...] [message]
10
11# OPTIONS
12
13*-h, --help*
14 Show help message and quit.
15
16*-q, --quiet*
17 Sends the IPC message but does not print the response from sway.
18
19*-r, --raw*
20 Use raw output even if using a tty.
21
22*-s, --socket* <path>
23 Use the specified socket path. Otherwise, swaymsg will ask sway where the
24 socket is (which is the value of $SWAYSOCK, then of $I3SOCK).
25
26*-t, --type* <type>
27 Specify the type of IPC message. See below.
28
29*-v, --version*
30 Print the version (of swaymsg) and quit.
31
32# IPC MESSAGE TYPES
33
34*<command>*
35 The message is a sway command (the same commands you can bind to keybindings
36 in your sway config file). It will be executed immediately.
37
38 See **sway**(5) for a list of commands.
39
40*get\_workspaces*
41 Gets a JSON-encoded list of workspaces and their status.
42
43*get\_inputs*
44 Gets a JSON-encoded list of current inputs.
45
46*get\_outputs*
47 Gets a JSON-encoded list of current outputs.
48
49*get\_tree*
50 Gets a JSON-encoded layout tree of all open windows, containers, outputs,
51 workspaces, and so on.
52
53*get\_marks*
54 Get a JSON-encoded list of marks.
55
56*get\_bar\_config*
57 Get a JSON-encoded configuration for swaybar.
58
59*get\_version*
60 Get JSON-encoded version information for the running instance of sway.
61
62*get\_clipboard*
63 Get JSON-encoded information about the clipboard.
64 Returns the current clipboard mime-types if called without
65 arguments, otherwise returns the clipboard data in the requested
66 formats. Encodes the data using base64 for non-text mime types.