aboutsummaryrefslogtreecommitdiff
path: root/swaymsg/main.c
AgeCommit message (Collapse)AuthorLines
2025-04-17swaymsg, swaynag: drop sway_terminate() definitionsFurkan Sahin-4/+0
These are unused.
2025-04-08ipc: standardize pretty print with raw printFurkan Sahin-1/+1
`swaymsg -t get_inputs --raw` calls it a pointer but `--pretty` calls it a Mouse. Previous commit 16300ca2d that set this to pointer probably forgo to update the pretty one. closes #8584
2025-02-16sway/ipc-json: add ext-foreign-toplevel-handle identifier to get_tree ipc outputFurkan Sahin-0/+4
Fixes #8291
2025-01-04swaymsg: pretty-print sandbox propertiesFurkan Sahin-0/+12
2024-08-05Add support for tearing-control-v1Furkan Sahin-1/+5
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3871 Adds option to allow tearing per output, as well as an option to force enable or disable tearing for a specific application using a window rule. Only works with fullscreen applications.
2024-02-16Define _POSIX_C_SOURCE globallyFurkan Sahin-1/+0
See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
2023-02-04fix typoFurkan Sahin-1/+1
2023-02-02swaymsg: s/inactive/disabled/Furkan Sahin-1/+1
The JSON field is named "active", but that's confusing for users: `output disable` is the command which results in `active = false` outputs. Use the same terminology in end-user messages.
2023-02-02swaymsg: print output power statusFurkan Sahin-1/+4
2022-09-28swaymsg: show mode picture aspect ratioFurkan Sahin-2/+10
2022-06-09swaymsg: show non-desktop property when pretty printing outputsFurkan Sahin-2/+11
2022-07-26swaymsg: fix floating_nodes being ignoredFurkan Sahin-0/+9
Fix floating_nodes being ignored in pretty_print_tree.
2021-12-12swaymsg: add GET_TREE pretty-printingFurkan Sahin-0/+48
2021-12-12swaymsg: replace if with switch in pretty_printFurkan Sahin-16/+14
2021-10-25refactor: use JSON_MAX_DEPTH everywhereFurkan Sahin-3/+0
2021-10-21refactor: use sway_abort insteadFurkan Sahin-25/+27
2021-10-21fix: use sane value for json_tokener max_depthFurkan Sahin-2/+6
INT_MAX causes a NULL pointer if there is not enough memory available to fit (INT_MAX * sizeof(struct json_tokener_srec)).
2021-10-21fix: handle NULL from json_tokener_new_exFurkan Sahin-18/+28
if there is not enough memory to fit json_tokener and (depth * json_tokener_srec) in RAM, don't segfault.
2021-10-18swaymsg: fix misplaced return valueFurkan Sahin-1/+1
2021-10-18swaymsg: be explicit about the json parser errorFurkan Sahin-7/+8
2021-10-18swaymsg: use INT_MAX max JSON depth when parsing IPC responseFurkan Sahin-2/+7
Same reasoning as fe11caeac946cecda491d592044a6b9519ef2035. Without this, swaymsg would fail with a cryptic error message when the JSON was nested too deep.
2021-02-03Make command line option lists constFurkan Sahin-1/+1
2021-01-16Changed fprintf(stdout,...) to printf(...) for more readable codeFurkan Sahin-1/+1
2021-01-15swaymsg: use 3 digits for fractional part of the refresh rateFurkan Sahin-4/+4
The fractional part of the real number we want to represent never has more than 3 decimal digits, so use 3 decimal digits of precision. e.g. 'swaymsg -t get_outputs' would show a refresh rate of 59934 mHz as 59.933998 Hz, now correctly as 59.934 Hz.
2020-06-13i3-compat: add GET_BINDING_STATE IPC commandFurkan Sahin-0/+2
2020-03-05Add adaptive_sync_status to output IPC replyFurkan Sahin-3/+8
2019-11-13add scale_filter output config optionFurkan Sahin-1/+5
2019-09-25Add max_render_time to output JSONFurkan Sahin-2/+6
2019-08-04swaymsg: return 2 for sway errorsFurkan Sahin-1/+1
This mirrors a change in i3 4.17 that returns 2 for errors from sway, including invalid command, command failed, and invalid subscription requests
2019-06-07Add the missing constant for the switch input typeFurkan Sahin-0/+1
2019-05-03swaymsg: fix quiet error reportingFurkan Sahin-20/+32
This makes it so swaymsg still returns the correct successful or failed error code when in quiet mode
2019-04-17swaymsg: add timeout and type checksFurkan Sahin-1/+10
This adds a 3 second timeout to the initial reply in swaymsg. This prevents swaymsg from hanging when `swaymsg -t get_{inputs,seats}` is used in i3. The timeout is removed when waiting for a subscribed event or monitoring for subscribed events. This also adds type checks to commands where i3 does not reply with all of the properties that sway does (such as `modes` in `get_outputs`). This is mostly just a behavioral adjustment since swaymsg should run on i3. When running under i3, some command reply's (such as the one for `get_outputs) may have more useful information in the raw json than the pretty printed version.
2019-04-15Send disabled output available modes on IPC get_outputsFurkan Sahin-1/+1
- Also fix missing trailing newline on pretty print Signed-off-by: Ranieri Althoff <1993083+ranisalt@users.noreply.github.com>
2019-03-12Add heuristics to differentiate touchpadsFurkan Sahin-0/+1
Use libinput_device_config_tap_get_finger_count to determine whether a pointer is a touchpad. swaymsg is also updated to reflect the new touchpad type.
2019-02-10Add support for manually setting subpixel hinting on outputs.Furkan Sahin-1/+4
Many laptop screens report unknown subpixel order. Allow users to manually set subpixel hinting to work around this. Addresses https://github.com/swaywm/sway/issues/3163
2019-03-16Flush stdout in swaymsg when in subscribe modeFurkan Sahin-0/+1
2019-03-08Add -p/--pretty option to swaymsgFurkan Sahin-1/+6
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-07ipc: describe libinput device configurationFurkan Sahin-3/+7
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-02-10ipc: handle unnamed xkb_active_layout_nameFurkan Sahin-2/+2
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-01-23Make json-c include respect pkg-config --cflagsFurkan Sahin-1/+1
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-20Replace wlr_log with sway_logFurkan Sahin-2/+2
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-09get_inputs: add libinput send events modeFurkan Sahin-1/+5
Add `libinput_send_events` to the IPC output for `get_inputs` to allow scripting of mode changes.
2018-12-09Remove readline.cFurkan Sahin-1/+0
All occurrences of read_line have been replaced by getline. peek_line has been absorbed into detect_brace.
2018-11-28swaymsg: parse success of single objectFurkan Sahin-0/+3
Allows swaymsg to parse the success attribute of a single object response. This is needed for the subscribe event.
2018-11-28Implement support for swaymsg -t SUBSCRIBE [-m]Furkan Sahin-13/+57
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-25Replace _XOPEN_SOURCE with _POSIX_C_SOURCEFurkan Sahin-1/+1
And make sure we don't define both in the same source file.
2018-11-12IPC: Send keyboard layout info in IPC_GET_INPUTSFurkan Sahin-2/+9
Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
2018-11-03ipc: move refresh from output to output->current_modeFurkan Sahin-11/+9
2018-11-02swaymsg: get_outputs: use output->current_mode for current mode displayFurkan Sahin-3/+8
2018-10-29swaymsg: fix get_outputs status codeFurkan Sahin-1/+1