It's possible for the output to be disconnected in just the right moment
for wlr_output to be NULL in the repaint handler, causing a crash. This
check fixes that crash.
-Wmissing-braces makes it annoying to zero-initialize structs with = {0}
when the first field is a struct. See for instance [1].
[1]: https://builds.sr.ht/~sircmpwn/job/110425
The previous behavior was incorrect because `if` was checking the return
status of the `[` command which was never going to be an error. `[`
seems to only return an error if no args are provided. This was
basically a useless use of `[` anyway since it was just meant as a
straight interpretation of command exit, something that `if` can do
itself.
Compare:
```sh
[ ]; echo ?=$?
[ /bin/false ]; echo ?=$?
if [ /bin/false ]; then echo this is the unintended bug; fi
if /bin/false; then echo this will not be printed; fi
```
Previously, Xwayland windows did not have size_constraints implemented,
resulting in the window being resizable. This implements the constraints
through the X11 size hints supplied by the window itself.
set_cloexec is defined by both sway and wlroots (and who-knows-else),
so rename the sway one for supporting static linkage. We also remove
the duplicate version of this in client/.
Fixes: https://github.com/swaywm/sway/issues/4677
Currently commented lines ending in the backslash character will be
concatenated with the following line.
```
# with this comment \
exec swaynag -m 'will not run'
```
This change modifies `getline_with_cont` to stop reading when the
initial character is a '#'.
Calling wlr_output_manager_v1_set_configuration with an enabled output
and a NULL mode is incorrect if the output doesn't support modes.
When DPMS'ing an output, wlr_output_enable(output, false) is called.
This de-allocates the CRTC and sets wlr_output.current_mode to NULL.
Because we mark DPMS'ed outputs as enabled, we also need to provide a
correct output mode. Add a field to sway_output to hold the current
mode.
Closes: https://github.com/swaywm/wlroots/issues/1867
In case a tray icon cannot be found or does not have a desirable size,
swaybar retries the search again and again, which increases load on disk
and CPU. This commit solves it by storing target_size for each icon, so
that swaybar does not search for an icon of some size if it already tried to.
Fixes#3789.
When applying config, value mode->refresh is mHz; convert it to Hz before
assigning it to the temporary output config. oc->refresh_rate will
be converted back to mHz in set_mode function.
Fix debug log printing GHz instead of Hz.
When changing a surface from managed to unmanaged in handle_map(), the
call to handle_destroy(.., view) causes the sway_xwayland_view pointed
to by the untyped wlr_xwayland_surface.data field to become invalid
garbage, yet the untyped wlr_xwayland_surface.data continues to point
at it. In particular: view_get_*(view_from_wlr_surface(..)), even
with appropriate NULL checking, will crash sway when this codepath is
exercised (reliable test case: drop-down menus in Google Earth).
Usage:
grimshot copy|save win|screen|area [FILE]
Troubleshoot:
grimshot check
Requirements:
- `grim`: screenshot utility for wayland
- `slurp`: to select an area
- `swaymsg`: to read properties of current window
- `wl-copy`: clipboard utility
- `jq`: json uliity to parse swaymsg output
- `notify-send`: to show notifications
Those are needed to be installed, if unsure, run `grimshot check`
Examples:
`grimshot copy win` - to copy current window
`grimshot save area` - to select area and save it to default file (Pictures/Grimshot-$datetime.png)
`grimshot save screen ~/screenshot.png` - to save screenshot under ~/screenshot.png
`grimshot` - usage
`grimshot check` - verify if tools are installed
Don't use the latest tag, always use the project version for the version
string. Because of version branches, getting the version from Git can be
unreliable.
Closes: https://github.com/swaywm/sway/issues/4631