diff --git a/.build.yml b/.build.yml index 3cfb7483..14433311 100644 --- a/.build.yml +++ b/.build.yml @@ -12,6 +12,7 @@ packages: - gdk-pixbuf2 - libinput - libxkbcommon + - scdoc sources: - https://github.com/swaywm/sway - 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: * xwayland * libinput >= 1.6.0 * libcap -* asciidoc * pcre * json-c >= 0.13 * pango @@ -67,6 +66,7 @@ Abhängigkeiten: * pam ** * imagemagick (erforderlich für Bildaufnahme mit swaygrab) * ffmpeg (erforderlich für Videoaufnahme swaygrab) +* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (erforderlich für man pages) _\*Nur erforderlich für swaybar, swaybg, und swaylock_ 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 και θα με βρείτ * xwayland * libinput >= 1.6.0 * libcap -* asciidoc * pcre * json-c >= 0.13 * pango @@ -60,6 +59,7 @@ To username μου στο Freenode είναι kon14 και θα με βρείτ * pam ** * imagemagick (αναγκαίο για καταγραφή εικόνας μέσω του swaygrab) * ffmpeg (αναγκαίο για καταγραφή video μέσω του swaygrab) +* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages) _\*Απαιτείται μόνο για swaybar, swaybg, and swaylock_ 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 : * xwayland * libinput >= 1.6.0 * libcap -* asciidoc * pcre * json-c >= 0.13 * pango @@ -62,6 +61,7 @@ Installez les dépendances : * pam ** * imagemagick (requis pour la capture d'image avec swaygrab) * ffmpeg (requis pour la capture vidéo avec swaygrab) +* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (requis pour les pages man) _\*Uniquement requis pour swaybar, swaybg, and swaylock_ 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: * xwayland * libinput >= 1.6.0 * libcap -* asciidoc * pcre * json-c >= 0.13 * pango @@ -63,6 +62,7 @@ Installa queste dipendenze: * pam ** * imagemagick (richiesto per catturare immagini con swaygrab) * ffmpeg (rrichiesto per catturare video con swaygrab) +* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (rrichiesto per man pages) _\*Richiesto solo per swaybar, swaybg, e swaylock_ 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は沢山のディストリビューションで提供されています。" * xwayland * libinput >= 1.6.0 * libcap -* asciidoc * pcre * json-c >= 0.13 * pango @@ -53,6 +52,7 @@ Swayは沢山のディストリビューションで提供されています。" * pam ** * imagemagick (swaygrabでスクリーンショットを撮るのに必要です) * ffmpeg (swaygrabで画面を録画するのに必要です) +* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (manで必要です) _\*swaybar,swaybg,swaylockでのみ必要です_ diff --git a/README.md b/README.md index 30911765..49140fb8 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,6 @@ Install dependencies: * xwayland * libinput >= 1.6.0 * libcap -* asciidoc * pcre * json-c >= 0.13 * pango @@ -61,6 +60,7 @@ Install dependencies: * dbus >= 1.10 *** * imagemagick (required for image capture with swaygrab) * ffmpeg (required for video capture with swaygrab) +* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages) _\*Only required for swaybar, swaybg, and swaylock_ 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: * xwayland * libinput >= 1.6.0 * libcap -* asciidoc * pcre * json-c >= 0.13 * pango @@ -69,6 +68,7 @@ Antes de iniciar a compilação, instale as dependências: * pam ** * imagemagick (capturar imagem com o swaygrab) * ffmpeg (capturar vídeo com o swaygrab) +* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (man pages) _\*Dependência apenas de swaybar, swaybg, e swaylock_ 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 доступен во многих дистрибутивах и наход * xwayland * libinput >= 1.6.0 * libcap -* asciidoc * pcre * json-c >= 0.13 * pango @@ -65,6 +64,7 @@ Sway доступен во многих дистрибутивах и наход * dbus >= 1.10 *** * imagemagick (требуется для захвата изображений через swaygrab) * ffmpeg (требуется для захвата видео через swaygrab) +* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages) _\*Требуется только для swaybar, swaybg и swaylock_ 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 (а * xwayland * libinput >= 1.6.0 * libcap -* asciidoc * pcre * json-c >= 0.13 * pango @@ -69,6 +68,7 @@ Sway доступний у багатьох дистрибутивах Linux (а * pam ** * imagemagick (для захоплення зображень за допомогою swaygrab) * ffmpeg (для захоплення відео за допомогою swaygrab) +* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages) _\*Лише для swaybar, swaybg та swaylock_ diff --git a/completions/zsh/_swaymsg b/completions/zsh/_swaymsg index 1c3ccd65..6bb03279 100644 --- a/completions/zsh/_swaymsg +++ b/completions/zsh/_swaymsg @@ -15,6 +15,7 @@ types=( 'get_workspaces' +'get_seats' 'get_inputs' 'get_outputs' 'get_tree' diff --git a/include/ipc.h b/include/ipc.h index 9665a88d..8172c782 100644 --- a/include/ipc.h +++ b/include/ipc.h @@ -4,6 +4,7 @@ #define event_mask(ev) (1 << (ev & 0x7F)) enum ipc_command_type { + // i3 command types - see i3's I3_REPLY_TYPE constants IPC_COMMAND = 0, IPC_GET_WORKSPACES = 1, IPC_SUBSCRIBE = 2, @@ -12,9 +13,13 @@ enum ipc_command_type { IPC_GET_MARKS = 5, IPC_GET_BAR_CONFIG = 6, IPC_GET_VERSION = 7, - IPC_GET_INPUTS = 8, - IPC_GET_CLIPBOARD = 9, - // Events send from sway to clients. Events have the highest bits set. + + // sway-specific command types + IPC_GET_INPUTS = 100, + IPC_GET_CLIPBOARD = 101, + IPC_GET_SEATS = 102, + + // Events sent from sway to clients. Events have the highest bits set. IPC_EVENT_WORKSPACE = ((1<<31) | 0), IPC_EVENT_OUTPUT = ((1<<31) | 1), IPC_EVENT_MODE = ((1<<31) | 2), diff --git a/include/sway/config.h b/include/sway/config.h index a0e7e81f..b20458cb 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -263,8 +263,10 @@ enum ipc_feature { IPC_FEATURE_EVENT_BINDING = 4096, IPC_FEATURE_EVENT_INPUT = 8192, IPC_FEATURE_GET_CLIPBOARD = 16384, + IPC_FEATURE_GET_SEATS = 32768, - IPC_FEATURE_ALL_COMMANDS = 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 16384, + IPC_FEATURE_ALL_COMMANDS = + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 16384 | 32768, IPC_FEATURE_ALL_EVENTS = 256 | 512 | 1024 | 2048 | 4096 | 8192, IPC_FEATURE_ALL = IPC_FEATURE_ALL_COMMANDS | IPC_FEATURE_ALL_EVENTS, diff --git a/include/sway/ipc-json.h b/include/sway/ipc-json.h index 7d87d377..440e3a24 100644 --- a/include/sway/ipc-json.h +++ b/include/sway/ipc-json.h @@ -9,6 +9,7 @@ json_object *ipc_json_get_version(); json_object *ipc_json_describe_container(struct sway_container *c); json_object *ipc_json_describe_container_recursive(struct sway_container *c); json_object *ipc_json_describe_input(struct sway_input_device *device); +json_object *ipc_json_describe_seat(struct sway_seat *seat); json_object *ipc_json_describe_bar_config(struct bar_config *bar); #endif 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') math = cc.find_library('m') rt = cc.find_library('rt') git = find_program('git', required: false) -a2x = find_program('a2x', required: false) conf_data = configuration_data() @@ -48,31 +47,30 @@ if gdk_pixbuf.found() conf_data.set('HAVE_GDK_PIXBUF', true) endif -if a2x.found() +scdoc = find_program('scdoc', required: false) + +if scdoc.found() + sh = find_program('sh') mandir = get_option('mandir') man_files = [ - 'sway/sway.1.txt', - 'sway/sway.5.txt', - 'sway/sway-bar.5.txt', - 'sway/sway-input.5.txt', - 'sway/sway-security.7.txt', - 'swaymsg/swaymsg.1.txt', + 'sway/sway.1.scd', + 'sway/sway.5.scd', + 'sway/sway-bar.5.scd', + 'sway/sway-input.5.scd', + 'swaylock/swaylock.1.scd', + 'swaymsg/swaymsg.1.scd', ] foreach filename : man_files topic = filename.split('.')[-3].split('/')[-1] section = filename.split('.')[-2] + output = '@0@.@1@'.format(topic, section) custom_target( - 'man-@0@-@1@'.format(topic, section), + output, input: filename, - output: '@BASENAME@', + output: output, command: [ - a2x, - '--no-xmllint', - '--doctype', 'manpage', - '--format', 'manpage', - '--destination-dir', meson.current_build_dir(), - '@INPUT@' + sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.path(), output) ], install: true, install_dir: '@0@/man@1@'.format(mandir, section) diff --git a/sway/ipc-json.c b/sway/ipc-json.c index ea7fd9ad..ad37216f 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -267,6 +267,31 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) { return object; } +json_object *ipc_json_describe_seat(struct sway_seat *seat) { + if (!(sway_assert(seat, "Seat must not be null"))) { + return NULL; + } + + json_object *object = json_object_new_object(); + struct sway_container *focus = seat_get_focus(seat); + + json_object_object_add(object, "name", + json_object_new_string(seat->wlr_seat->name)); + json_object_object_add(object, "capabilities", + json_object_new_int(seat->wlr_seat->capabilities)); + json_object_object_add(object, "focus", + json_object_new_int(focus ? focus->id : 0)); + + json_object *devices = json_object_new_array(); + struct sway_seat_device *device = NULL; + wl_list_for_each(device, &seat->devices, link) { + json_object_array_add(devices, ipc_json_describe_input(device->input_device)); + } + json_object_object_add(object, "devices", devices); + + return object; +} + json_object *ipc_json_describe_bar_config(struct bar_config *bar) { if (!sway_assert(bar, "Bar must not be NULL")) { return NULL; diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 39d1d0a7..8734e8f8 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c @@ -546,6 +546,19 @@ void ipc_client_handle_command(struct ipc_client *client) { goto exit_cleanup; } + case IPC_GET_SEATS: + { + json_object *seats = json_object_new_array(); + struct sway_seat *seat = NULL; + wl_list_for_each(seat, &input_manager->seats, link) { + json_object_array_add(seats, ipc_json_describe_seat(seat)); + } + const char *json_string = json_object_to_json_string(seats); + ipc_send_reply(client, json_string, (uint32_t)strlen(json_string)); + json_object_put(seats); // free + goto exit_cleanup; + } + case IPC_GET_TREE: { json_object *tree = diff --git a/sway/sway-bar.5.txt b/sway/sway-bar.5.scd similarity index 52% rename from sway/sway-bar.5.txt rename to 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 @@ -///// -vim:set ts=4 sw=4 tw=82 noet: -///// -sway-bar (5) -============ +sway-bar(5) + +# NAME -Name ----- sway-bar - bar configuration file and commands -Description ------------ +# DESCRIPTION -Sway allows configuring swaybar in the sway configuration file. -Swaybar commands must be used inside a _bar { }_ block in the config file. +Sway allows configuring swaybar in the sway configuration file. Swaybar +commands must be used inside a _bar { }_ block in the config file. +# COMMANDS -Commands --------- +*status\_command* + Executes the bar _status command_ with _sh -c_. Each line of text printed + to stdout from this command will be displayed in the status area of the + bar. You may also use the i3bar JSON protocol: -**status_command** :: - Executes the bar _status command_ with _sh -c_. Each line of text printed to - stdout from this command will be displayed in the status area of the bar. You - may also use the i3bar JSON protocol: - + https://i3wm.org/docs/i3bar-protocol.html -**pango_markup** :: +*pango\_markup* enabled|disabled Enables or disables pango markup for status lines. This has no effect on status lines using the i3bar JSON protocol. -**id** :: +*id* Sets the ID of the bar. -**position** :: +*position* top|bottom Sets position of the bar. Default is _bottom_. -**output** :: - Restrict the bar to a certain output, can be specified multiple times. If the - output command is omitted, the bar will be displayed on all outputs. +*output* + Restrict the bar to a certain output, can be specified multiple times. If + the output command is omitted, the bar will be displayed on all outputs. -**swaybar_command** :: - Executes custom bar command, default is _swaybar_. +*swaybar\_command* + Executes custom bar command. Default is _swaybar_. -**font** :: +*font* Specifies the font to be used in the bar. -**separator_symbol** :: +*separator\_symbol* Specifies the separator symbol to separate blocks on the bar. -**wrap_scroll** :: +*wrap\_scroll* yes|no Enables or disables wrapping when scrolling through workspaces with the scroll wheel. Default is _no_. -**workspace_buttons** :: +*workspace\_buttons* yes|no Enables or disables workspace buttons on the bar. Default is _yes_. -**strip_workspace_numbers** :: +*strip\_workspace\_numbers* yes|no If set to _yes_, then workspace numbers will be omitted from the workspace button and only the custom name will be shown. Default is _no_. -**binding_mode_indicator** :: +*binding\_mode\_indicator* yes|no Enable or disable binding mode indicator. Default is _yes_. -**height** :: +*height* Sets the height of the bar. Default height will match the font size. -Tray ----- +## TRAY -Swaybar provides a system tray where programs such as NetworkManager, VLC, -Pidgin, etc. can place little icons. The following commands configure -interaction with the tray or individual icons. -The _button_ argument in all following commands is a Linux input event code as -defined in linux/input-event-codes.h. This is because wayland defines button -codes in this manner. +Swaybar provides a system tray where third-party applications may place icons. +The following commands configure the tray. -**activate_button**