Commit graph

78 commits

Author SHA1 Message Date
Flakebi
2578669de7 Flush stdout in swaymsg when in subscribe mode 2019-03-16 12:32:09 -04:00
Peter Grayson
b7fe5097e9 Add -p/--pretty option to swaymsg
This new option forces pretty (non-raw/non-JSON) output. By default, when
not using a tty, swaymsg outputs using the "raw" format. This makes it
impossible to, for example, pipe the pretty output to a pager such as
`less` since piping does not use a tty.

The new -p/--pretty option gives the user explicit control over the output
format while retaining the default tty-dependent behavior.

Signed-off-by: Peter Grayson <pete@jpgrayson.net>
2019-03-08 14:29:39 -05:00
Brian Ashworth
7f700e08ac ipc: describe libinput device configuration
This adds the device configurations to the ipc response for libinput
devices. Only supported configuration options for the device will be
added. This also moves `libinput_send_events` inside a new `libinput`
object that contains the rest of the configuration options. sway-ipc(7)
has been updated to reflect the changes and document the new additions.
2019-03-07 08:41:19 -07:00
Brian Ashworth
f876009c7f Add sway-ipc.7.scd to document IPC protocol
This add `sway-ipc.7.scd` that documents the IPC protocol.

This also increased the minimum scdoc version from 1.8.1 to 1.9.0 to
allow for table cells to be continued on the following line
2019-02-27 13:23:10 -05:00
Brian Ashworth
a64a3ee6bb ipc: handle unnamed xkb_active_layout_name
If the active xkb_layout does not have a name, use `NULL` instead of
`json_object_new_string(NULL)`. This also makes it so swaymsg will pretty
print this as `(unnamed)`.
2019-02-11 01:07:11 +01:00
Jan Beich
ba96983bf0 Make json-c include respect pkg-config --cflags
json-c.pc contains `Cflags: -I${includedir}/json-c`, so `<json-c/json.h>`
won't be found unless the parent directory is searched by default.
2019-01-23 21:50:06 -05:00
M Stoeckl
4b1eaaf731 Removed unused wlroots dependency for sway(bg|bar|msg|nag)
Also remove direct libm dependency where unused.
2019-01-21 13:04:15 -05:00
M Stoeckl
1211a81aad Replace wlr_log with sway_log
This commit mostly duplicates the wlr_log functions, although
with a sway_* prefix. (This is very similar to PR #2009.)
However, the logging function no longer needs to be replaceable,
so sway_log_init's second argument is used to set the exit
callback for sway_abort.

wlr_log_init is still invoked in sway/main.c

This commit makes it easier to remove the wlroots dependency for
the helper programs swaymsg, swaybg, swaybar, and swaynag.
2019-01-21 12:59:42 +01:00
emersion
bb2f007ad3
meson: remove rpath options 2019-01-18 08:26:44 +01:00
Brian Ashworth
4dba42555f get_inputs: add libinput send events mode
Add `libinput_send_events` to the IPC output for `get_inputs` to allow
scripting of mode changes.
2019-01-09 23:17:27 -05:00
Ian Fan
a82b8a3c14 Remove readline.c
All occurrences of read_line have been replaced by getline.
peek_line has been absorbed into detect_brace.
2019-01-01 09:01:25 +00:00
Brian Ashworth
e62ab6ddbd swaymsg: parse success of single object
Allows swaymsg to parse the success attribute of a single object
response. This is needed for the subscribe event.
2018-11-28 21:41:58 -05:00
Brian Ashworth
bf9a52bab0 Implement support for swaymsg -t SUBSCRIBE [-m]
In `i3 4.16`, `i3-msg` can be used with the message type `subscribe`
and has the ability to monitor for responses until killed. This adds
support for both to swaymsg.

If the JSON array of event types is malformed or contains an invalid
event, sway will send a response with `success` set to `false`. If
swaymsg sees this, it will not display the failure and exit.

If the `subscribe` event is successful, swaymsg will wait for the first
response and display that instead of the success message. If
`-m/--monitor` is given, swaymsg will continue monitor for responses
until killed or a malformed response is received.

For the `subscribe` event, the responses will always be printed as JSON.
If `-r/--raw` is given, the JSON will not be pretty printed, which may
be preferred when monitoring due to there being multiple responses.

Example: `swaymsg -t SUBSCRIBE -m "['window']"`
2018-11-28 11:19:18 -05:00
emersion
3a310f92ab
Replace _XOPEN_SOURCE with _POSIX_C_SOURCE
And make sure we don't define both in the same source file.
2018-11-25 17:19:43 +01:00
Harish Krupo
d8ad429e39 IPC: Send keyboard layout info in IPC_GET_INPUTS
Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
2018-11-12 22:00:22 +05:30
madblobfish
e47b31c556 document swaymessage type for get_seats 2018-11-04 22:49:44 +01:00
Cole Mickens
ef888321ba ipc: move refresh from output to output->current_mode 2018-11-03 15:09:34 -07:00
Cole Mickens
1f486fe898 swaymsg: get_outputs: use output->current_mode for current mode display 2018-11-03 04:30:53 -07:00
emersion
eb675f0dfd
swaymsg: fix get_outputs status code 2018-10-29 11:25:54 +01:00
Ryan Dwyer
fa8959532b Fix program name in version strings
When running swaymsg -v, the version returned is actually the version of
swaymsg itself, yet the message displayed was "sway version <version>".
This can create confusion if users update sway and swaymsg but don't
restart sway, then use swaymsg to check the version.

This patch changes the wording to be "swaymsg version <version>"
instead, and likewise for swaybar.

To get the version of a running sway instance, users should run swaymsg
-t get_version.
2018-10-10 18:34:50 +10:00
Arkadiusz Hiler
eed0bc3ebd Add support for installing binaries with DT_RPATH
It's better to use DT_RPATH dynamic section of the elf binary to store
the paths of libraries to load instead of overwriting LD_LIBRARY_PATH
for the whole environment, causing surprises. This solution is much more
transparent and perfectly suitable for running contained installations
of wayland/wlroots/sway.

The code unsetting the LD_LIBRARY_PATH/LD_PRELOAD was also deleted as
it's a placebo security at best - we should trust the execution path
that leads us to running sway, and it's way too late to care about those
variables since we already started executing our compositor, thus we
would be compromised anyway.
2018-09-30 15:37:01 +03:00
Ian Fan
3edaf2ce2a ipc: add tick event 2018-08-01 16:57:15 +01:00
emersion
ba3511b243 Remove clipboard command and get_clipboard message 2018-07-10 22:09:21 +01:00
Ian Fan
23c1c26c3f Add get_config message type to ipc 2018-07-10 12:37:37 +01:00
Ian Fan
5fd36164a0 Add get_binding_modes message type to ipc 2018-07-10 12:03:46 +01:00
emersion
63b4bf5000
Update for swaywm/wlroots#1126 2018-07-09 22:54:30 +01:00
Armin Preiml
354648cc07 refactor success_object 2018-06-30 10:38:16 +02:00
Armin Preiml
659871de1e fix swaymsg: errors are displayed again
Command errors didn't get displayed, because the success function didn't
accept objects
2018-06-30 10:29:32 +02:00
Brian Ashworth
a1b5b93d29 Store sway_outputs so that they can be reenabled 2018-06-06 20:11:24 -04:00
Ryan Dwyer
6f4cb2b29d Add tree representation to IPC workspace description 2018-05-29 17:42:11 +10:00
Ryan Dwyer
508a76695c swaymsg: Fix exit code 2018-05-28 13:33:02 +10:00
emersion
7af172ed0a
Delete old asciidoc man pages 2018-05-25 19:11:43 +01:00
Drew DeVault
2da685e913 Merge remote-tracking branch 'origin/master' into scdoc 2018-05-12 09:01:16 -04:00
Ryan Dwyer
c72940837c Implement IPC get_seats command 2018-05-12 18:17:36 +10:00
Drew DeVault
22f52b91ed Add swaylock(1) and swaymsg(1) 2018-05-11 21:39:47 -04:00
Nicolas Braud-Santoni
cb2a3e9036 swaymsg: Fix spelling in error message 2018-05-05 20:40:34 +02:00
emersion
4ab5506064
ipc: add output modes 2018-03-12 13:48:42 +01:00
Dominique Martinet
51f6718581 swaymsg: convert to wlr_log 2018-01-05 23:40:09 +01:00
Rachel K
dc0e6d46fb update json-c dep to 0.13 2018-01-04 15:46:37 +00:00
emersion
fff67906e1
Pretty-print all output info in swaymsg -t get_outputs 2017-12-29 11:16:57 +01:00
Tony Crisci
a4c1270ef0 fix memory leak in swaymsg 2017-12-19 05:38:41 -05:00
Tony Crisci
8b4d81114a fix memory leak in swaymsg 2017-12-18 17:52:50 -05:00
Tony Crisci
f2985000f3 ipc get_inputs 2017-12-18 14:27:38 -05:00
Tony Crisci
517af37cc9 remove relevant CMakeLists.txt 2017-11-30 11:54:01 -05:00
Tony Crisci
1d702b6376 meson build swaymsg 2017-11-30 11:40:49 -05:00
madblobfish
758c60e836 fintune swaymsg manpage
Added a hint where to find the commands.
Also indicate that command is itself not a command,
2017-10-13 01:10:32 +02:00
Drew DeVault
6d83a59b46 Merge pull request #1263 from nyorain/master
Implement get_clipboard ipc message
2017-10-08 11:05:54 -04:00
Zuzana Svetlikova
ef0c51b2f3 Fix github links in doc 2017-10-06 05:13:42 +02:00
nyorain
1cca551c6f Add get_clipbard ipc errors; Adapt swaymsg
Also increase the get_clipboard timeout to 30 secs
2017-07-11 18:04:28 +02:00
nyorain
c0f2acce4e Rework get_clipboard implementation 2017-07-07 21:51:34 +02:00