Compare commits

...

808 commits

Author SHA1 Message Date
Simon Ser d417a8fcd0 release.sh: read meson-rewrite output from stdout
Since version 1.6, Meson now uses stdout:
3f4957c713
2024-10-31 10:31:38 +01:00
Kenny Levinsen f38719f575 desktop/output: Add missing output config allocation checks 2024-10-30 19:56:07 -04:00
Kenny Levinsen 1e53007bc3 desktop/output: Store output config on request_state
An output backend might request any change to an output state at any
time, although currently only this is currently only used for changing
window size on the wayland and x11 backend.

Applying the configuration directly means that the current output state
becomes inconsistent with the configured state, which can cause the new
state to be reverted later if apply_stored_output_configs is called.

Before 4f9ce4675c. the output geometry would be updated by
arrange_outputs, but this is only done by the modeset logic now,
resulting in the stored geometry never being updated on wayland backend
window resize. This was not discovered as the stored geometry is not
used particularly often.

Solve both by storing a new output configuration and relying on the
modeset logic to apply a new state.

Fixes: 4f9ce4675c ("tree/arrange: Remove redundant output geometry update")
2024-10-30 19:56:07 -04:00
AsciiWolf e7c972b04a Remove language bars from remaining non-English README files 2024-10-28 14:06:01 +01:00
llyyr 839434abc0 sway/server: bind to presentation-time-v2
Depends on: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4858
2024-10-27 19:20:20 -04:00
Kirill Primak 015e357fce desktop/output: chase wlroots private fields update
This will be replaced with a proper solution later.
2024-10-25 17:42:35 +02:00
Kenny Levinsen a63027245a config/output: Remove remaining logs from queue_output_config
The job of queue_output_config is now just to fill out a
wlr_output_state according to the output configuration, but it still has
a lot of logging from before we had wlr_output_state or the new modeset
logic, when queue_output_state instead touched the implicit pending
state of wlr_output.

Whatever debug logs it had would already be covered by the output state
debug logs or the command debug logs, so let's just remove it.
2024-10-20 12:22:12 +02:00
Kenny Levinsen 17ecb9eb1d config/output: Remove initial values in find_output_config
Starting by setting some special initial output config values settings
was something sway used to do when the config was initially being
processed. This was later changed to always happen, as there shouldn't
be differences in how output config is calculated during config load and
after.

Most of these values are redundant, as they are either the zero value or
a value that would be selected if the unset (-1) value was found.

For output transforms, the automatic panel orientation code would only
trigger if the final output config has an unset transform, which the
initial values set in find_output_config made impossible.

Remove these initial values and instead use a fresh output config as is.
2024-10-20 12:22:12 +02:00
Kenny Levinsen af0d4a048a config/output: Always set all output fields on finalize 2024-10-20 12:22:12 +02:00
Kenny Levinsen 7e0c0dda42 config/output: Always set output states from config
queue_output_config had some remaining logic that would avoid setting
output states if they already appeared to be in effect. That is not what
most of the states did nor what is currently expected, so clean that up.
2024-10-20 12:22:12 +02:00
Kenny Levinsen 7d93652105 config/output: Improve modeset state logging
Include scale and subpixel in the output state log, and log the output
state on first commit attempt instead of just during fallback search.
2024-10-20 12:22:12 +02:00
Simon Ser 35d8adefc4 input/seatop_default: refactor move/resize button logic
Make it so config->floating_mod_inverse only applies when pressing
mod, not when clicking on titlebars.

Centralize logic into shared variables.
2024-10-20 00:26:09 -04:00
Alexander Orzechowski 8363699f14 layer_shell: Restore sway 1.9 ordering 2024-10-18 14:10:28 +02:00
Alexander Orzechowski ce6b2db0f2 layer_shell: Arrange exclusive zone clients first
This makes layer_shell more stable against the order of clients.
2024-10-18 14:10:28 +02:00
Jan Palus db76fefd0c trigger container update after disabling urgent in timer
switching workspace directly to urgent window creates timer which delays
reset of urgent state so user is able to notice it. make sure state
change is reflected visually as well (border change) by triggering
container update

Fixes: #8377
2024-10-16 13:57:32 -04:00
Simon Ser dd063a0ef7 input/keyboard: add support for pointer keys
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4775
2024-10-14 21:27:07 +02:00
Simon Ser 17e2e52c6d server: check backend support for timelines
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4848
2024-10-11 13:26:54 -04:00
Furkan Sahin 7f1cd0b73b
input/mouse: bugfix button2 being interpreted as trying to move the container
Man sway(5) specifies that when tiling_drag is enable, the floating_mod
can be used to drag tiling, as well as floating containers. However the
current code indiscriminately assumes any button press to be intended
for moving the container, consequently causing an unintended call to
`seatop_move_tilting:handle_button` rather than
`seatop_default:handle_button` to pass
`state=WL_POINTER_BUTTON_STATE_RELEASED` to `get_active_mouse_binding`

My idea was to make 'Handle moving a tiling container' follow the same
path as 'Handle moving a floating container' because the initial call to
handle moving a floating correctly exits that branch and ends up passing
the RELEASED state to `get_active_mouse_binding`.

Fixes #8334
2024-10-08 18:09:57 +02:00
ShootingStarDragons f855b0898b fix: sway crashes if switch to another workspace with surface when IME popup is shown
in pr https://github.com/swaywm/sway/pull/8196, when im_popup_surface is unmapped, author set the popup->relative to NULL, butt popup is still in popup groups, where assert the relative is not NULL, this cause the panic

Take the suggestion of Nefsen402, remove the line where set relative to
NULL, and add NULL check in scene_descriptor_destory
2024-10-07 23:07:25 -04:00
Kenny Levinsen c90cb37b2a Re-init renderer for all outputs on lost context
sway_root.outputs only include enabled outputs. We also need to re-init
the renderer for any disabled outputs, so use sway_root.all_outputs
instead.

Resolves the following heap-use-after-free accessing the render formats
when a disabled output is modeset after a GPU reset has occurred.
2024-10-02 21:09:55 -04:00
Alexander Orzechowski 9a9be01ad4 Fix alpha-modifier-v1 2024-09-29 23:01:14 +02:00
Simon Ser a2757e5f16 release: push tags before creating GitHub release
Otherwise the GitHub release isn't attached to the Git tag.
2024-09-29 17:44:47 +02:00
Simon Ser a0b3606f17 Add support for alpha-modifier-v1 2024-09-29 17:19:22 +02:00
Furkan Sahin 00e9a94152 swaybar: Fix 100% cpu usage if dbus dies.
Currently, swaybar does not gracefully die if it detects
that the dbus connection was lost. Although it's not recommended
to restart dbus without restarting the compositor, it can very
easily happen. In the case it does, compositor's tray should
not consume 100% cpu until it has to be force killed.

apply suggestions

just setting the bar to not running will call teardown and unref the
dbus.
2024-09-28 16:23:21 +02:00
Kenny Levinsen 63345977e2 desktop/output: Clear modeset timer on output manager apply
If a modeset timer exists at the time we apply an output manager config,
clear it to avoid a useless double commit.
2024-09-21 17:50:24 -04:00
Kenny Levinsen cdff4f7c74 config: Batch input/output configuration on load
We batch modesets and input configuration performed during config reload
but commit for every command during the intial config load. There is no
need to perform commits during the initial config load as outputs have
not yet been created, but swaybg spawn should still be batched.

At the same time, replace direct calls to apply output configuration
with request_modeset to properly handle the modeset timer.
2024-09-21 17:50:24 -04:00
Kenny Levinsen b73f54a966 desktop/output: Expose request_modeset
We remove the struct sway_server argument for consistency with the rest
of our internal APIs which rely on the global server instance.
2024-09-21 17:50:24 -04:00
Olivia Taliesin b6da218974 Removed destination-is-ancestor check from container_move_to_container to match i3 behaviour 2024-09-21 17:46:20 -04:00
Kenny Levinsen 861dde100a commands/gaps: Check config->reading instead
Checking if the config is not active or is reloading is just a
convoluted way of checking if the config is being read.
2024-09-21 16:16:19 +02:00
Alexander Orzechowski e9dd218231 text_input: Inline input_popup_update into input_popup_set_focus
This seems to be the intention of input_popup_update in the first place:
handle the scenario where the focus moves.
2024-09-20 19:40:18 +02:00
Alexander Orzechowski 74e507962e text_input: Properly handle map/unmap events
The last implementation would ignore these and get it could get into
a bad state where it would start crashing sway.
2024-09-20 19:40:18 +02:00
Alexander Orzechowski 023f6b0a50 transaction: Allow no popup descriptor in popup list
Input method popups in the future will destroy the scene descriptor when
it isn't mapped and therefore shouldn't be tampered with here.
2024-09-20 19:40:18 +02:00
Alexander Orzechowski 1537c9dae5 text_input: Move popup placement to own function 2024-09-20 19:40:18 +02:00
Alexander Orzechowski 48069097ea text_input: Check for allocation failure 2024-09-20 19:40:18 +02:00
Scott Dubinsky 266cd4515a Remove unguarded double include 2024-09-20 17:18:26 +02:00
Emil Engberg e940acd374 Add toggle for output adaptive_sync 2024-09-20 15:38:27 +02:00
Kenny Levinsen 9765c29be1 config/output: Stringify render format when logging it 2024-09-20 14:08:04 +02:00
Kenny Levinsen 034d02f8a5 config/output: Add support for 6-bit render fmt
GUD devices uses RGB565 by default for performance reasons. Allow
specifying render_bit_depth 6 to pick this format. The definition works
out if you consider the maximum number of bits per channel instead of
the average.
2024-09-20 14:08:04 +02:00
Kenny Levinsen 785a459a55 ext-session-lock: Do not use commit listener to arrange
Arranging lock surfaces rely on the sway_output width and height being
updated, but these are only updated after the commit has been completed
and all commit listeners have executed. This means that the lock
surfaces will not be appropriately scaled to match a change in output
dimensions, and may reveal what is under the lock background.

Replace the implicit arrange through the output commit listener with an
explicit arrange after the output configuration is finalized.

This might have regressed by other transition away from output commit
listeners for other arrange tasks, but even then it would have
erroneously relied on signalling order.
2024-09-20 00:26:36 -04:00
Steffen Dirkwinkel f957c7e658 config/output: support DRM_FORMAT_ARGB8888
Some display output hardware [1] doesn't support any of the current
formats, but works with ARGB8888. Fall back to it if available.

[1] 196145c606/drivers/gpu/drm/xlnx/zynqmp_disp.c (L313)

Signed-off-by: Steffen Dirkwinkel <s.dirkwinkel@beckhoff.com>
2024-09-13 13:09:48 +02:00
Kenny Levinsen d7a76d381b config/output: Rename to apply_stored_output_configs 2024-09-10 14:13:36 -04:00
Kenny Levinsen 29b3f00e6f config/output: Accept a list of output_configs to use
Instead of using a single finalized output config per output, accept a
regular list of output configs like the one ultimately stored for
configuration purposes. This allows the output management code to test
an augmented configuration while still using the same output config
logic, without having to mutate the stored configuration.

This in turn allows us to make a few APIs private. A bug note about an
existing issue with derade to off is added as well.
2024-09-10 14:13:36 -04:00
Kenny Levinsen 0496477f92 config/output: Always start with default in find_output_config
We always need to start out with the default configuration, regardless
of whether the config is reloading or not to ensure that config
decisions are stable given a specific configuration.
2024-09-10 14:13:36 -04:00
Kenny Levinsen a0c0349934 config/output: Support multiple matches in find_output_config
Simplify find_output_config and inline the search through the output
configs instead of using list_seq_find with a comparator function. The
new implementation will merge any amount of matched configs in order,
which will be relied upon in a future commit.
2024-09-10 14:13:36 -04:00
Adam Chovanec fb5eadc363 readme: update Czech translation 2024-09-08 16:06:26 +02:00
llyyr c5ba7f23a5 sway/input/keyboard: always set active keyboard if there is none
Previously, we incorrectly only set active keyboard for non-virtual
devices. 4c3c060211 incorrectly put
unrelated code in `sway_keyboard_set_layout`.

Fixes: 4c3c060211
2024-09-08 14:18:01 +02:00
Kenny Levinsen f4a6b0395f tree/arrange; Skip arranging disabled outputs
Disabled outputs might not have a geometry to arrange for, so skip the
arrange to avoid messing up the workspace geometry.
2024-09-07 20:11:30 -04:00
Kenny Levinsen 14bff7b451 desktop/transaction: Deactivate workspace on inactive outputs
If the output is not active, it might not have a valid geometry to
arrange for. Outputs do not gain a geometry until modeset, so if an
output is connected with a configuration present to disable it, it will
not have a geometry. If the output has a past workspace restored, this
will be attemtped arranged to fit a 0x0 rectangle, which asserts when
trying to sort out borders.

Consider the workspace activated only if the output itself is active to
get the scene nodes disabled.
2024-09-07 20:11:30 -04:00
Kenny Levinsen 4f9ce4675c tree/arrange: Remove redundant output geometry update
This is handled by apply_output_configs.
2024-09-07 20:11:30 -04:00
Alexander Orzechowski fc6b8d6af2 container: Skip % char if it doesn't match a view property
The else condition was missed here and we would never skip the % char
if it didn't end up matching with any property. Since we fail to skip
we would re-evaluate the % in an infinite loop never achieving any
forward-progress.

Fixes: https://github.com/swaywm/sway/issues/8333
2024-09-07 01:19:31 +02:00
Kenny Levinsen 4fe054c6db tree/output: Avoid duplicate input mapping configure 2024-09-05 18:19:16 -04:00
Kenny Levinsen cfb292cca7 desktop/output: Avoid duplicate output manager update 2024-09-05 18:19:16 -04:00
Kenny Levinsen af28ac04a4 (desktop|tree)/output: Do not use layout listener to arrange
Output layout changes originate from the centralized modeset
infrastructure and request_state which already takes care of arranging
and updating outputs as needed.
2024-09-04 13:49:35 -04:00
Kenny Levinsen 6045ad9a02 tree/output: Rely on modeset arranging root
output_enable/output_disable are only called from modeset, and from
output destroy which requests modeset. As such, they can rely on the
modeset handling arrange.
2024-09-04 13:49:35 -04:00
Kenny Levinsen b83e5aaa54 desktop/output: Do not use commit listener to arrange
The reasoning for using a commit handler is to ensure that all paths for
output changes are correctly handled. With the centralized modeset
infrastructure in place, we can move the logic there. This allows us to
be smarter and avoid extraneous arranges, output manager updates and
transaction commits.

The side-effect is a minor duplication for the special-case
request_state, but the shared path will be relied upon further in future
commits to justify this duplication.
2024-09-04 13:49:35 -04:00
Norbert Bolanowski be840f730e move title_format to container 2024-09-02 16:49:05 -04:00
Jon Wallace 980a4e0211 use subheadings instead 2024-08-28 10:59:56 +02:00
Jon Wallace f2b2a81149 Use heading markdown to demarcate sections of commands
Its a little tought to notice that the COMMANDS section is actually 3 sections. Use markdown to make this easier to see for the user.
2024-08-28 10:59:56 +02:00
llyyr 77b9ddabe2 sway/tree/container: don't trunc coords in floating_fix_coordinates
This can cause issues such as the window not being shown at the exact
same coordinates when the old and new wlr_box aren't the same
dimensions and the container is being moved back-and-forth between them.

For example, in the case where a floating window gets moved
from one output to another but the outputs aren't the same resolution.
For e.g. have two displays that aren't the same resolution then:

1. Open a floating window and set it to pos 0,0 on output 2
2. Send it to scratchpad then `scratchpad show` on output 1
3. `scratchpad show` on output 2 again

Observe that the window isn't at 0,0 on output 2 anymore.
2024-08-22 23:43:22 +02:00
Anna (navi) Figueiredo Gomes f00f964abf sway/commands/move.c: arrange new workspace
When moving a container to a new workspace, the workspace's dimension
are left unset. Usually this doesn't matter, but when moving a floating
container to a new workspace on a different output, this leads to the
position of the container being calculated with 0, so the container ends
up halfway offscreen on the leftmost topmost monitor.

Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
2024-08-22 23:41:33 +02:00
Alexander Orzechowski 7288f77bbe output: Chase wlroots!4803 2024-08-21 18:16:32 +03:00
Kenny Levinsen f9c0f043e5 config/output: Skip search if config has a mode
When doing an output configuration search, the intent is to only look
for modes if the output's configuration does not contain a specific
mode. This was done by testing if config_has_auto_mode returned false.

config_has_auto_mode had its return values backwards, leading to other
modes being tested if the output configuration had specified modes or
modelines, leading to unwanted modes being selected.

Invert the function to config_has_manual_mode to give it a clearer name,
and fix the return values in the process.
2024-08-19 12:03:48 -04:00
Kenny Levinsen ae7c1b139a config/output: Do not set adaptive_sync if not supported
After 4e38f93f36 ("config/output: Skip VRR tests when not supported"),
the configuration search no longer touches VRR state for outputs that
are known to not support it. This also means that it will not remove VRR
if already set, which could cause output configuration to fail.

Ensure that VRR state is never set for outputs that do not support it by
adding the same test for support to queue_output_config.

Fixes: 4e38f93f36 ("config/output: Skip VRR tests when not supported")
Fixes: https://github.com/swaywm/sway/issues/8296
2024-08-18 15:18:11 +02:00
Kirill Primak c30c451907 xdg-shell: chase xdg_surface geometry updates 2024-08-14 15:04:00 -04:00
Alexander Orzechowski c3279944fb output: Use wlr_scene_set_gamma_control_manager_v1 2024-08-14 20:45:04 +03:00
Alexander Orzechowski 5a3621460f output: Use wlr_scene_output_needs_frame 2024-08-14 20:45:04 +03:00
Felix Pehla 6576b99c24 commands/output/color_profile: allows use of relative path for ICC profile 2024-08-14 11:03:53 +02:00
Simon Ser b44015578a Switch default config to wmenu-run
This removes the last dependency bit on dmenu. No need for
"swaymsg exec" anymore: wmenu-run handles the xdg-activation
shenanigans.
2024-08-11 19:47:39 +02:00
Simon Ser 9ba1beee58 Bind a few utilities to special keys in default config 2024-08-11 16:42:20 +02:00
JingMatrix f344e9d5a5 Add null-safety check for virtual keyboard keymaps
Note that in the `sway_keyboard_configure` function of sway/input/keyboard.c,
we have skipped the `sway_keyboard_set_layout` function for virtual
keyboards, which then have null keymaps.
Hence, a null-safety check is needed at runtime.
2024-08-09 22:03:41 +02:00
Alexander Orzechowski 951a22c244 xwayland: Let scene restack 2024-08-07 23:58:13 +03:00
Kirill Primak 32e5e5232d tearing: fix UAF on destroy
Fixes: 9a1c411abd
2024-08-07 14:33:03 +02:00
Kirill Primak 3e956b9229 tearing: remove trailing whitespace 2024-08-07 14:33:03 +02:00
Simon Ser 05e895c463 Add support for linux-drm-syncobj-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4262
2024-08-06 20:18:59 +02:00
Ricardo Steijn 9a1c411abd
Add support for tearing-control-v1
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-08-05 02:13:49 +02:00
Alexander Orzechowski b881c2e84c transaction: Reparent all container children when disabling for scratchpad
Fixes: #8205
2024-08-04 18:08:28 +02:00
James Knight 6e4ccb99c3 build: avoid git repository discovery when determining version
When attempting to use Git to populate commit/branch information in a
version string, it is possible through repository discovery that it
uses Git information not relevant to project. For example, if
repository content is extract into an interim build location when using
an embedded build framework (e.g. Buildroot), the project will not have
its Git repository to refer to. When it cannot find its repository, it
will look into its parent folders and may find the Git repository of
another project and use its branch/commit information.

This commit provides an explicit path to the project's Git repository
when consider commit/branch information. This will prevent any
repository discovery from occurring.

Signed-off-by: James Knight <james.d.knight@live.com>
2024-08-03 18:35:55 +02:00
Kirill Primak 9bb45a4037 xwayland: chase wlr_xwayland_surface_set_maximized() change
See
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4670.
2024-08-02 16:57:01 +02:00
Simon Ser 7e74a49142 desktop/xwayland: don't restack when marking window as inactive
daaec72ac0 ("desktop/xwayland: restack surface upon activation")
has updated Sway for wlroots commit bfc69decdd04 ("xwm: do not
restack surfaces on activation"). However, it unconditionally
restacks the window above all other windows even if marking the
window as inactive.

Closes: https://github.com/swaywm/sway/issues/7974
2024-07-29 14:19:42 -04:00
Joan Bruguera Micó 4d4c88f0a7 layer-shell: Restore interactive layer focus code
Commit 188811f808 ("scene_graph: Port layer_shell") accidentally
removed code in `arrange_layers` to handle focus on layer shell
surfaces with keyboard interactivity.

Due to this, layer shell surfaces requesting exclusive keyboard
interactivity may not get automatically focused, and layer shell
surfaces giving up exclusive keyboard interactivity can remain focused.

Add the previous code back to fix the problem.

Note the non-rename change included in b4d7e84d38 ("desktop: Rename
layers to shell_layers") is not included as it also seems accidental.

Fixes: #7936
2024-07-22 17:03:26 -04:00
Kenny Levinsen 3f327b3db0 desktop/output: Stop repaint loop when not needed
1e0031781f refactored repaint to accumulate all changes in a single
wlr_output_state and commit them at the end of the repaint loop,
replacing a call to wlr_scene_output_commit. wlr_scene_output_commit
contains an early bail-out when no frame has been requested and no
damage has accumulated, which was not replicated as part of this
refactor, causing the repaint loop to never pause.

Replicate the logic to stop the repaint loop as needed.

Fixes: 1e0031781f ("desktop/output: unify page-flip codepath")
2024-07-14 18:24:13 -04:00
Simon Ser a3a9ec1211 build: use fs.relative_to() instead of hand-rolled logic
Meson has introduced a relative_to() function [1] in its fs module
since version 1.3.

[1]: https://mesonbuild.com/Fs-module.html#relative_to
2024-07-14 18:03:43 -04:00
Bill Li 50073dc579 ci: use package x11-servers/xwayland instead of x11-servers/xwayland-devel 2024-07-14 23:19:19 +02:00
Bill Li fc2796aee8 Chase wlroots!2434
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/2434
2024-07-14 23:19:19 +02:00
Bill Li 274a5fcb73 build: Bump wlroots version 2024-07-13 13:03:23 +02:00
Kenny Levinsen 8c5b23e592 common/pango: Disable glyph position rounding
Pango rounds glyph position and widths to nearest integer, which leads
to font dimensions jumping around when rendering with a scale, causing
text geometry to jump around when changing scale. This is disturbing
when text buffers change scale, and also mean that the text geometry
calculations in sway_text_node are incorrect.

Disable this rounding to make the geometry stable.
2024-07-10 18:49:42 -04:00
Ronan Pigott 28fd73589d xdg-activation: launcher tokens are activation requests
If the launched client decides to pass it's token along as an activation
request, allow that. This will make the behavior match tokens provided by
an external launcher client.
2024-07-06 16:12:27 +02:00
Tarcísio Eduardo Moreira Crocomo 3d00552035 build: bump libinput version required 2024-07-04 23:03:38 +02:00
Tarcísio Eduardo Moreira Crocomo 5be5a50051 Implement clickfinger_button_map support. 2024-07-04 22:47:46 +02:00
Simon Ser 818ea17389 sway_text_node: avoid unnecessary redraws
When a floating container has a titlebar, render_backing_buffer()
ends up being called each time the container is moved. Add some
more checks for no-op changes in sway_text_node_set_max_width()
and sway_text_node_set_background(). This makes the move smoother.
2024-07-03 18:30:08 -04:00
Simon Ser d8c4a2d5fe tree/container: drop decl for container_update_textures_recursive()
This function doesn't exist anymore.
2024-07-03 17:50:32 -04:00
llyyr fdcfe00781 xdg_shell: don't send configure events to uninitialized surfaces
the surface isn't initialized yet when we first handle it in
`handle_xdg_shell_toplevel`, move setting WM capabilities to
handle_commit instead.

Fixes warnings from wlroots about a configure being scheduled for
uninitialized surface
2024-07-03 23:38:38 +02:00
novenary 5233a0bd2e ipc: properly check for titlebars
This fixes incorrect values for rect.y when using
`hide_edge_borders --i3`.
2024-07-03 11:00:30 -04:00
novenary a0a078f75e transaction: fix missing top border with hide_lone_tab
Regressed by scene graph.
2024-07-03 10:10:30 -04:00
Kenny Levinsen b04f4136bc desktop/output: Debounce modesets
Output changes often happen in rapid succession. Instead of doing the
modesets one by one, set a 10 millisecond debounce timer.
2024-07-03 10:06:22 -04:00
llyyr e32bdaa7be input/keyboard: don't set layout for virtual keyboard device
This prevents us from recompiling keymap every time a virtual device is
created by clients like fcitx5
2024-07-03 08:41:46 +02:00
llyyr 4c3c060211 input/keyboard: refactor into sway_keyboard_set_layout 2024-07-03 08:41:46 +02:00
llyyr 0386b2afcb input/seat: don't send redundant leave/enter on device creation
Fixes: #8143 #8173
Upstream issue: https://github.com/fcitx/fcitx5/issues/1044
2024-07-03 08:41:46 +02:00
llyyr dfbcd1fbaa input/keyboard: don't send key release if we don't have focused surface
"The compositor must not send this event if the wl_keyboard did not
have an active surface immediately before this event. The compositor
must not send this event if state is pressed (resp. released) and the
key was already logically down (resp. was not logically down)
immediately before this event."

From https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/382
2024-07-02 15:13:29 -04:00
Kenny Levinsen 4e38f93f36 config/output: Skip VRR tests when not supported
Adaptive sync is a "soft" setting which we degrade of off when not
supported. Some outputs types do not support turning it off (Wayland,
X11), which makes for an awkward three-way test where we first enable,
disable and finally unset the setting.

wlr_output.adaptive_sync_supported tells us whether the output
definitely does not support making changes (backend without support,
connector without the feature), or whether it might work.

Use this to avoid wasting time on adaptive sync test that can never
succeed, and to avoid the Wayland/X11-backend specific unset step.
2024-07-02 19:13:58 +02:00
Simon Ser 1e0031781f desktop/output: unify page-flip codepath
Instead of having a special codepath for applying gamma LUTs, have
a single codepath for regular page-flips and gamma LUT updates.
Should make it easier to add more logic on top e.g. for tearing
page-flips.
2024-07-01 09:21:53 +02:00
Ronan Pigott 5d237679f5 view: send scale notification when the output is known 2024-06-29 14:53:00 +02:00
Kirill Primak cdde0165da protocols: use tablet-v2 xml from stable/ 2024-06-27 20:11:48 +02:00
bretello 8f6bc5bb36 prevent workspace_find_container from crashing with NULL workspaces 2024-06-27 10:19:53 -04:00
bretello 74cc02d60f fix crash when setting urgency on an hidden scratchpad container 2024-06-27 10:19:53 -04:00
Simon Ser fce8de0f67 tree/view: ensure content_{width,height} is positive
The size computations may result in a zero or negative size, which
are not valid wl_surface sizes.
2024-06-25 09:32:46 -04:00
Simon Ser 5f15c5e91d tree/view: set default min size to 1×1
It's not possible to have a surface with a smaller size.
2024-06-25 09:32:46 -04:00
Simon Ser cc34210769 Set color transform when calling wlr_scene_output_build_state()
We were only passing the color transform when calling
wlr_scene_output_commit(). However when modesetting or pushing a
new gamma LUT we render via wlr_scene_output_build_state(). Pass
the color transform there as well.
2024-06-10 16:32:31 +02:00
Manuel Stoeckl 40ca4150b2 sway/commands/output: Add command to set color profile
This makes it possible to render output buffers in a different color
space, by specifying an ICC profile for the output.
2024-06-07 19:01:49 +02:00
Violet Purcell 2e9139df66 Update for versioned wlroots files
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4614
2024-05-28 20:21:07 +02:00
Simon Ser d0bd591ee7 Drop server.h include from input/input-manager.h
The only reason it's included there is for a declaration of
struct sway_server, but we can just forward-declare it.

This avoids rebuilding almost all of Sway when touching server.h.
All other server.h includes are from source files, not headers.
2024-05-27 09:28:43 -04:00
Simon Ser df69367d92 input/text_input: ensure keyboard is set before sending modifiers
Clients get confused when modifier events are sent before the
keymap.
2024-05-27 09:27:45 -04:00
Simon Ser 700f4805bc server: hide xdg_output from unprivileged clients
Regular Wayland clients shouldn't care about the position or size
of outputs. Hide xdg_output from unprivileged clients to make sure
they're not doing shenanigans with this information.
2024-05-27 09:27:20 -04:00
thal a168b20299 tree/view: Do not clip to geometry if using CSD
If a floating window is using CSD, the geometry should not be used to
define the clipping region. Otherwise drop shadows and such may be
clipped excessively.
2024-05-24 00:18:44 +02:00
Simon Ser 9704152414 build: drop xwayland option
Instead of having a build-time option to enable/disable xwayland
support, just use the wlroots build config: enable xwayland in
Sway if it was enabled when building wlroots. I don't see any
use-case for disabling xwayland in Sway when enabled in wlroots:
Sway doesn't pull in any additional dependency (just pulls in
dependencies that wlroots already needs). We have a config command
to disable xwayland at runtime anyways.

This makes it so xwayland behaves the same way as other features
such as libinput backend and session support. This also reduces
the build matrix (less combinations of build options).

I think we originally introduced the xwayland option when we didn't
have a good way to figure out the wlroots build config from the
Sway build system.
2024-05-21 11:44:39 -04:00
Anna (navi) Figueiredo Gomes fd3b643d15 sway/config/output.c: fix null deref on output config
If there's no config for the output, oc is null, but some screens might
have a default rotation, causing the log call to dereference a null
pointer.

Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
2024-05-18 16:25:42 +02:00
Simon Ser 796898519b build: disable wayland-protocols subproject tests by default 2024-05-18 13:48:17 +02:00
Manuel Stoeckl dcdb72757a desktop/layer_shell: provide fractional scale on creation
Also, send a matching wl_surface.preferred_buffer_scale event.
2024-05-07 16:18:43 +02:00
Simon Ser 30f5c3a911 tree/container: ensure pixman rect is valid in container_arrange_title_bar()
Fixes "Invalid rectangle passed" errors printed by Pixman.
2024-05-07 16:15:13 +02:00
Alexander Orzechowski b463957021 sway_text_node: Allow 0 text width
special case negative numbers instead.
2024-05-07 16:14:58 +02:00
Kenny Levinsen 2686afb95c config/output: Print output state during tests
Instead of having each search function print its various test decisions,
print the full state at the end of every search. This makes it much
clearer what state a particular test includes.
2024-05-02 16:16:42 +02:00
Kenny Levinsen 4c28916d68 config/output: Search for output config fallbacks
The original sway output config implementation enabled one output at a
time, testing modes, render formats and VRR support as it went along.
While this sort of fallback is easy to do, it has the downside of not
considering the effect of neighbor outputs on the configuration
viability.

With backend-wide commits, we can now better consider the effect of
neighbor outputs, but to handle the fact that we commit all outputs at
once we need to perform a more elaborate search of viable
configurations.

Implement a recursive configuration search for when the primary
configuration failed to apply.
2024-05-02 16:16:42 +02:00
Kenny Levinsen ee5c4f38c9 config/output: Use all outputs for config merge
When storing a config, we need to find the output that is being
configured to extract its identifier. output_by_name_or_id does not
return outputs that are disabled, and using this makes it impossible to
merge configurations related to disabled outputs.

Switch to all_outputs_by_name_or_id.

Fixes: https://github.com/swaywm/sway/issues/8141
2024-05-02 08:44:04 -04:00
Kenny Levinsen 646019cad9 desktop/output: Fix check if config should be stored
We want to check if a config_head existed for the current
matched_output_config, so we should check cfg->output. sway_output is a
temporary variable from a previous wl_list_for_each, and does not
contain anything useful to us.

Fixes: https://github.com/swaywm/sway/issues/8128
2024-04-23 13:31:30 +02:00
Kenny Levinsen ffcde7a70c server: Use wlr_renderer_get_texture_formats
wlr_renderer_get_{dmabuf|shm}_texture_formats have been replaced by a
unified wlr_renderer_get_texture_formats interface using buffer caps.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4644
2024-04-21 17:19:33 +02:00
Simon Ser 087226d997 config/output: drop fast path in store_output_config()
If there is no output currently connected, we still want to merge
to any existing config.

It shouldn't matter to iterate over the list of outputs to do
nothing anwyays.
2024-04-13 00:55:28 +02:00
Simon Ser f11c5d562e config/output: fix NULL derefs in store_output_config()
../sway/config/output.c:33:21: runtime error: member access within null pointer of type 'struct sway_output'
    AddressSanitizer:DEADLYSIGNAL
    =================================================================
    ==7856==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000080 (pc 0x63da8558205c bp 0x7ffdc35881a0 sp 0x7ffdc3588160 T0)
    ==7856==The signal is caused by a READ memory access.
    ==7856==Hint: address points to the zero page.
        #0 0x63da8558205c in output_get_identifier ../sway/config/output.c:33
        #1 0x63da855865c3 in store_output_config ../sway/config/output.c:220
        #2 0x63da855d4066 in cmd_output ../sway/commands/output.c:106
        #3 0x63da8547f2e3 in config_command ../sway/commands.c:425
        #4 0x63da8548f3fc in read_config ../sway/config.c:822
        #5 0x63da8548a224 in load_config ../sway/config.c:435
        #6 0x63da8548b065 in load_main_config ../sway/config.c:507
        #7 0x63da854bee8d in main ../sway/main.c:351
        #8 0x77e2ea643ccf  (/usr/lib/libc.so.6+0x25ccf) (BuildId: c0caa0b7709d3369ee575fcd7d7d0b0fc48733af)
        #9 0x77e2ea643d89 in __libc_start_main (/usr/lib/libc.so.6+0x25d89) (BuildId: c0caa0b7709d3369ee575fcd7d7d0b0fc48733af)
        #10 0x63da8547ad64 in _start (/home/simon/src/sway/build/sway/sway+0x372d64) (BuildId: 3fa2e8838c1c32713b40aec6b1e84bbe4db5bde8)

Fixes: 1267e47de9 ("config/output: Refactor handling of tiered configs")
2024-04-13 00:55:28 +02:00
Kenny Levinsen 1267e47de9 config/output: Refactor handling of tiered configs
Output configuration can be applied to a particular output in three
ways: As a wildcard, by connector name and by identifier. This in turn
means that three different configurations must be handled at any given
time.

In the current model, this is managed by merging new configuration into
every other matching configuration. At the same time, an additional
synthetic configuration is made which matchehes both identifier and name
at the same time, further complicating logic.

Instead, manage and store each configuration independently and merge
them in order when retrieving configuration for an output. When changes
are made to a less specific configuration, clear these fields from more
specific configurations to allow the change to take effect regardless of
precedence.

Fixes: https://github.com/swaywm/sway/issues/8048
2024-04-12 17:32:26 +02:00
Ferdinand Bachmann bc258a3be2
input: add Super as alternative for Mod4
This PR implements alternative human-readable names for the logo key
(Mod4) as proposed in #8084.
2024-04-05 16:40:28 +02:00
Daniel Kahn Gillmor dcb142bf5e sway-ipc(7): Escape backslashes correctly in GET_CONFIG output
Without this change, i see the following in the sway-ipc manpage:

```

   9. GET_CONFIG
       MESSAGE
       Retrieve the contents of the config that was last loaded

       REPLY
       An object with a single string property containing the contents of  the
       config

       Example Reply:
           {
                "config": "set $mod Mod4nbindsym $mod+q exitn"
           }
```
2024-03-30 01:16:22 +01:00
Simon Ser 9e14651077 input: pass wlr_seat_client to wlr_seat_touch_notify_cancel()
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4613
2024-03-28 11:49:20 +01:00
Kenny Levinsen a4ef37752f commands/output/toggle: Use free_output_config 2024-03-28 10:45:20 +01:00
Kenny Levinsen 26a9a6b479 output/config: Remove unused test_output_config 2024-03-28 10:45:20 +01:00
Kenny Levinsen c3fca26d30 config/output: Make merge_output_config static 2024-03-28 10:45:20 +01:00
Kenny Levinsen 9becff0ba5 output/config: Remove reset_outputs and co.
apply_output_config_to_outputs uses the specified output config to check
which outputs to apply to, and to use as backup when no config is found.
If any config matches the output, the specified config will be
disregarded.

The only remaining user of apply_output_config_to_outputs is
reset_outputs, which called apply_output_config_to_outputs with either
the first stored wildcard config, or a new empty wildcard config.

Providing a stored or empty wildcard config is practically the same as
calling `apply_all_output_configs`. Replace uses of `reset_outputs` with
`apply_all_output_configs` and remove the now unused functions.
2024-03-28 10:45:20 +01:00
Kenny Levinsen 56e97b7d60 config/output: Remove apply_output_config 2024-03-28 10:45:20 +01:00
Kenny Levinsen 3b419020a3 desktop/output: Use apply_output_configs for output mgmt 2024-03-28 10:45:20 +01:00
Kenny Levinsen 98be797356 Use apply_all_output_configs to light up outputs
This allows us to test and if necessary degrade the entire backend
configuration to light everything up.
2024-03-28 10:45:20 +01:00
Kenny Levinsen 923f642b70 output/config: Add apply_all_output_configs
Apply all output configs as they are. This differs from
apply_output_config_to_outputs, which tries to apply a specific output
config.
2024-03-28 10:45:20 +01:00
Kenny Levinsen 3e03eb3a01 config/output: Introduce apply_output_configs
Introduce apply_output_configs, which applies the specified matched
output configs as a single backend commit.

Reimplement apply_output_config_to_outputs using apply_output_configs.
2024-03-28 10:45:20 +01:00
Kenny Levinsen e2f3ebad8c config/output: Split apply_output_config
Applying an output config has two stages: Atomic application of
wlr_output_state, and applicaiton of non-atomic state like output
layout.

Split the latter out into finalize_output_config for use in a later
commit.
2024-03-28 10:45:20 +01:00
Ferdinand Bachmann 125c74338a man: document supported modifier names 2024-03-28 10:26:34 +01:00
Andri Yngvason 5a7477cb8f Implement transient seat management 2024-03-18 09:07:21 +01:00
Simon Ser dc9f217307 man: document that the scale might be adjusted
fractional-scale only supports representing fractions of 120.

References: https://github.com/swaywm/sway/issues/8057
2024-03-14 23:22:32 +01:00
Simon Ser 9139da6149 man: drop fractional scale warning
With the fractional-scale protocol, clients can render without
being downscaled.
2024-03-14 23:22:32 +01:00
Simon Ser 3bc75221bc Re-create renderer when lost 2024-03-14 22:55:46 +01:00
Simon Ser 2b08e79061 server: fix wlr_seat use-after-free on exit
Same as [1].

I originally tried to properly handle seat destruction, but that
turned out to be a can of worms [2].

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4590
[2]: https://github.com/swaywm/sway/pull/8034
2024-03-14 11:59:25 +01:00
Alexander Orzechowski 2e951163c5 Force bilinear scaling when scaling down 2024-03-09 11:47:42 +01:00
Simon Ser 23389ebd1f config/output: drop enabling flag
This was useful when wlroots backends were updating the current
mode on their own. This is no longer the case.
2024-03-08 09:12:12 -05:00
Simon Ser 3ef5abd405 xdg-shell: send WM capabilities 2024-03-08 09:52:14 +03:00
Simon Ser 4e6d7612ff xdg-shell: implement popup repositioning 2024-03-08 09:52:14 +03:00
Simon Ser f2a0e81b24 Fetch input device vendor/product from libinput
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4582
2024-03-07 09:53:40 -05:00
Simon Ser 59f6292383 config: add fallback without env vars for keysym translation XKB keymap 2024-03-06 11:14:50 -05:00
Simon Ser fd9ab9ee06 config: error out on keysym translation XKB state failure
If we can't create the XKB keymap used for keysym translation,
gracefully error out instead of crashing. This can happen if the
XKB_DEFAULT_LAYOUT is set to an invalid value, for instance.

Closes: https://github.com/swaywm/sway/issues/7789
2024-03-06 11:14:50 -05:00
Ronan Pigott 5e18ed3cf0 commands/move: do not force focus on the moved container
My code archaeology isn't good enough to determine what this is here
for, but it isn't correct. We should be able to move containers in a
direction without focusing them. AFAICT i3 doesn't do this, so we
shouldn't either.

This fixes ipc commands like move <dir> with criteria that apply to
containers which are not the current focus.
2024-03-01 10:13:41 +01:00
Luofan Chen 2058209a13 input: Rename WLR_INPUT_DEVICE_TABLET_TOOL to WLR_INPUT_DEVICE_TABLET
wlroots has changed the naming, causing the following build errors when
building:

error: ‘WLR_INPUT_DEVICE_TABLET_TOOL’ undeclared
2024-03-01 09:53:43 +01:00
llyyr 0b84d82b9a ipc: add scratchpad_state property to GET_TREE
See previous commit. This restores ipc parity with i3.
2024-02-29 00:51:43 +01:00
llyyr 2867ef646b ipc: add floating property to GET_TREE
i3 has had this property for over a decade but it wasn't documented
until a couple of years ago, so it was likely missed when developing
sway. Add the property to get us closer to ipc parity with i3.
2024-02-29 00:51:43 +01:00
Simon Ser fca8474e9b Convert to new pointer enums
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4575
2024-02-28 14:28:11 -05:00
llyyr 469411d484 text_input: don't destroy scene_node twice 2024-02-28 09:34:25 +01:00
Simon Ser 829c75b9c9 Add release script 2024-02-26 09:02:06 -05:00
Simon Ser fc640d5f6c Define _POSIX_C_SOURCE globally
See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
2024-02-23 17:43:19 +03:00
Simon Ser 07b0598526 input/text_input: fix dangling listeners 2024-02-23 14:05:52 +01:00
llyyr d6150b6bb0 input/text_input: parent wlr_box may be uninitialized 2024-02-20 16:19:40 +01:00
Access 7c11c463a3
text_input: Implement input-method popups
Co-authored-by: tadeokondrak <me@tadeo.ca>
2024-02-20 10:53:20 +01:00
Aleksei Bavshin d19810eba8 xdg-activation: distinguish activation and urgency requests
Check if the app that requested a token has provided a valid input
serial and a focused surface. Downgrade activation request to urgency
otherwise.

This is mostly in line with what other Wayland compositors decided to
do, and offers a better security than the original logic.
2024-02-17 00:54:30 -07:00
Ronan Pigott f6d22f8e68 launcher: track the seat in the launcher ctx
This is a more suitable place to track the requesting seat, since we are
able to respond appropriately to destroy notifications.
2024-02-17 00:54:30 -07:00
Simon Ser 541e6e260c Drop unnecessary includes from sway/server.h 2024-02-15 15:56:36 +01:00
Simon Ser ca40663d42 Fix build with wlroots DRM backend disabled
The header is not installed by wlroots when the DRM backend is
disabled. We don't need it here, so don't include it.

Closes: https://github.com/swaywm/sway/issues/7943
2024-02-15 09:44:12 -05:00
Kirill Primak 7a2ff7ba81 view: drop ext_foreign_destroy
It's not used and causes a crash when a view is destroyed.
2024-02-12 19:05:13 +01:00
Alexander Orzechowski 09c360d503 layer_shell: Handle popups through popup descriptor
We tried to synchronize layer shell popups with the parent layer shell
on commits, but this is subtly wrong because we would only update
the position for one layer shell that was committed, but not any other
layer that might be affected. By moving handling to the scene descriptor
we can iterate all popups and ensure they are synchronized.
2024-02-12 19:19:22 +03:00
Alexander Orzechowski 1846944f04 xdg_shell: Extract struct for popup descriptor 2024-02-12 19:19:22 +03:00
Alexander Orzechowski 1dc661af17 layer_shell: Arrange popups even if exclusive zone doesn't change 2024-02-12 19:19:22 +03:00
Merlin Lex 1b5515400d ext-foreign-toplevel-list: Implement protocol
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4543
2024-02-12 15:36:44 +01:00
Simon Ser 88b2abf5f2 config: use format_str() instead of hand-rolled snprintf() 2024-02-08 16:11:24 -05:00
Simon Ser 93d391651c commands: make primary_selection a config-only command
It's not possible to switch this at runtime.
2024-02-05 20:54:48 +01:00
Simon Ser f7a0f06dff commands: note how xwayland/primary_selection are reset on reload 2024-02-05 11:07:33 +01:00
Simon Ser ecfef1348a commands/primary_selection: drop duplicate bool parsing 2024-02-05 11:06:24 +01:00
Violet Purcell 6b2aa83246 sway/config.c: only reset primary_selection at launch
Otherwise, an error will be shown whenever reloading due to the value of
primary_selection being reset to true.
2024-02-05 11:04:36 +01:00
Simon Ser 88e99fa84f Drop old security config remnants 2024-02-03 23:00:52 +01:00
Alexander Orzechowski ba427a469a Ensure get_text_width() returns a positive value
Closes: https://github.com/swaywm/sway/issues/7940
2024-02-02 00:54:26 +01:00
Tamino Bauknecht c8676fad54 sway/output: Improve logging of swaybg execvp failure and more checks
This doesn't catch the error if a background changing command is
executed via swaymsg, but improves logging.
The additional checks at least propagate if e.g. forking failed.
2024-01-29 14:12:39 +01:00
Simon Ser e39b0b816b build: bump version to 1.10-dev 2024-01-26 15:25:14 +01:00
Kirill Primak f202bc84d2 Chase wlroots!4443 2024-01-25 16:13:33 +01:00
Kirill Primak a4e85332a1 Chase wlroots!4003 2024-01-23 10:45:58 +01:00
Alexander Orzechowski e8c421e917 layer_shell: Fix typo of return instead of continue
Otherwise we would skip arranging the rest of the surfaces if one of them
isn't initialized.
2024-01-21 22:01:35 +01:00
Daniel De Graaf 2c2625acd3 Fix SIGSEGV on output destroy
```
Program terminated with signal SIGSEGV, Segmentation fault.
144                             struct wlr_layer_surface_v1 *layer_surface = surface->layer_surface;
[Current thread is 1 (Thread 0x7f1f7c5b3ac0 (LWP 2473))]
(gdb) bt
```

Add a NULL check in `find_mapped_layer_by_client` like the one in `arrange_surface`.
2024-01-21 17:32:00 +03:00
Simon Ser 08a06a7b6b Add debug flag to re-enable wl_drm
7e69a7076f ("Drop wl_drm") has dropped wl_drm, however a lot of
software wasn't quite ready for this (Xwayland, libva, amdvlk).
Keep wl_drm disabled by default to pressure the wl_drm phase-out,
but add a -Dlegacy-wl-drm flag for users to restore the previous
behavior in the meantime.

References: https://github.com/swaywm/sway/issues/7897
2024-01-20 14:42:58 -05:00
Simon Ser ae33f4eb37 Clarify gdk-pixbuf dependency purpose
swaybg is out-of-tree so not relevant here. swaybar's tray doesn't
actually depend on gdk-pixbuf, but gdk-pixbuf enables more image
formats for swaybar tray when available.

Closes: https://github.com/swaywm/sway/issues/7913
2024-01-19 12:22:55 +01:00
Alexander Orzechowski 5fc85c5066 scene_graph: port wlr_forgein_toplevel_management output enter/leave events 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 7c635b61fe remove damage debug options
Now that we use wlr_scene, wlroots handles these. If available use
the wlroots debug options instead.
2024-01-18 18:36:54 +03:00
Alexander Orzechowski bab6b79af2 Fix SIGSEGV on surface destroy
```
Program terminated with signal SIGSEGV, Segmentation fault.

warning: Section `.reg-xstate/3960717' in core file too small.
0  container_get_siblings (container=0x55bcde4797f0) at ../sway/tree/container.c:1228
1228		if (list_find(container->pending.workspace->tiling, container) != -1) {
[Current thread is 1 (Thread 0x7fa23b4a2940 (LWP 3960717))]
(gdb) bt full=
No symbol "full" in current context.
(gdb) bt full
0  container_get_siblings (container=0x55bcde4797f0) at ../sway/tree/container.c:1228
1  0x000055bcdb62c704 in edge_is_external (cont=0x55bcde4797f0, edge=(WLR_EDGE_TOP | WLR_EDGE_LEFT))
    at ../sway/input/seatop_default.c:54
        siblings = 0x55bcde4797f0
        index = 32766
        layout = L_NONE
        __PRETTY_FUNCTION__ = "edge_is_external"
2  0x000055bcdb62c96f in find_resize_edge (cont=0x55bcde4797f0, surface=0x0, cursor=0x55bcddd5c2e0)
    at ../sway/input/seatop_default.c:106
        edge = (WLR_EDGE_TOP | WLR_EDGE_LEFT)
3  0x000055bcdb620b3c in cursor_update_image (cursor=0x55bcddd5c2e0, node=0x55bcde4797f0) at ../sway/input/cursor.c:144
        edge = WLR_EDGE_NONE
4  0x000055bcdb62eb8f in handle_rebase (seat=0x55bcddd5a740, time_msec=488992944) at ../sway/input/seatop_default.c:773
        e = 0x55bcddd5c8e0
        cursor = 0x55bcddd5c2e0
        surface = 0x0
        sx = 0
        sy = 0
5  0x000055bcdb62c531 in seatop_rebase (seat=0x55bcddd5a740, time_msec=488992944) at ../sway/input/seat.c:1585
6  0x000055bcdb620a7d in cursor_rebase (cursor=0x55bcddd5c2e0) at ../sway/input/cursor.c:126
        time_msec = 488992944
7  0x000055bcdb620ac4 in cursor_rebase_all () at ../sway/input/cursor.c:136
        seat = 0x55bcddd5a740
8  0x000055bcdb61cc95 in transaction_apply (transaction=0x55bcde5b28c0) at ../sway/desktop/transaction.c:704
9  0x000055bcdb61ccdb in transaction_progress () at ../sway/desktop/transaction.c:716
10 0x000055bcdb61d1f9 in transaction_commit_pending () at ../sway/desktop/transaction.c:836
        transaction = 0x55bcde5b28c0
11 0x000055bcdb61d596 in _transaction_commit_dirty (server_request=true) at ../sway/desktop/transaction.c:912
12 0x000055bcdb61d5ac in transaction_commit_dirty () at ../sway/desktop/transaction.c:916
13 0x000055bcdb65f579 in view_unmap (view=0x55bcde2ff180) at ../sway/tree/view.c:847
        parent = 0x55bcde489010
        ws = 0x55bcdde19080
        seat = 0x55bcddd5a198
14 0x000055bcdb61e461 in handle_unmap (listener=0x55bcde2ff368, data=0x0) at ../sway/desktop/xdg_shell.c:394
        xdg_shell_view = 0x55bcde2ff180
        view = 0x55bcde2ff180
        __PRETTY_FUNCTION__ = "handle_unmap"
15 0x00007fa23c4ae87f in wlr_signal_emit_safe (signal=0x55bcde46cf38, data=0x0) at ../util/signal.c:29
        pos = 0x55bcde2ff368
        l = 0x55bcde2ff368
        cursor = {link = {prev = 0x55bcde2ff368, next = 0x7ffe240702a0}, notify = 0x7fa23c4ae7c9 <handle_noop>}
        end = {link = {prev = 0x7ffe24070280, next = 0x55bcde46cf38}, notify = 0x7fa23c4ae7c9 <handle_noop>}
16 0x00007fa23c47c3c7 in unmap_xdg_surface (surface=0x55bcde46ce30) at ../types/xdg_shell/wlr_xdg_surface.c:40
        __PRETTY_FUNCTION__ = "unmap_xdg_surface"
        popup = 0x55bcde46ce60
        popup_tmp = 0x55bcde46ce60
        configure = 0x7ffe24070360
        tmp = 0x55bcde488020
17 0x00007fa23c47cd47 in xdg_surface_role_precommit (wlr_surface=0x55bcde488020, state=0x55bcde4881a8)
    at ../types/xdg_shell/wlr_xdg_surface.c:330
        surface = 0x55bcde46ce30
18 0x00007fa23c4813b2 in surface_commit_state (surface=0x55bcde488020, next=0x55bcde4881a8) at ../types/wlr_compositor.c:407
        __PRETTY_FUNCTION__ = "surface_commit_state"
        invalid_buffer = false
        subsurface = 0xbd8e9aecae023300
--Type <RET> for more, q to quit, c to continue without paging--
19 0x00007fa23c48192a in surface_handle_commit (client=0x55bcde488850, resource=0x55bcde2fdb80) at ../types/wlr_compositor.c:523
        surface = 0x55bcde488020
20 0x00007fa23bb5ed4a in  () at /usr/lib/libffi.so.8
21 0x00007fa23bb5e267 in  () at /usr/lib/libffi.so.8
22 0x00007fa23c517323 in  () at /usr/lib/libwayland-server.so.0
23 0x00007fa23c5125cc in  () at /usr/lib/libwayland-server.so.0
24 0x00007fa23c5151ca in wl_event_loop_dispatch () at /usr/lib/libwayland-server.so.0
25 0x00007fa23c512d37 in wl_display_run () at /usr/lib/libwayland-server.so.0
26 0x000055bcdb616885 in server_run (server=0x55bcdb68c5c0 <server>) at ../sway/server.c:307
27 0x000055bcdb61594e in main (argc=3, argv=0x7ffe24070af8) at ../sway/main.c:433
```

It seems to be happening because of this set of events all happening
in the span of a single transaction:
1. You kill a tiled window that is the only window in a workplace.
2. Sway will destroy the workspace but not yet the container - this
   makes `con->pending.workspace` NULL.
3. Cursor glyphs get recomputed causing sway to recompute if the cursor
   is on a container edge. 
4. That computation causes an access to the NULL workspace. Crash.
2024-01-18 18:36:54 +03:00
Alexander Orzechowski 9da295c11f scene_graph: Implement toplevel clipping 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 09e11dabb2 scene_graph: Port opacity and filter modes 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 2e53de80bb scene_graph: Arrange scene graph on transaction apply 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 5f0801b6f2 container: Don't track outputs
The scene graph abstraction does this for us
2024-01-18 18:36:54 +03:00
Alexander Orzechowski 1e018e72b4 Delete old damage tracking code
The new scene graph abstraction handles this for us.
2024-01-18 18:36:54 +03:00
Alexander Orzechowski 06ad734e70 scene_graph: Port view saved buffers 2024-01-18 18:36:54 +03:00
Alexander Orzechowski ed2724bd6c xwayland: Cleanup geometry handling on commit
Instead of doing this roundabout thing where we get the surface from the
view, let's instead get it from the `wlr_surface_state` that we already
track in `handle_commit`. This makes the NULL state impossible which is
what the old `get_geometry` is checking for and generally cleans
things up a little bit.

Also don't check if the geometry x/y changed, those will always
be 0 for xwayland.
2024-01-18 18:36:54 +03:00
Alexander Orzechowski 6e5fc4c2aa scene_graph: Port xwayland 2024-01-18 18:36:54 +03:00
Alexander Orzechowski b38ed8b479 scene_graph: Port xdg_shell 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 08c484f46f transaction: ready signals will return success bools 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 6d7b1321db scene_graph: Port container server side decorations 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 188811f808 scene_graph: Port layer_shell 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 5b8b505af5 input: Query scene graph for relevant surface/node intersections 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 946fc80945 Introduce sway_text_node
This is a helper on top of a wlr_scene_buffer that will handle text
rendering for us.
2024-01-18 18:36:54 +03:00
Alexander Orzechowski 869baff252 renderer: Remove in favor of scene_graph 2024-01-18 18:36:54 +03:00
Alexander Orzechowski bac3ab5526 seat: Remove dead seatop_render function 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 9a57966606 scene_graph: Port ext_session_v1 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 0639bde9fb scene_graph: Port seatop_move_tiling indicators 2024-01-18 18:36:54 +03:00
Alexander Orzechowski c640c3015f scene_graph: Port seat drag icons 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 9c17cba0b2 renderer: Render scene_graph 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 0e1a02bf0a scene_graph: Introduce sway_scene_descriptor
Across a wayland compositor, there are multiple shells: It can be
a toplevel, or a layer_shell, or even something more meta like a drag
icon or highlight indicators when dragging windows around.

This object lets us store values that represent these modes of operation
and keep track of what object is being represented.
2024-01-18 18:36:54 +03:00
Alexander Orzechowski 1b09238645 scene_graph: Use built-in linux dmabuf feedback handling 2024-01-18 18:36:54 +03:00
Alexander Orzechowski 1eb16d1367 scene_graph: Maintain wlr_scene_nodes for the sway tree. 2024-01-18 18:36:54 +03:00
Alexander Orzechowski dbd2fbf430 view: init function should return a success bool 2024-01-18 18:36:54 +03:00
Alexander Orzechowski b4d7e84d38 desktop: Rename layers to shell_layers
This code will be deleted later, but for the time being rename
it so it doesn't conflict with future properties.
2024-01-18 18:36:54 +03:00
Kirill Primak 2c69e19fd3 layer-shell: don't configure uninitialized surfaces 2024-01-17 16:54:37 +01:00
Kirill Primak 8d1b0cecd9 layer-shell: wait for an initial commit before configuring 2024-01-17 16:54:37 +01:00
Kirill Primak 904d256581 layer-shell: don't try to unmap on destroy
A surface is guaranteed to be unmapped on destruction.
2024-01-17 16:54:37 +01:00
Simon Ser c5fd8c050f Mark DRM lease protocol privileged
Allowing sandboxed clients to request DRM leases has security
implications.
2024-01-08 11:17:26 -05:00
Simon Ser 7e69a7076f Drop wl_drm
See https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4397
2024-01-04 08:21:33 +01:00
Simon Ser fa294a9094 readme: add swaybg as optional dep 2024-01-02 14:08:18 +01:00
Simon Ser 95265fba59 input: reconfigure send_events on output hotplug
Closes: https://github.com/swaywm/sway/issues/7890
2024-01-02 14:07:35 +01:00
Billli11 0aceff7469
Remove wlr_presentation in sway_server struct
It is no longer in use.
2023-12-28 11:28:28 +01:00
Bill Li 64d644f0da Chase wlroots!4482 2023-12-27 20:57:35 +01:00
Simon Ser 22d0dd8bde Check wlr_pointer_constraint_v1_state.cursor_hint.enabled
Update for a wlroots breaking change which resets the committed
mask.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4478
2023-12-25 11:57:30 +01:00
Alexander Orzechowski bbabb9aae8 output: Destroy when output layout is destroyed
Since output layout is destroyed when the wayland display is destroyed
we run into a destroy listener order problem: Either the display starts
destroying the outputs first, in which case we're good: The existing
handling will clean up. However, things go wrong if the display decides
to destroy the output layout first. In this case, sway will hold
invalid references to the output layout as part of each output so that
when it finally goes to destroy them, sway will dereference destroyed
output layout bits.

Ref: https://github.com/swaywm/sway/pull/6844#issuecomment-1843599513
2023-12-13 18:10:03 +01:00
Simon Ser c6edbb7e5a input/seat: simplify seat_is_input_allowed()
Use an early return to make the code more readable.
2023-12-13 10:11:35 +01:00
Simon Ser e8a0205607 input/seat: rename seat_set_exclusive_client() 2023-12-13 10:11:35 +01:00
Simon Ser 607b8aed0c input/seat: inline seat_set_exclusive_client() with NULL client 2023-12-13 10:11:35 +01:00
Simon Ser 7ad8c80bfe input/{keyboard,switch}: rename input_inhibited variable to locked
This is more descriptive now.
2023-12-13 10:11:35 +01:00
Simon Ser dbd70faf2e input/seat: drop exclusive_client
This was a input-inhibit concept.
2023-12-13 10:11:35 +01:00
Simon Ser a6ef12d968 Detect proprietary DisplayLink drivers
evdi is open-source, but is just some condom for their proprietary
user-space driver.
2023-12-12 10:04:14 -05:00
Simon Ser ff07eab85b Detect Nvidia proprietary driver via drmGetVersion()
This is less punishing for users with the Nvidia driver loaded but
not used by Sway (e.g. for CUDA).
2023-12-12 10:04:14 -05:00
Simon Ser b81c4da494 Drop fglrx detection
This ancient driver doesn't do KMS. So we were never able to run
with it anyways.
2023-12-12 10:04:14 -05:00
Tamino Bauknecht 255ff665c5 sway: raise error on non-accessible background file 2023-12-12 09:39:46 -05:00
Simon Ser bf2b79b284 desktop/xwayland: correctly handle association on o-r change
When override-redirect changes, we need to setup/teardown listeners,
just like we do for map.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3773
2023-12-06 23:24:44 +03:00
mrusme ae3acf26f8 Update sway.5.scd
Make it extra extra extra clear, because I had to stumbled upon https://github.com/swaywm/sway/issues/3292 to understand this.
2023-12-04 16:30:20 +01:00
Alexander Orzechowski f12023b1a2 Don't destroy output layout on exit
wlroots will destroy this object itself.
2023-12-01 09:11:20 +01:00
Sergei Trofimovich 2cd73a33c2 sway/config.c: use memcpy() for known buffer size
`gcc-14` added a new warning around dangerous use of `strncpy()` withi
known overflow:

    ../sway/config.c: In function 'do_var_replacement':
    ../sway/config.c:983:33: error: '__builtin___strncpy_chk' specified bound depends on the length of the source argument [-Werror=stringop-truncation]
      983 |                                 strncpy(newptr, var->value, vvlen);
          |                                 ^
    ../sway/config.c:971:45: note: length computed here
      971 |                                 int vvlen = strlen(var->value);
          |                                             ^~~~~~~~~~~~~~~~~~

It's a bit fishy to rely on truncating behaviour of `strncpy()`. The
change uses `memcpy()` as more explicit way to express copy of `vvlen`
bytes.
2023-11-29 10:30:17 +01:00
apreiml bc7d15d64d Update README.de.md to match the EN one 2023-11-24 12:10:47 +01:00
Manuel Stoeckl e633fe0b40 common: move load_image to swaybar
swaynag, swaymsg, and sway do not use this function and are
unlikely to in the future.
2023-11-23 20:42:04 +01:00
Manuel Stoeckl 439122e887 common: rename load_background_image to load_image 2023-11-23 20:42:04 +01:00
Manuel Stoeckl 39b9c0d6ba common: Drop unused render_background_image
And the associated background_mode enum.
2023-11-23 20:42:04 +01:00
Kirill Primak 47e6a1164c xdg-shell: chase events update 2023-11-23 19:41:57 +01:00
Simon Ser 128b6253a9 Pass wl_display to wlr_output_layout
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4310
2023-11-23 16:13:19 +03:00
Simon Ser fd6d6f1d97 Add wlr/util/transform.h includes
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4097
Closes: https://github.com/swaywm/sway/issues/7830
2023-11-23 16:13:19 +03:00
llyyr a946b1aecf Chase wlroots!4440
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4440
2023-11-22 00:42:55 +03:00
llyyr 4ad15a4015 meson: bump wlroots version after 0.17.0 release 2023-11-22 00:42:55 +03:00
Matt Fellenz bff991dfdc Use locale time format for default bar command 2023-11-21 17:42:09 +01:00
Simon Ser 9d666a08e1 Fix reference to wlr_output_event_commit.committed
This has been dropped from wlroots. Previous commit missed that.
2023-11-21 16:52:19 +01:00
Simon Ser 072fa60cb4 Add support for security-context-v1
As a first step, deny access to privileged protocols to sandboxed
apps.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3589
2023-11-21 15:12:42 +01:00
Simon Ser 5bdd608514 Apply gamma LUT when an output re-enabled
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3679
2023-11-21 15:05:58 +01:00
EBADBEEF 86f96a786b view: re-apply criteria when window gets unmapped
Remove any existing executed criteria items at unmap time. If a window
gets unmapped but not destroyed, we want to reapply 'for_window'
criteria. Fixes #6905.
2023-11-21 14:57:58 +01:00
NemuiBanila c3ec141b34 seat: Fix cursor theme reload for tablet tool 2023-11-21 11:35:49 +01:00
Lina Banik f7a40cfa2f seat: Fix reloading cursor theme after change
This reverts commit afde6369
"seat: avoid unneeded reloading xcursor theme".
Always avoiding to reload the xcursor theme prevents reloading the
cursor even when this is desired. Instead seat_configure_xcursor
can determine whether a full reload is necessary.

To stay with the spirit of the reverted change, cursors are only fully
reloaded, if the theme has changed.

Fixes #6931
2023-11-21 11:35:49 +01:00
Simon Ser 5c99b98805 input/input-manager: drop input_manager_configure_all_inputs
This is now unused.
2023-11-16 16:29:07 +01:00
Simon Ser 7036769bea Only reconfigure input mappings on output change
Fully reconfiguring all input devices on output change takes a
loooong time. Let's just reconfigure what we need: only mappings
depend on outputs.
2023-11-16 16:29:07 +01:00
Simon Ser caa92ddee8 input/seat: rename seat_apply_input_config
seat_apply_input_mapping is a lot more descriptive.
2023-11-16 16:29:07 +01:00
Simon Ser 01dcad80e1 input/seat: don't configure mappings for switches
Switch devices cannot be mapped to an output/region, stop trying
to do so.
2023-11-16 16:29:07 +01:00
Sergei Trofimovich 020a572ed6 swaynag/config.c: fix build against gcc-14 (-Walloc-size)
`gcc-14` added a new `-Walloc-size` warning that makes sure that size of
an individual element matches size of a pointed type:

        https://gcc.gnu.org/PR71219

`sway` triggers it on `calloc()` calls where member size is used as
`1` (instead of member count):

    swaynag/config.c:169:65: error: allocation of insufficient size '1'
     for type 'struct swaynag_button' with size '48' [-Werror=alloc-size]
      169 | struct swaynag_button *button = calloc(sizeof(struct swaynag_button), 1);
2023-11-03 13:25:27 +01:00
Bill Li 6f6b82793d chase wlroots!4411
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4411
    fix #7802
2023-10-31 09:51:19 +01:00
Kirill Primak f2425b4fd6 xdg-shell: send maximized if tiled isn't supported
wlroots doesn't do it automatically anymore.
2023-10-29 17:21:18 +01:00
Dudemanguy 647521244a xdg_shell: don't update wlr_toplevel if the container has no size yet
3d5ae9813d added logic to change the
underlying wlr_toplevel size for floating containers, but it does it
even if the container has no actual coordinates yet. This doesn't really
make sense to update the toplevel size in this case since there's many
things that could affect the initial coordinates (sway commands,
fullscreen state, etc.). Skip this by doing a crude check to see if the
current container state has any width.
2023-10-27 17:36:32 -07:00
Kirill Primak 47263aca28 view: check if the buffer was uploaded on save
wlr_surface_has_buffer() is insufficient; if a client has committed a
buffer but it couldn't be applied, NULL deref happens in the next line.
2023-10-24 14:35:57 +02:00
Tamino Bauknecht 0dfaf7ea63 config/output: Allow approximation of output refresh rate
Previous behavior was that only if resolution and refresh rate match
exactly, the mode was accepted. As fallback, the mode with the highest
refresh rate and the same resolution was chosen.

New behavior is that the mode with the closest match for the refresh
rate is used with a limit of up to 1Hz. The fallback behavior stays the same.

Additionally, the logging was made more verbose.
2023-10-23 11:05:08 +02:00
Tamino Bauknecht f2425b5163 gitignore: Ignore clangd-generated directory .cache/ 2023-10-23 11:05:08 +02:00
Alexander Orzechowski 4326a26ad6 Chase wlroots!4331 2023-10-06 14:39:12 +03:00
iff 8a8fb76ec1 Update sway-input.5.scd 2023-10-05 10:04:32 +02:00
Simon Ser 7cf4e1d5c6 Drop support for KDE's idle protocol
We support the standard idle-notify protocol since Sway 1.8.
2023-10-05 00:01:54 +02:00
Ashraf b3519c2d2f Translate README to Arabic 2023-09-14 13:37:50 +02:00
Jan Beich 68caa8deba readme: Stop recommending setuid bit for non-logind systems
- Optional since Sway 1.6 per swaywm/wlroots@bad1e9afa8
- Deprecated in Sway 1.7 per 67d3d952b6
- Removed in Sway 1.8 per e5728052b5
- Ignored in future versions (keeps root priveleges)
2023-09-13 10:21:59 +02:00
Manuel Stoeckl 8edc48f6dd sway/server: Fix null pointer crash when Xwayland disabled 2023-09-10 08:33:10 +09:00
Johan Sköld d952ce403e i3 compat: Adding support for the all criteria
Matches all views. i3 PR: https://github.com/i3/i3/pull/4460

Fixes #7110
2023-09-07 10:42:54 +09:00
iff 3dd2f4a67f
commands/input/map_from_region: don't treat 0x prefix as hex identifier
When using the `map_from_region` for pen tables, we will usually make
the available area as big as possible while maintaining the proportions
with the screen.

As most of the tablets uses a 16:10 ratios while the most popular screen
ratios is still 16:9, the argument for most people should be `0x0 1x0.9`
to have the maximum effective area.

However, the argument above won't work because the current code will
treat `0x...` as a hexadecimal number, instead of setting both `x` and
`y` to `0`.

This fix allows the use of the following syntax:

```
input type:tablet_tool {
	map_from_region 0x0 1x0.9
}
```
2023-09-07 01:31:35 +00:00
denppa 89f8531268
build: fix build with wayland-scanner subproject 2023-08-30 23:57:25 +09:00
Dudemanguy 3d5ae9813d xdg_shell: update wlr_toplevel size on client resizes
If a floating client resizes itself, sway updates several of its
internal dimensions to match but not wlr_toplevel. This means that the
next time wlroots sends a toplevel configure event, it can have wrong
coordinates that resize the client back to its old size. To fix this,
let's just use wlr_xdg_toplevel_set_size so the wlr_toplevel has the
same dimensions as sway.

Exactly the same as 0183b9d35d but the
logic is onlly applied to xdg_shell and not xwayland.
2023-08-28 17:04:53 -07:00
Dudemanguy 60a94b4916 Revert "view: update wlr_toplevel size on client resizes"
This isn't the right fix for this issue because the xwayland code also
uses this function and updating the wlr_toplevel there doesn't make
sense and also causes problems. Fixes #7722.

This reverts commit bf44690ee8.
2023-08-28 17:04:53 -07:00
Dudemanguy bf44690ee8 view: update wlr_toplevel size on client resizes
If a floating client resizes itself, sway updates several of its
internal dimensions to match but not wlr_toplevel. This means that the
next time wlroots sends a toplevel configure event, it can have wrong
coordinates that resize the client back to its old size. To fix this,
let's just use wlr_xdg_toplevel_set_size so the wlr_toplevel has the
same dimensions as sway. Fixes #5266.
2023-08-26 13:44:37 -07:00
Simon Ser 4a2210577c Hide xwayland_shell_v1 from regular clients
Regular clients are not allowed to use this interface. wlroots
already sends a protocol error if a non-Xwayland client tries to
use this interface, but let's remove all temptation by hiding it
completely.
2023-08-24 18:27:22 +02:00
luzpaz d84b3832f4 Fix typo 2023-08-23 20:18:13 +02:00
Kirill Primak a908651821 chore: chase wlroots xdg-surface role rework 2023-08-21 18:41:32 +02:00
Leonardo Hernández Hernández 363c57984d chase wlroots!4316
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4316
2023-08-19 21:06:26 -07:00
Simon Ser bb91b7f5fa Move contrib/ to separate repository
User-contributed scripts are being moved over to this repository:
https://github.com/OctopusET/sway-contrib
2023-08-02 17:18:38 +02:00
ookami eebbecc780 Rebase all cursors in handle_surface_map
Fix swaylock showing transient cursor after locked.
2023-07-31 21:00:20 +02:00
Simon Ser f8ddd97e0e output: drop current_mode
This is now unused.
2023-07-31 16:25:01 +02:00
Simon Ser 170598d71b desktop/output: fix output manager enabled state
With recent wlroots changes, backends which don't support output
modes can now support being disabled.

We were always marking mode-less outputs as disabled. Stop doing
that, check whether the output takes up some space in the layout
instead.
2023-07-31 16:25:01 +02:00
Simon Ser d3626efe5e desktop/output: drop handle_mode()
We already perform the exact same logic on transform/scale change.
2023-07-31 16:25:01 +02:00
Simon Ser d557b6876b desktop/output: drop logic to handle backend-applied mode
The wlroots backends no longer magically apply output modes behind
the compositor's back.
2023-07-31 16:25:01 +02:00
Alexander Orzechowski df8aad9c5a swaynag: Implement wp_cursor_shape_v1 2023-07-31 10:34:11 +02:00
Alexander Orzechowski f436de9200 swaybar: Implement wp_cursor_shape_v1 2023-07-31 10:34:11 +02:00
Simon Ser 6bd11ad0df Add support for cursor-shape-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4106
2023-07-24 11:28:31 +02:00
bretello dc634c4a13 fix crash when resizing tiled scratchpad windows
Splitting and then hiding a scratchpad container results in
a segfault.

fixes #6693
2023-07-23 11:10:26 -07:00
Nick Kipshidze c3e6390073 Add Georgian README
I am a native Georgian speaker.

I have translated sway's README.md
2023-07-20 08:36:29 +02:00
Simon Ser ee4637b086 Deprecate seat idle_wake
Sway has two knobs to control idling:

- seat idle_inhibit: when the seat is active (ie. not idle), this
  extends the active state. When the seat is idle, this is
  ignored.
- seat idle_wake: when the seat is idle, this wakes up the seat.
  When the seat is active, this is ignored.

The motivation for the deprecation is two-fold:

- The concept of "seat idle state" is ill-defined. Each idle-notify-v1
  client will pass a different idle timeout. With the old logic, a
  seat was declared idle if and only if all idle-notify-v1 timeouts have
  expired. However, if only a portion of the timeouts have expired,
  then some clients would wake up, and the rest would stay active.
  This is inconsistent with the definition of idle_inhibit/idle_wake:
  idle_inhibit was used for clients which are waking up.
- It never worked properly with the new idle-notify-v1 protocol
  and no-one noticed. Only the legacy KDE idle protocol is taken
  into account, but that protocol is not used anymore.
2023-07-19 09:28:33 +02:00
Simon Ser a34d785a26 swaynag: handle wayland-cursor failures
Same as 92244c87db ("swaybar: handle wayland-cursor failures")
but for swaynag.

Closes: https://github.com/swaywm/sway/issues/7671
2023-07-17 10:01:46 +02:00
Artturin 9107907969 chase wlroots 'presentation-time: add separate helper for zero-copy '
67447d6cb4
2023-07-15 15:21:35 +02:00
nukoseer 6c234d013a Calculate tiled resize amount relative to parent container
sway should shrinks/grows tiled windows according to parent container
for ppt unit for i3 compatibility.

Resolves: #7593
2023-07-13 13:27:46 -07:00
Simon Ser fc16fb6549 Send wl_surface.preferred_buffer_scale
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3696
2023-07-12 09:59:00 +02:00
Manuel Stoeckl 92244c87db swaybar: handle wayland-cursor failures
Updating the cursor is not essential, so this change prints
a warning when wl_cursor_theme_load or wl_cursor_theme_get_cursor
fail instead of crashing or exiting.
2023-07-08 09:36:50 +02:00
llyyr 20ffe545ba swaybar: don't set current workspace as not visible
When `wrap_scroll yes` is configured and there's only one workspace
open, swaybar will mark it as not visible if the user scrolls on it and
eventually incorrectly fail the `active->visible` assert.
Fix this by making sure that new and current workspace aren't the same.
2023-06-27 14:40:57 -07:00
Mark Bolhuis 20c91335f6 input: Move wlr_pointer_gestures_v1 to sway_input_manager
On multi-seat configurations a zwp_pointer_gestures_v1 global was
created for every seat.

Instead, create the global once in the input manager, to be shared
across all seats.
2023-06-26 22:57:46 +02:00
Simon Ser 974a8629a8 Use "default" XCursor instead of "left_ptr"
"left_ptr" is the legacy XCursor name. "default" is the cursor
spec name.
2023-06-25 22:38:10 +02:00
Hodong 7fbd9fbf28
swaybar: remove the argument of StatusNotifierHostRegistered
According to
https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierWatcher/
there is no argument for the StatusNotifierHostRegistered signal.
2023-06-23 17:54:08 +02:00
Simon Ser b762f455d9 idle-inhibit-v1: simplify with server global
We only have a single running server, no need to keep track of
multiple server instances. Also no need to support multiple
idle inhibit managers.
2023-06-23 12:32:38 +02:00
Simon Ser 5411ed4ef0 Use wlr_cursor_unset_image()
A bit cleaner.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4209
2023-06-19 19:48:53 +02:00
Simon Ser 6f1a3b6652 Use wlr_cursor_set_xcursor()
wlr_xcursor_manager_set_cursor_image() is deprecated.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4170
2023-06-19 19:48:53 +02:00
Alexander Orzechowski 876687000d render: Use wlroots scale filter 2023-06-19 19:14:28 +02:00
Cezary Drożak c08762901e input/libinput: add scroll_button_lock method
Closes https://github.com/swaywm/sway/issues/6987

Co-authored-by: JJGadgets <git@jjgadgets.tech>
Co-authored-by: DeltaWhy <mike5713@gmail.com>
2023-06-16 15:30:04 +02:00
Rouven Czerwinski 8b4b65d665 gamma_control_v1: handle destroyed output
In case a display is unplugged, the sway output may be removed from the
userdata before the gamma_control can be reset. In this case we can't
schedule a commit on the output, simply return within the function.

backtrace full:

  #0  handle_gamma_control_set_gamma (listener=0x4856a8 <server+616>, data=0x7ffce1ed59c0) at ../sway/desktop/output.c:1105
          server = 0x485440 <server>
          event = 0x7ffce1ed59c0
          output = 0x0
  #1  0x00007f430d1dca0c in wl_signal_emit_mutable ()
     from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0
  No symbol table info available.
  #2  0x00007f430d142370 in gamma_control_destroy (gamma_control=0x29eb9b0) at ../types/wlr_gamma_control_v1.c:37
          manager = 0x27e33e0
          output = 0x2a10770
          event = {output = 0x2a10770, control = 0x0}
  #3  0x00007f430d14239b in gamma_control_handle_output_destroy (listener=<optimized out>, data=<optimized out>)
      at ../types/wlr_gamma_control_v1.c:59
          gamma_control = <optimized out>
  #4  0x00007f430d1dca0c in wl_signal_emit_mutable ()
     from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0
  No symbol table info available.
  #5  0x00007f430d12a0e0 in wlr_output_destroy (output=output@entry=0x2a10770) at ../types/output/output.c:384
          cursor = <optimized out>
          tmp_cursor = <optimized out>
          layer = <optimized out>
          tmp_layer = <optimized out>
  #6  0x00007f430d114ecf in disconnect_drm_connector (conn=conn@entry=0x2a10770) at ../backend/drm/drm.c:1757
          __PRETTY_FUNCTION__ = "disconnect_drm_connector"
  #7  0x00007f430d117078 in scan_drm_connectors (drm=drm@entry=0x1eebab0, event=event@entry=0x7ffce1ed5c1c) at ../backend/drm/drm.c:1597
          c = <optimized out>
          wlr_conn = 0x2a10770
          drm_conn = 0x2e760d0
          conn_id = <optimized out>
          index = 4
          i = 4
          res = 0x2e761f0
          seen_len = 5
          seen = {true, true, true, true, true, false}
          new_outputs_len = 0
          new_outputs = 0x7ffce1ed5ab0
          conn = <optimized out>
          tmp_conn = <optimized out>
          index = <optimized out>
  #8  0x00007f430d113425 in handle_dev_change (listener=0x1eebbb0, data=0x7ffce1ed5c18) at ../backend/drm/backend.c:157
          drm = 0x1eebab0
          change = 0x7ffce1ed5c18
  #9  0x00007f430d1dca0c in wl_signal_emit_mutable ()
     from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0
  No symbol table info available.
  #10 0x00007f430d111696 in handle_udev_event (fd=<optimized out>, mask=<optimized out>, data=<optimized out>)
      at ../backend/session/session.c:213
          event = {type = WLR_DEVICE_HOTPLUG, {hotplug = {connector_id = 0, prop_id = 0}}}
          devnum = <optimized out>
          dev = 0x1ed9460
          session = <optimized out>
          udev_dev = 0x2e70db0
          sysname = 0x2e73c60 "card0"
          devnode = <optimized out>
          action = 0x7f430d6677b5 "change"
          seat = <optimized out>
          __PRETTY_FUNCTION__ = "handle_udev_event"
  #11 0x00007f430d1de8e2 in wl_event_loop_dispatch ()
     from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0
  No symbol table info available.
  #12 0x00007f430d1dc445 in wl_display_run () from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0
  No symbol table info available.
  #13 0x000000000041daa5 in server_run (server=server@entry=0x485440 <server>) at ../sway/server.c:338
  No locals.
  #14 0x000000000041cf4d in main (argc=<optimized out>, argv=0x7ffce1ed5fe8) at ../sway/main.c:415
          verbose = false
          debug = false
          validate = false
          allow_unsupported_gpu = false
          config_path = 0x0
        c = <optimized out>

where event->output->data is NULL:

  (gdb) p event->output->data
  $5 = (void *) 0x0
2023-06-14 10:13:12 +02:00
Alexander Orzechowski 59c27c94d3 gamma_control_v1: Reset dirty flag 2023-06-11 20:53:39 +02:00
33KK be14cd96cd
Fix bindsym --to-code not respecting input configs
Fixes #7535
2023-06-11 11:36:30 +02:00
Shaked Flur 6a1c176d14
man: add --inhibited and --no-repeat to bindsym and bindcode usage 2023-06-09 12:23:05 +02:00
Simon Ser 65b1a6964c desktop/output: fix damage bitfield in wlr_output_state 2023-06-09 11:41:41 +02:00
Simon Ser f3b8c9feee desktop/output: use detached output state for page-flips
This avoids relying on the implicit wlr_output.pending state.
2023-06-08 14:33:23 -07:00
Simon Ser b1b3563d54 Handle gamma-control-v1 set_gamma events
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4046
2023-06-08 22:11:50 +02:00
Erik Reider 913a7679cb Add support for wlr-layer-shell ON_DEMAND keyboard interactivity
This allows for layer shell surfaces to receive focus while the surface is explicitly focused, i.e allowing
text fields to receive keyboard input just like a regular surface.
2023-06-06 09:07:05 +02:00
Artturin 7ab8cb2ee6 chase wlroots wlr_renderer_begin_buffer_pass change
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4159

> ../sway/desktop/output.c:618:47: error: too few arguments to function 'wlr_renderer_begin_buffer_pass'
>   618 |         struct wlr_render_pass *render_pass = wlr_renderer_begin_buffer_pass(
>       |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2023-06-05 23:12:20 +02:00
Kirill Primak b5cb49bce9 xwayland: fix mapped state check in OR handlers 2023-06-03 09:12:12 +02:00
Kirill Primak c001a57e8b lock: listen to the correct map signal 2023-06-02 22:22:29 +02:00
Kirill Primak c9e1dab318 chore: chase wlroots map logic unification 2023-06-02 20:11:42 +02:00
Kirill Primak 72881b5d12 xwayland: don't rely on event source being data
This pattern is being slowly removed from wlroots.
2023-06-02 20:11:42 +02:00
Erik Reider 48d6eda3cb Fix layer old damage not being offset by the monitor layout coords 2023-05-20 16:56:25 +02:00
hrdl 01b0c11394 seatop_down: Call seatop_begin_default after sending touch events
This is consistent with pointer tablet and button events.

Fixes #7577.
2023-05-11 12:47:56 +02:00
Simon Ser 19cc36accc render: fix titlebar texture clipping
We need to provide an unclipped dst_box.

Fixes: https://github.com/swaywm/sway/issues/7573
Regressed by: https://github.com/swaywm/sway/pull/7552
2023-05-09 18:12:06 +02:00
Kenny Levinsen 0a951517ae render: Clear using wlr_output dimensions
Clear was done using sway_output's logical dimensions, instead of the
wlr_output physical dimensions. This meant that when output scaling was
applied, only a part of the screen would be cleared.

Use the wlr_output dimensions instead.

Regressed by: https://github.com/swaywm/sway/pull/7552
2023-05-09 15:55:31 +02:00
Kenny Levinsen 393c29fc59 render: Apply clip to rendered texture correctly
The new wlr_render_pass API provides src_box, dst_box and clip
parameters for texture rendition. Rather than clipping the dst_box,
which control the projection matrix and leads to compression, intersect
the damage and clip box and pass these as a clip parameter.

Fixes: https://github.com/swaywm/sway/issues/7579
Regressed by: https://github.com/swaywm/sway/pull/7552
2023-05-09 15:55:31 +02:00
Mukundan314 a79994e119 swaybar: always subscribe to mode and workspace
always subscribe to mode and workspace events, since we might need them
after bar config updates even if we don't need them initially.
2023-05-09 12:42:56 +02:00
hrdl 3cd7c71780 handle_touch_cancel: fix begin default
I forgot to call seatop_begin_default in
e8f7551e46.
2023-05-04 17:34:54 +02:00
hrdl e8f7551e46 Add support for touch cancel events 2023-05-04 13:30:57 +02:00
Alexander Orzechowski db7638a0e5 Don't crash if there is no damage during render 2023-05-02 23:25:50 +02:00
Alexander Orzechowski 029b99b482 render: Use wlr_render_pass 2023-05-02 18:31:55 +02:00
Alexander Orzechowski 07cdf6ccd0 render: Don't pass matrix into render_texture 2023-05-02 18:31:55 +02:00
Alexander Orzechowski d5cc474aef render: pass rendering state together in a struct
This lets us easily add rendering state that we need in the future
2023-05-02 18:31:55 +02:00
Alexander Orzechowski 33cfdbe886 xdg_shell: Fix crash if popup generates while toplevel is in the scratchpad 2023-04-16 19:55:00 +02:00
Simon Ser 08c1946d71 Use format_str() throughout 2023-04-14 18:34:54 +02:00
Simon Ser ac8962eb62 common/gesture: use format_str()
We already had a similar function in there.
2023-04-14 18:34:54 +02:00
Simon Ser ea279f4df3 swaynag: add printf attribute to swaynag_log() 2023-04-14 18:34:54 +02:00
Simon Ser 96cebb4fe6 config: add printf attribute to config_add_swaynag_warning() 2023-04-14 18:34:54 +02:00
Simon Ser a7b50f6c9c commands: add printf attribute to cmd_results_new()
And fix the resulting build failures.
2023-04-14 18:34:54 +02:00
Simon Ser d6915f6428 commands/floating_minmax_size: fix error strings
cmd_results_new() does not take the command name as argument.
2023-04-14 18:34:54 +02:00
Simon Ser bd58df61ef pango: add printf attribute
This allows the compiler to catch mismatches between the format
string and the arguments passed in.

Need to add -Wno-format-zero-length because we pass an empty string
on purpose in swaybar/render.c.
2023-04-14 18:34:54 +02:00
Simon Ser aab4c9da5f Add format_str() and vformat_str()
Simple helpers to allocate and format a string.
2023-04-14 18:34:54 +02:00
Simon Ser 4118c49349 Use output_match_name_or_id() in workspace functions 2023-04-14 18:34:54 +02:00
Simon Ser fcec581748 Use output_match_name_or_id() in apply_output_config_to_outputs() 2023-04-14 18:34:54 +02:00
Simon Ser 04904ab9a5 Use all_output_by_name_or_id() in merge_id_on_name()
No need to iterate over the outputs manually.
2023-04-14 18:34:54 +02:00
Simon Ser 8d95638df6 Introduce output_match_name_or_id()
Reduces code duplication.
2023-04-14 18:34:54 +02:00
Elyes Haouas 63f9bdf001 Fix old style function definitions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-04-14 18:21:43 +02:00
Simon Ser ab4f460597 Set output damage during direct scan-out
During direct scan-out, pass the damaged region to the wlroots
backend.
2023-04-14 17:43:37 +02:00
Simon Ser 777df22377 Skip direct scan-out commit when damage is empty
When there is no damage, no need to perform an output commit, even
when direct scan-out is used.
2023-04-14 17:43:37 +02:00
Simon Ser 5e847fe3c8 Pass version to wlr_compositor_create()
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3696
2023-04-14 17:26:03 +02:00
Alexander Orzechowski dadf3e9b78
Chase wlroots!4067 2023-04-06 22:03:52 +02:00
Simon Ser e8fb7f53b8 Remove duplicate wlr_damage_ring_set_bounds() call
We already do this in handle_commit().
2023-04-06 16:35:21 +02:00
Erik Reider fa7b686e61
Fix damage-ring bounds not being set when unplugging -> plugging in monitor
#7524 was a partial fix. Seems like this is still an issue when
unplugging and plugging the monitor back in.

Closes: https://github.com/swaywm/sway/issues/7528
2023-04-06 10:40:49 +02:00
Alexander Orzechowski 9cf66e8c7c swaybar: Lift background clearing out of main rendering function
This avoids us from using a bogus background_color value that
mutates as swaybar renders things and deciding opacity depending on
that.

Also remove a redundant full surface clear. Just directly write our
desired background color.
2023-04-02 01:58:02 +02:00
Alexander Orzechowski 5d5b21dcce swaybar: Set opaque region properly
The opaque region is set incorrectly if updated on-the-fly if switching from an opaque to a non opaque background.
2023-04-02 01:58:02 +02:00
Simon Ser dee032d0a0 ipc: add LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM entry
This was introduced in the last libinput release.

Fixes the following error:

    ../sway/ipc-json.c:928:17: error: enumeration value 'LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM' not handled in switch [-Werror=switch]
      928 |                 switch (libinput_device_config_accel_get_profile(device)) {
          |                 ^~~~~~
2023-03-27 10:56:16 +02:00
Ronan Pigott 6701b90c55 Add a .mailmap file 2023-03-26 23:22:30 +02:00
Simon Ser 4f6e559dec man: deprecate seat cursor move/set/press/release
The Wayland protocol better serves this purpose, and is supported
by more compositors.
2023-03-26 23:22:04 +02:00
Erik Reider ac1ed638e9 Init the damage_ring bounds on output creation
Otherwise the initial bounds would be `INT_MAX` until `handle_mode` or `handle_commit` is called :)
2023-03-26 23:00:08 +02:00
Ankit Pandey f21090f978 root: Set inactive focus when scratchpad is moved to new workspace
Fixes an issue where an already visible scratchpad window being moved due to
'scratchpad show' leaves the entire workspace at the top of the focus stack in
the old workspace. Moving by 'focus output' back to the old workspace would
focus the entire workspace instead of just the last active container.
2023-03-24 13:20:13 -07:00
Ankit Pandey 90c2d631e2 root: Try to preserve relative positions of floating containers
This makes the behavior of floating containers more consistent with i3.
The coordinates of the container are scaled when the size of the
workspace it is on changes or when the container is moved
between workspaces on different outputs.

For scratchpad containers, add a new state that preserves the dimensions
of the last output the window appeared on. This is necessary because
after a container is hidden in the scratchpad, we expect it to be in the
same relative position on the output when it reappears. We can't just
use the container's attached workspace because that workspace's
dimensions might have been changed or the workspace as a whole could
have been destroyed.
2023-03-14 23:26:42 -07:00
Stanislav Ochotnický ebeed7e303 man: add warning for hide_cursor configuration
See https://github.com/swaywm/sway/issues/6297
2023-03-11 11:58:05 -05:00
Simon Zeni 51c9376c07
ci: add libdisplay-info dependency 2023-02-28 23:19:33 +01:00
novenary b28e1b0d3c Disable direct scanout for surfaces with popups 2023-02-28 15:38:05 +01:00
llyyr b757ef94ef sway{,bar}: use default font hint style
CAIRO_HINT_STYLE_FULL attempts to maximize contrast at the expense
of fidelity, this makes most fonts that haven't been hand hinted,
which makes up the majority of fonts out there, appear much worse.

In the absence of explicitly set hint style, cairo will default to
CAIRO_HINT_STYLE_SLIGHT, which attempts to improve contrast while
retaining fidelity to the original shapes, which is what we want.
2023-02-27 13:55:08 -05:00
rj1 d63497698b fix typo 2023-02-25 10:50:43 +01:00
Robin Jarry 9498e4d261 Allow windows in scratchpad to set the urgent flag
When a window in the scratchpad container requests for
xdg_activation_v1, it is ignored no matter what the value of
focus_on_window_activation is.

At least allow windows in the scratchpad to set the urgent flag. When
focus_on_window_activation is set to "focus", show the parent scratchpad
where the contained requested for xdg_activation_v1.
2023-02-22 11:41:43 -07:00
Simon Ser 16b0afd433 Check for empty damage before attaching render buffer
Check whether output->damage_ring.current is empty before calling
wlr_output_attach_render(). Saves us from having to un-do that
via wlr_output_rollback().
2023-02-22 13:37:44 -05:00
Simon Ser c2ccc0c9d4 Move output commit out of output_render()
That way output_render() only does what it says on the tin.
2023-02-22 13:37:44 -05:00
Simon Ser d6cb4fa8de Constify pixman_region32_t for rendering functions 2023-02-22 13:37:44 -05:00
Simon Ser 423459723b Adjust scale for fractional-scale-v1 2023-02-22 10:14:31 -05:00
Stacy Harper 4666d1785b Implement seatop_touch
Atm we got issue with the touch position sent to the clients. While
holding contact, leaving the initial container will continue to send
motion event to the client but with the new local position from the new
container.

This seatop goal is to send the position of the touch event, relatively
to the initial container layout position.
2023-02-20 10:35:10 -05:00
Simon Ser 7d2e4a5106 layer-shell: enter output before surface is mapped
This sends fractional-scale-v1 events before the first configure
event. That way clients have all of the metadata they need to render
the first frame.
2023-02-20 12:20:42 +01:00
Simon Ser 7a6c7d60d5 Update surface fractional scale on output change
Closes: https://github.com/swaywm/sway/issues/7464
2023-02-20 12:11:07 +01:00
Ronan Pigott 633d409b88 container: rehome the container_swap function into container.c
This function was already declared in container.h but defined in
commands/swap.c for some unknown reason. Everything in commands/ assumes
the handler context has been set appropriately by the command preludes
but this function snuck its way into seatop_* which doesn't set anything
in the handler context.

The fact that the seatop drag actions manipulate the focus without
custody of the seat means they are definitely very broken in multiseat.
2023-02-19 20:07:39 -05:00
Daniel Hill 788118f194 Fix map_to_output * turning off device
Signed-off-by: Daniel Hill <daniel@gluo.nz>
2023-02-18 20:15:28 +01:00
Simon Ser 9162b536f6 Add support for fractional-scale-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3511
2023-02-10 20:36:15 +01:00
Simon Ser 1cab17ada2 Introduce surface_{enter,leave}_output()
We can centralize all output-related surface events from there.
2023-02-10 20:36:15 +01:00
Łukasz Adamczak 8e4b659578 Clarify documentation for window_rect 2023-02-10 11:17:50 -07:00
Łukasz Adamczak fadfbe8dba Correct window_rect.y with hide_edge_borders
With `hide_edge_borders both` (or at least `vertical`),
`window_rect.y` will equal `border_thickness` for SOME windows,
but it will be 0 for windows adjacent to top screen edge.

Therefore setting it to `border_thickness` is not sufficient.

This commit changes it to the actual y offset of content
into the container.
2023-02-10 11:17:50 -07:00
Ronan Pigott 1b27e8c8fd xdg-activation: fix urgency when the client does not specify a seat
xdg-activation is now too strict in only allowing tokens with a seat to
activate a surface. Clients may rely on this behavior for urgency hints.
The seat argument is still useful in case the client does provide a seat
so we can activate it on the desired seat.

Fixes: 842609da64 (view: make request_activate take a seat, 2022-11-30)
2023-02-09 20:02:32 +01:00
Simon Ser b4ce0a30c1 Use wlr_linux_dmabuf_feedback_v1_init_with_options()
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3933
Closes: https://github.com/swaywm/sway/issues/7436
Closes: https://github.com/swaywm/sway/pull/7437
2023-02-07 13:35:56 -05:00
Baltazár Radics 7d0351b411 ipc: add ability to subscribe to output event 2023-02-06 11:02:52 +01:00
Ronan Pigott 4cda9ee3a3 launcher: support external launcher tokens 2023-02-05 00:53:47 -07:00
Ronan Pigott dbc1eec850 launcher: make launcher context seat aware 2023-02-05 00:53:47 -07:00
Ronan Pigott 842609da64 view: make request_activate take a seat
This way we can move focus on the same seat an activation token
originates from.
2023-02-05 00:53:47 -07:00
Simon Ser 0780d3a465 ci: install hwdata-dev on Alpine
We're missing the pkg-config file so the DRM backend gets disabled.
2023-02-04 20:48:20 -07:00
Simon Ser 0695f3fa2a swaymsg: s/inactive/disabled/
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-02 12:00:06 -05:00
Simon Ser f22d4dbab7 swaymsg: print output power status 2023-02-02 12:00:06 -05:00
Radical 412b80983e
Add Norwegian READMR
Added a Norwegian README file `README.no.md` and added a link to it in
the original `README.md` file.
2023-02-02 17:45:01 +01:00
Simon Ser 9959e6b8dc Convert to *_try_from_wlr_surface()
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3991
2023-02-02 14:53:15 +03:00
Tobias Predel b31e97e55d root: free non_desktop_outputs list on root_destroy
This fixes a memory leak because the non_desktop_outputs list was not
freed when the root was destroyed.
2023-02-02 09:39:58 +01:00
Simon Ser ae2d14ceeb Convert to wlr_xwayland_surface_try_from_wlr_surface()
Accomodate for the breaking changes in [1].

[1]: fbf5982e38
2023-02-01 23:38:12 +01:00
Simon Ser 40eb29e7c5 ipc: add support for output event
For compatibility with i3 [1].

[1]: https://i3wm.org/docs/ipc.html#_output_event
2023-02-01 11:32:57 -05:00
Cedric Sodhi 2e33b0276f Added reference for event types to swaymsg manpage 2023-02-01 16:22:15 +01:00
Simon Ser ab9b164e52 Switch default menu to wmenu
Switch the default menu to wmeny (https://sr.ht/~adnano/wmenu),
a Wayland-native alternative to dmenu. This removes the dependency
on Xwayland for the default config.

wmenu is small (same scope as dmenu) and has the same flags as dmenu.
One downside is that it's not widely packaged by distributions yet.

We still depend on dmenu_path.
2023-01-30 15:08:16 -05:00
Alexander Courtis 2c0f68b7c6
Apply new adaptive sync value from wlr-output-management
fixes #7394

Test cases:
* zwlr_output_configuration_head_v1_set_adaptive_sync 0->0, no change
* 0->1, enabled
* 1->0, disabled
* 1->1, no change

Similar tests with an incapable display resulted in `"Adaptive sync
failed, ignoring"` messages as expected.
2023-01-23 14:17:52 +01:00
Simon Ser 36f627d0fa Check return value of wlr_renderer_begin()
Since [1], wlr_renderer_begin() can fail. Check its return value
and bail.

This fixes an assertion error (when begin() fails and then we try
to render something) after a GPU reset.

[1]: a541c9510a
2023-01-21 14:16:21 +01:00
Tobias Bengfort a7b9f6fedc focus_on_window_activation: raise if floating 2023-01-20 17:04:26 +01:00
Simon Ser 6a3e265326 Fix pointer events for ext-session-lock surfaces
We were never sending any pointer event to ext-session-lock
surfaces.
2023-01-18 11:23:05 -05:00
Simon Ser d5b69d5912 Fix indentation in surface_is_xdg_popup() 2023-01-18 16:48:38 +01:00
Simon Ser 284966fd57 Send wl_surface.enter for ext-session-lock surfaces 2023-01-18 00:48:24 +01:00
Kirill Primak 53c9a4a643 input/tablet: handle focusing NULL surface
Additionally, rename the function responsible for switching focus to
match its behavior better.
2023-01-16 15:37:59 -05:00
Manuel Stoeckl 5e73acb431 swaynag: call swaynag_destroy on clean exit
And fix the fallout of the swaynag_destroy having evolved without
being tested:
* wl_display_disconnect was called too early
* `button_close` and `swaynag.details.button_details` needed to be
  heap allocated, since they are added to swaynag.buttons, and all
  entries of swaynag.buttons are freed in swaynag_destroy
* To keep things simpler, disconnect the lifetime of the 'Toggle details'
  button text config setting from the button itself.
2023-01-16 10:47:42 -05:00
Ronan Pigott 2f2cdd60de input: enable user xkb configs with cap_sys_nice 2023-01-11 11:32:09 +01:00
John Chadwick 3061999ec5 Improve tablet tool button handling.
This change allows the tablet tool button to be used for floating mod
resize. In addition, it attempts to ensure that tablet tool events are
consistent such that tablet v2 events and pointer events will never be
interleaved, and such that the tool buttons count will never fall out of
sync and cause tool button emulation to break.

Some of this logic is similar to what is done for tablet tool tip, but
not quite identical, because of the complication that we have to deal
with multiple inputs that can overlap eachother.

Fixes #7036.
2023-01-07 23:52:27 -05:00
Alexander Orzechowski 88c17ece3b warp_to_constraint_cursor_hint: Handle NULL view
This might be the wrong fix, but the crash is happening because the ->data
field on an xwayland surface is NULL. A NULL data field is normal for
unmanaged surfaces, however it seems clients can do weird things: They can
create a cursor lock on a regular xwayland surface then make it unmanaged
by calling override_redirect. In this case, the xwayland server should
destroy the cursor lock, which is does, but does so in the wrong order
making it try to dereference a NULL pointer after sway has acknowledged
its new unmanaged status.

```
(gdb) bt full
0  0x000055fd91934861 in warp_to_constraint_cursor_hint (cursor=0x55fd93486c00)
    at ../sway/input/cursor.c:1243
        sy = 605
        lx = 6.9527431433545762e-310
        sx = 1272
        view = 0x0
        con = 0x7ffd1cdfe400
        ly = -6.949595189996421e+59
        constraint = 0x55fd93e7faa0
1  0x000055fd91934976 in handle_constraint_destroy (listener=0x55fd93f0fd58, data=0x55fd93e7faa0)
    at ../sway/input/cursor.c:1266
        sway_constraint = 0x55fd93f0fd30
        constraint = 0x55fd93e7faa0
        cursor = 0x55fd93486c00
2  0x00007fda8275bf6e in wl_signal_emit_mutable () at /usr/lib/libwayland-server.so.0
3  0x00007fda82e57016 in pointer_constraint_destroy (constraint=0x55fd93e7faa0)
    at ../subprojects/wlroots/types/wlr_pointer_constraints_v1.c:49
4  0x00007fda82e570dc in pointer_constraint_destroy_resource (resource=0x55fd933cf8f0)
    at ../subprojects/wlroots/types/wlr_pointer_constraints_v1.c:66
        constraint = 0x55fd93e7faa0
5  0x00007fda8275d8ba in  () at /usr/lib/libwayland-server.so.0
6  0x00007fda8275f6a9 in wl_resource_destroy () at /usr/lib/libwayland-server.so.0
7  0x00007fda82e56fb3 in resource_destroy (client=0x55fd93ea52e0, resource=0x55fd933cf8f0)
    at ../subprojects/wlroots/types/wlr_pointer_constraints_v1.c:39
8  0x00007fda81d8f4f6 in  () at /usr/lib/libffi.so.8
9  0x00007fda81d8bf5e in  () at /usr/lib/libffi.so.8
10 0x00007fda81d8eb73 in ffi_call () at /usr/lib/libffi.so.8
11 0x00007fda8275aada in  () at /usr/lib/libwayland-server.so.0
12 0x00007fda8275f01c in  () at /usr/lib/libwayland-server.so.0
13 0x00007fda8275d9e2 in wl_event_loop_dispatch () at /usr/lib/libwayland-server.so.0
14 0x00007fda8275e197 in wl_display_run () at /usr/lib/libwayland-server.so.0
15 0x000055fd919264d3 in server_run (server=0x55fd919a3a80 <server>) at ../sway/server.c:320
16 0x000055fd91925457 in main (argc=1, argv=0x7ffd1cdfed98) at ../sway/main.c:411
        verbose = false
        debug = false
        validate = false
        allow_unsupported_gpu = false
        config_path = 0x0
        c = -1
```
2023-01-04 10:37:36 +01:00
Carl Smedstad 714559812e Use correct length for strncmp comparison 2023-01-03 21:50:56 +01:00
Carl Smedstad 9425ce2fba Replace math functions that promote float to double 2023-01-03 21:50:56 +01:00
Carl Smedstad d8212243c9 Remove redundant return statements 2023-01-03 21:50:56 +01:00
Carl Smedstad 6ec57271b6 Make cmd_handler.command const 2023-01-03 21:50:56 +01:00
Carl Smedstad 9540591105 Add missing includes & remove duplicates 2023-01-03 21:50:56 +01:00
Carl Smedstad e3257e646c Remove duplicate declarations 2023-01-03 21:50:56 +01:00
Simon Ser 9e15e2fd4f tree/container: drop unnecessary check in container_get_siblings()
The check for container->pending.workspace already covers this.

References: https://github.com/swaywm/sway/pull/7315#issuecomment-1341716204
2023-01-03 11:01:02 -07:00
Simon Ser 0c23b0ec33 man: fix typo in output disable docs 2023-01-03 10:59:02 -07:00
Simon Ser bd7466e1b7 swaynag: drop swaynag_type.font
It's too easy to have this go out of sync with font_description.
2022-12-22 17:42:33 +01:00
Simon Ser fd0af78e43 swaynag: fix NULL font description
The font description was only set if provided on the CLI. It was
left NULL for the defaults and when reading from the config file.

Closes: https://github.com/swaywm/sway/issues/7186
2022-12-22 17:42:33 +01:00
Kenny Levinsen 1ade0ce753 seat: Set keyboard if seat keyboard is NULL
sway sends wl_keyboard.enter on seat focus change and when a keyboard
active on a seat is configured. If all keyboards are removed and a
keyboard is added back without changing the focused client, no new
notify event would be sent despite having keyboard focus. This could
lead to key events without notify, which is a protocol violation.

As a quick fix, when configuring a keyboard on a seat where no keyboard
is currently active, activate the keyboard so that a focused surface
will receive a notify event.

Regressed by: e1b268af98
Closes: https://github.com/swaywm/sway/issues/7330
2022-12-19 10:02:58 +01:00
Ankit Pandey e3c63bf58d commands/move: Warp cursor after moving workspace to another output
This makes sway's behavior consistent with i3 when `mouse_warping` is
set to any value besides `none`.

Fixes #7027.
2022-12-19 00:31:09 -07:00
Baltazár Radics fbf9191fb8 Fix input command order (rotation_angle)
efd83cb8 added the rotation_angle command but it didn't insert it in
the proper place in the list, so the repeat_delay and repeat_rate
commands became unusable.
2022-12-09 22:36:33 +01:00
Lucas Zampieri efd83cb8b9 Add libinput RotationAngle
This patch adds the libinput option RotationAngle to sway.

Signoff-by: Lucas Zampieri <lzampier@redhat.com>
2022-12-09 11:28:53 +01:00
Ronan Pigott 991d75904f criteria: be lenient on window_role and instance too 2022-12-08 21:20:45 +01:00
Simon Ser de3e6a0da0 ci: install Xwayland .pc file
See https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3621
2022-12-08 21:17:10 +01:00
Aidan Dang c32a507303 Add primary_selection config option
See: https://github.com/swaywm/sway/issues/4511

Adds a bool config option `primary_selection`, which explicitly
enables/disables the primary selection clipboard. Defaults to enabled.

This is implemented as a launch-only option which enables or disables the creation of the
`zwp_primary_selection_device_manager_v1` global.

Co-authored-by: Tilde Rose <t1lde@protonmail.com>
2022-12-05 14:09:29 +01:00
Kenny Levinsen e1b268af98 seat: Avoid sending redundant keymaps on reload
When we reload the config, we reset every input device and re-apply
configuration from the config file. This means that the keyboard keymap
is updated at least once during config reload, more if the config file
contains keyboard configuration.

When they keyboard keymap changes and is updated through wlr_seat, the
keymap ends up sent to every keyboard bound in every client, seemingly
multiple times. On an x230 of mine with a keyboard layout set in the
config file, I see 42 keymap events sent to foot on config reload.

Reduce events from keyboard configurations by skipping all but the
currently active keyboard for the seat, and by clearing the active
keyboard during input manager device reset. After this change, I only
see a single just-in-time keymap event.

Fixes: https://github.com/swaywm/sway/issues/6654
2022-12-04 13:01:41 -07:00
Simon Zeni 6b3245ac77 sway/lock: handle mode in output commit handler 2022-12-01 23:27:22 +01:00
Simon Zeni aa03a8fcb5 sway/desktop/output: listen to output mode in commit handle 2022-12-01 23:27:22 +01:00
Simon Ser 3bd657c726 Chase breaking changes in wlroots!3903
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3903
2022-11-30 17:18:20 +01:00
AsciiWolf e1d457c824 Fix typo in Czech README translation 2022-11-30 14:43:43 +01:00
Simon Ser d41f11e6bd build: fix have_xwayland when xcb-icccm is not found
xcb-icccm is required to build Xwayland support.
2022-11-29 11:47:21 -05:00
Simon Ser a358d6760e build: move completions to separate file 2022-11-28 18:51:45 -05:00
nerdopolis dca0bb5749 Fix build on Debian Stable 2022-11-28 23:42:41 +01:00
Simon Ser f54d22ca2a build: remove trailing newline at end of file 2022-11-28 20:00:49 +01:00
Simon Ser e62299daa4 Make libinput backend optional 2022-11-28 13:28:15 -05:00
Simon Ser 46170580b2 Make session optional 2022-11-28 13:28:15 -05:00
Simon Ser e795ea6a0c Make DRM backend optional 2022-11-28 13:28:15 -05:00
Simon Ser 5b64e2fc31 Make GLES2 optional 2022-11-28 13:28:15 -05:00
AsciiWolf 456f49db35 Translate README to Czech 2022-11-28 11:26:06 +01:00
Simon Ser 81518e299c build: bump version to 1.9-dev 2022-11-26 23:25:54 +01:00
Simon Ser 37e4a3d637 build: drop unused wayland-egl dependency 2022-11-26 18:15:57 +01:00
Joan Bruguera 94b69acf0d swaybar: Make hotspots block bar release bindings
The previous commit prioritized hotspots before bar bindings for press events,
which matches i3's behaviour. However, since hotspots don't need to do any
processing on release events, those were not handled, and simply fell through
to `bindsym --release` bar bindings (if any).

This is counter-intuitive, and doesn't match i3's behaviour. Instead in case
a hotspot handles the press event, it should also handle the release event,
doing nothing, but blocking the event from triggering a --release bar binding.

E.g., in Sway, without this commit, this config. shows a text on tray clicks:

    bar {
        # ...
        bindsym --release button1 exec swaynag -m I_got_the_release_event.
    }

But the same configuration in i3 (with i3-nagbar) doesn't show the text.

Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2022-11-26 10:17:53 +01:00
Joan Bruguera 53f9dbd424 swaybar: Prioritize hotspot events to bar bindings
This is consistent with i3bar's behaviour, and for example, allows binding a
command to button1, while still being able to click on tray icons or other
zones on the bar's status line which may have their own bindings.

E.g., in Sway, without this commit, this config. makes tray icons unclickable:

    bar {
        # ...
        bindsym button1 exec swaynag -m You_clicked_the_tray._Want_some_help?
    }

But the same configuration in i3 (with i3-nagbar) keeps tray items clickable.

Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2022-11-26 10:17:53 +01:00
Ronan Pigott 28fda4c0d3 launcher: export X startup ids and use them for workspace matching 2022-11-26 09:48:58 +01:00
Ronan Pigott 30ad4dc4a5 launcher: export xdga tokens and use them for workspace matching 2022-11-26 09:48:58 +01:00
Ronan Pigott bdeb9f9565 launcher: fudge the interface a bit
We want to create a context before knowing the pid it will match with.
2022-11-26 09:48:58 +01:00
Ronan Pigott 66568508c0 launcher: initialize launcher_ctxs once on startup 2022-11-26 09:48:58 +01:00
Ronan Pigott 864b3a9a18 view: associate launch contexts with views
Views now maintain a reference to a launch context which, as a last
resort, is populated at map time with a context associated with its pid.
This opens the possibility of populating it before map via another
source, e.g. xdga-tokens or configuration.
2022-11-26 09:48:58 +01:00
Ronan Pigott d75c9f9722 launcher: rename pid_workspace to launcher_ctx
Soon we will match views with more than just a pid.
2022-11-26 09:48:58 +01:00
Ronan Pigott bd66f4943d launcher: use xdga tokens
This reuses wlroots token tracking for workspace matching. It doesn't
export any xdga tokens for clients yet.
2022-11-26 09:48:58 +01:00
Ronan Pigott 3b49f2782e launcher: track workspaces by node
This removes the need to rename the pid_workspaces when a workspace
is renamed.

It also opens the possibility of tracking other node types. Tracking
containers would allow application to be placed correctly in the
container tree even if the user has moved their focus elsewhere since
it was launched.
2022-11-26 09:48:58 +01:00
Ronan Pigott 1c4b94ae3c node: prettify node type names 2022-11-26 09:48:58 +01:00
Ronan Pigott eb5021ef99 root: move the workspace matching code to its own file
This removes the pid_workspace bits from tree/root before it gets
too interesting.

No functional change.
2022-11-26 09:48:58 +01:00
Simon Ser af8a5a8918 build: drop intermediate libraries for protocols 2022-11-25 10:51:20 +01:00
Simon Ser e5475d9310 build: drop "server" from target name for protocol code 2022-11-25 10:48:07 +01:00
Simon Ser 5be5a038da build: unify server & client protocol generation
No need to make a difference here, let's just generate header
files for both.
2022-11-25 10:46:53 +01:00
Simon Ser 366f6ef3d3 build: drop wayland-scanner fallback 2022-11-25 10:46:00 +01:00
Manuel Stoeckl e2bc8866f4 Use shm_open instead of mkstemp
shm_open is more reliable because it does not require
a writeable filesystem folder, unlike mkstemp.
2022-11-25 00:05:12 +01:00
Simon Ser 7623292734 Update for wlroots!3814
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3814
2022-11-15 22:26:43 +01:00
Simon Ser 717e9ef581 ipc: add view content type
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3599
2022-11-15 11:06:51 -05:00
Simon Ser 907ca48a61 Listen to the output request_state event
References: https://github.com/swaywm/wlroots/pull/2693
2022-11-15 11:05:47 -05:00
Simon Ser 024c3e4428 input/seat: locally compute drag icon offset
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3861
2022-11-15 16:58:20 +03:00
Simon Zeni e1be46875d sway/server: specify wlr-layer-shell version on creation 2022-11-14 16:10:55 +01:00
Kirill Primak 85005b52fe output: set damage ring bounds to pixel values
Fixes: https://github.com/swaywm/sway/issues/7254
2022-11-12 11:50:04 +01:00
Alexander Orzechowski 34933bb843 workspace_create: Don't allow NULL name 2022-11-11 23:44:03 +01:00
Joe Kappus fdde67405e build: bump wlroots dependency to 0.17.0 2022-11-11 22:31:18 +01:00
Baltazár Radics 5c239eaac5 container_get_siblings: handle NULL workspace 2022-11-11 18:57:29 +01:00
Simon Ser d945c8f519 lock: fix crash on output destroy
Closes: https://github.com/swaywm/sway/issues/7120
2022-11-11 17:01:50 +01:00
Kirill Primak 7862fa670e
Use wlr_damage_ring
wlr_output_damage is to be replaced with wlr_damage_ring, so use that.
2022-11-11 16:29:04 +01:00
Simon Ser dcd2076f38 Use wl_signal_emit_mutable()
This function fixes segfaults when emitting a signal potentially
removes arbitrary listeners.
2022-11-10 22:27:38 +03:00
Kirill Primak 6c3b35701d ci: install hwdata 2022-11-09 10:43:44 +01:00
Callum Andrew 3e19836f0e criteria: allow matching for NULL string criteria 2022-11-04 10:02:11 +01:00
Puck Meerburg e40eb338b9 criteria: allow matching on empty (NULL) titles 2022-10-30 10:57:19 +01:00
Puck Meerburg 0fdeb4ca84 tree: support formatting null titles
Any windows that have never had a title set visually behave closer to
that of an empty title, but are unformattable, as the code bails out
early on a NULL title.
2022-10-30 10:57:19 +01:00
pudiva chip líquida 7cc8ab6d6c Support libinput's 1.21 new dwtp option
Support the new dwtp (disable while trackpointing) option introduced in
libinput 1.21, allowing users to control whether the trackpoint (like
those in Thinkpads, but not only) should be disabled while using the
keyboard/touchpad.

See: https://gitlab.freedesktop.org/libinput/libinput/-/issues/731
2022-10-30 10:56:34 +01:00
Alexander Orzechowski a61815d385 container_floating_set_default_size: Store workspace size box on the stack 2022-10-29 00:47:01 +02:00
Daniel De Graaf 8aa89dc277 Fix focus tracking when session lock is active
Remove the incorrect attempt to block focus changes when an input grab
is present and replace it with the same logic used for layer_shell-based
screen lockers: restore the focus after changing it.

This fixes a use-after-free of seat->workspace if outputs are destroyed
while a screen lock is enabled.
2022-10-28 19:41:24 +02:00
Daniel De Graaf 8f7bb145b7 Rework session lock keyboard focus handling
When removing outputs, it is possible to end up in a situation where
none of the session lock client's surfaces have keyboard focus,
resulting in it not receiving keyboard events.  Track the focused
surface and update it as needed on surface destroy.
2022-10-28 19:41:24 +02:00
Yaroslav de la Peña Smirnov 9d99bb956f Fix keymap being NULL and segfaulting on dev add
Moved `libinput_config` to the callers of
`sway_input_configure_libinput_device` so that we send the event after
the added event.
2022-10-23 11:56:29 +02:00
Tudor Brindus 5e514e6474 input: tweak focus behavior to allow focusing parent containers
Sway focuses the inactive child when focusing split containers. However,
there is currently no way to focus the parent container itself by mouse.
A user must use the keyboard to do so.

This commit maintains the current behavior, but makes it such that a
second click on the split container titlebar (i.e., after its children
are visible) focuses the split container itself.
2022-10-21 10:05:00 +02:00
Simon Ser 9400bd963c Add support for ext-idle-notify-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3753
2022-10-14 15:56:07 +02:00
cparm 99fd096d69 Avoid double free in criteria_destroy() 2022-10-13 14:56:10 +02:00
Simon Ser 7a6afc5199 Fix leaks in criteria_destroy() 2022-10-10 09:51:01 -04:00
Tudor Brindus c7bced9329 input: focus container when scrolling on titlebar
Fixes #6503.
2022-10-10 08:56:51 +02:00
Tudor Brindus 09354db878 input: focus floating container when clicked on border
Fixes #7209.
2022-10-10 08:55:21 +02:00
Ferdinand Schober 99acdb4e62 Use keyboard_state.focused_surface directly 2022-10-09 10:07:51 +02:00
Ferdinand Schober be7707874a use seat directly 2022-10-09 10:07:51 +02:00
Ferdinand Schober e2bb5799af check for NULL 2022-10-09 10:07:51 +02:00
Ferdinand Schober d5659948f1 allow pointer_constraints on layer_shell surfaces 2022-10-09 10:07:51 +02:00
ohno418 07c827b4be Improve Japanese translation 2022-10-08 10:12:00 +02:00
Andri Yngvason b00b05f792 sway/commands/output: Add command for unplugging non-physical outputs 2022-10-07 19:17:39 +02:00
Simon Ser 04f8a655e7 build: simplify protocol paths
No need for arrays here.
2022-10-04 09:48:29 +02:00
Simon Ser 78b5c0a77e swaymsg: show mode picture aspect ratio 2022-10-03 13:35:52 +02:00
Simon Ser f70d1e1b95 ipc: expose mode picture aspect ratio 2022-10-03 13:35:52 +02:00
マリウス b0fc83485d man: Add XWayland information 2022-09-25 20:05:16 +02:00
Alex Maese cffb006feb swaymsg: show non-desktop property when pretty printing outputs 2022-09-19 07:26:45 -04:00
Alex Maese 52f0e3a4d5 sway: add non-desktop outputs to json when running swaymsg -t get_outputs 2022-09-19 07:26:45 -04:00
Alex Maese c015db4a9f sway: Add non-desktop-output type
Currently, when encountering a non-desktop display, sway offers the
output for leasing and returns without storing it in a sway specific
output type like `struct sway_output`.  Additionally, running
`swaymsg -t get_outputs` doesn't show non-desktop outputs.

This commit stores the non-desktop outputs into a struct called
`sway_output_non_desktop`, and adds them to a list on `sway_root`
2022-09-19 07:26:45 -04:00
Filip Szczepański 1c368fbb5f Fix crash in xdg_activation_v1.c
wlr_xdg_surface_from_wlr_surface() can return a NULL pointer, so check for NULL before dereferencing it.
2022-09-13 00:59:18 +03:00
Simon Ser 07bfeb2abc config/output: test adaptive sync
Required for [1].

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3637
2022-08-30 20:15:29 +02:00
Simon Ser aaa6c4ac89 ipc: drop WLR_OUTPUT_ADAPTIVE_SYNC_UNKNOWN case
This has been removed from wlroots.
2022-08-30 20:15:29 +02:00
Baltazár Radics 6e023257e8 man: sway(5) move fixes 2022-08-11 08:21:37 +02:00
Martin Michlmayr ebf441b359 sway-output.5: improve display of parameter
Since "width" and "height" are separate parameters, show them as such.
2022-08-08 08:03:27 +02:00
Simon Ser 89d73beedb Enable single-pixel-buffer-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3428
2022-08-04 18:44:58 +02:00
llyyr 9e879242fd grimshot: fix tilde expansion within quotes 2022-07-30 09:25:24 +02:00
Baltazár Radics a5a44ba95b ipc: make get_deco_rect check config->hide_lone_tab
Without this, the `IPC_GET_TREE` ipc call would return false information
about the container's `deco_rect` and `rect` properties if
`hide_edge_borders --i3` was in effect.
2022-07-26 12:06:10 +02:00
llyyr e98b97a45b swaymsg: fix floating_nodes being ignored
Fix floating_nodes being ignored in pretty_print_tree.
2022-07-26 10:56:50 +02:00
Kirill Primak 6b97c4fa71 input: chase delta_discrete semantics change 2022-07-15 14:14:41 -04:00
zkldi 8d8a21c9c3 fix: remove redundant empty statement in main.c
This semi-colon looks like a typo. Luckily, it has no effect on the code as it's treated as an empty statement leading the switch case.

Really straightforward nitpick change, was just something I was confused by when reading over the code.
2022-07-12 16:07:51 +02:00
Simon Ser b69d637f7a Remove internal references to DPMS
While at it, use an int for the config field, just like we do for
all other fields.
2022-07-04 21:58:24 +03:00
Simon Ser 798e3c8858 config.in: switch to output power 2022-07-04 21:58:24 +03:00
Simon Ser 11e05c5711 ipc: add "power" to output reply 2022-07-04 21:58:24 +03:00
Hugo Osvaldo Barrera 80e386fd97 Reuse parsed PangoFontDescription
Avoids parsing the configured font each time text is rendered.
2022-07-01 13:05:58 +02:00
Hugo Osvaldo Barrera 75605491a5 Reject font values that are invalid for pango
Use pango to parse font configuration early, and reject the command as
invalid if the value is invalid for pango. Since we're already parsing
the font into a `PangoFontDescription`, keep that instance around and
avoid re-parsing the font each time we render text.

Fixes: https://github.com/swaywm/sway/issues/6805
2022-07-01 13:05:58 +02:00
Hugo Osvaldo Barrera 9e8866ae20 Avoid unecessary string copy 2022-07-01 13:05:58 +02:00
Thomas Jost a55472c6d8 Strip quotes in bindsym --input-device=...
If the input device is quoted, which is common when using variables in the
config file, those quotes must be ignored here, or the input device will be
ignored.

Fixes #7029.
2022-06-25 11:27:49 +02:00
Simon Ser 445bc2a943 Rename dpms output command to power
The "dpms" command refers to VESA Display Power Management
Signaling, a deprecated standard. It's superseded by VESA DPM.

Instead of tying out command name to a particular standard, use the
neutral term "power".
2022-06-23 14:47:50 -04:00
Simon Ser 122d8ce954 Remove access to wlr_input_device union
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3626
Closes: https://github.com/swaywm/sway/issues/7077
2022-06-22 12:44:15 -04:00
kraftwerk28 49cef51e6e Allocate enough space for cmd_results->error 2022-06-16 09:32:44 +02:00
Simon Ser 1c69d0e72f config/output: use wlr_output_commit_state
This makes the code more robust because we don't potentially leave
bad state in wlr_output.pending behind anymore. This also fixes a
bug.

Closes: https://github.com/swaywm/sway/issues/7043
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3610
2022-06-10 11:35:30 +02:00
Greg Depoire--Ferrer 956b689d6a swaynag: move close_button up to fix SIGSEGV
When swaynag_parse_options encounters '--dismiss-button' (or its
shorthand '-s'), it sets the text of the first button in the
swaynag.buttons list, which is expected to exist and to be the dismiss
button, to the one passed by the user.

Commit 4780afb68b ("swaynag: statically
allocate button_close, and move declaration") moved the list
initialization to after swaynag_parse_options is called which made that
code fail.

For example, the command 'swaynag --dismiss-button Dismiss' crashes and
'swaynag --message Message --button Yes "" --dismiss-button Dismiss'
shows the wrong buttons.

Move it back to before swaynag_parse_options is called.
2022-06-05 19:05:26 +02:00
Kenny Levinsen e5728052b5 Refuse to start when SUID is detected
This ensures that those surprised by the deprecation of SUID operation
receive an error rather than accidentally having sway run as root.

This detection will be removed in a future release.
2022-06-03 12:37:40 +02:00
Simon Ser 251a648e2c ipc: remove chatty debug log messages
These aren't particularly useful, and clobber the debug logs.
2022-05-30 18:44:18 +02:00
Simon Ser a5c2e9fee0 build: link with -pthread
Fixes the following FreeBSD error:

    ld: error: undefined symbol: pthread_getschedparam
    >>> referenced by realtime.c:25 (../sway/realtime.c:25)
    >>>               sway/sway.p/realtime.c.o:(set_rr_scheduling)

Fixes: a3a82efbf6 ("realtime: request SCHED_RR using CAP_SYS_NICE")
2022-05-30 18:40:26 +02:00
Florian Franzen cab2189aa6 sway: add bindgesture command
Co-authored-by: Michael Weiser <michael.weiser@gmx.de>
2022-05-30 12:20:43 +02:00
LordRishav a535ed310f
Add a Hindi (हिन्दी) translation to the README
Hindi is one of the most prominent languages of the Indian Subcontinent.
This commit adds the translation of the README into the Hindi language.
Some of the words are still written in English because there wasn't an
appropriate technical term of the word in the language.

Co-authored-by: Surendrajat <surendrajat@protonmail.com>
2022-05-27 21:09:18 +02:00
Kirill Primak 6a59e38aeb xdg-shell: schedule a configure on maximize request
This commit reverts 03879290db and
fc84bcb7fb.
2022-05-27 15:49:57 +02:00
Kirill Primak 26a0e97634 chore: chase wlroots xdg-shell update 2022-05-27 15:42:22 +02:00
Simon Ser d0b9bf94a5 Handle NULL output make/model/serial 2022-05-26 15:42:56 -04:00
Simon Ser f0d57da315 De-duplicate IPC output descriptions 2022-05-26 15:42:56 -04:00
Hongyi 42b61ab27a
Polish the language in README.zh-CN.md & sync with English one
Co-Authored-By: Urey. Xue <urey.s.knowledge@gmail.com>
2022-05-24 07:40:47 +02:00
Daniel De Graaf 75b2d0b105 ext-session-lock: disable direct scan-out when locked 2022-05-23 08:15:51 +02:00
Rouven Czerwinski a3a82efbf6 realtime: request SCHED_RR using CAP_SYS_NICE
Try to gain SCHED_RR (round-robin) realtime scheduling privileges before
starting the server. This requires CAP_SYS_NICE on Linux systems.
We additionally register a pthread_atfork callback which resets the
scheduling class back to SCHED_OTHER (the Linux system default).

Due to CAP_SYS_NICE, setting RLIMIT_RTPRIO has no effect on the process
as documented within man 7 sched (from Linux):

  Privileged (CAP_SYS_NICE) threads ignore the RLIMIT_RTPRIO limit;
  as with older kernels, they can make arbitrary changes to
  scheduling policy and priority. See getrlimit(2) for further
  information on RLIMIT_RTPRIO

Note that this requires the sway distribution packagers to set the
CAP_SYS_NICE capability on the sway binary.

Supersedes #6992
2022-05-18 11:20:17 +02:00
Rouven Czerwinski 3f600565e4 server: request xdg-shell v2
Wlroots does not yet support the newer xdg-shell versions and now
requires the compositor to set the supported xdg-shell version during
creation. Set this to v2 for sway as well.

Fixes https://github.com/swaywm/sway/issues/7001
2022-05-16 11:20:39 -04:00
-k ffc603d451 man: Fix trailing spaces 2022-05-11 19:55:51 +02:00
-k 28941cee20 Add descriptions for stacking and tabbed layouts
Resolves #5918
2022-05-11 19:07:54 +02:00
Simon Ser 1e9be019b2 Replace strncpy with memcpy
strncpy is useless here, is dangerous because it doesn't guarantee
that the string is NUL-terminated and causes the following warning:

    ../sway/criteria.c: In function ‘criteria_parse’:
    ../sway/criteria.c:712:25: error: ‘strncpy’ destination unchanged after copying no bytes [-Werror=stringop-truncation]
      712 |                         strncpy(value, valuestart, head - valuestart);
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-05-11 11:47:49 -04:00
Michael Weiser 7cfa150788 config: Remove unused mouse binding structure
Mouse bindings are handled alongside normal bindings. Remove the unused
separate data structure definition to avoid confusion.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2022-05-11 10:19:27 +02:00
Nihal Jere c85d9af2b6 swaynag: combine consecutive declaration/assignments 2022-05-07 15:57:18 +02:00
Nihal Jere e8028be839 swaynag: improve robustness when loading config 2022-05-07 15:57:18 +02:00
Nihal Jere 5d924f2b12 swaynag: do error checking and rename read_from_stdin
read_from_stdin not only read from stdin, but trimming trailing
newlines, so rename it to reflect this.
2022-05-07 15:57:18 +02:00
Daniel De Graaf a7898637de Avoid inspecting a NULL view in seat_set_focus
Fixes #6968
2022-04-30 00:36:44 +02:00
Daniel De Graaf 519038a7e9 Implement ext-session-lock-v1 2022-04-29 09:06:36 +02:00
Victor Makarov 70d30ac72b
xkb_switch_layout: fix relative layout switches
Fixes #6011
2022-04-28 13:20:44 +02:00
Alan 3caf6914fe Update grimshot.1.scd
Fixed typo. The object is **files**, which is plural. **image** modifies files; it's not countable.
2022-04-23 22:34:11 +02:00
Alice Carroll a5f01a0e04 Support cursor capture in grimshot
Refactor argument parser

Bring back `sh` compatibility

Default to NOTIFY=no
2022-04-21 10:41:48 +02:00
Eskil 2dace6b824
Add Swedish README 2022-04-18 18:51:45 +02:00
kraftwerk28 acdb48a59c Chase wlroots X11 hints update 2022-04-18 08:57:16 +02:00
Thomas Hebb d726e50643 layer_shell: keep output non-NULL wherever possible
Our layer shell implementation assigns every layer surface to an output
on creation. It tracks this output using the output field on the
underlying wlr_layer_surface_v1 structure. As such, much of the existing
code assumes that output is always non-NULL and omits NULL checks
accordingly.

However, there are currently two cases where we destroy a
sway_layer_surface and output is NULL. The first is when we can't find
an output to assign the surface to and destroy it immediately after
creation. The second is when we destroy a surface in response to its
output getting destroyed, as we set output to NULL in
handle_output_destroy() before we call wlr_layer_surface_v1_destroy(),
which is what calls the appropriate unmap and destroy callbacks.

The former case doesn't cause any problems, since we haven't even
allocated a sway_layer_surface at that point or registered any
callbacks. The latter case, however, currently triggers a crash (#6120)
if a popup is visible, since our popup_handle_unmap() implementation
can't handle a NULL output.

To fix this issue, keep output set until right before we free the
sway_layer_surface. All we need to do is remove some of the cleanup
logic from handle_output_destroy(), since as of commit c9060bcc12
("layer-shell: replace close() with destroy()") that same logic is
guaranteed to be happen later when wlroots calls handle_destroy() as
part of wlr_layer_surface_v1_destroy().

This lets us remove some NULL checks from other unmap/destroy callbacks,
which is nice. We also don't need to check that the wlr_output points to
a valid sway_output anymore, since we unset that pointer after disabling
the output as of commit a0bbe67076 ("Address emersions comments on
output re-enabling") Just to be safe, I've added assertions that the
wlr_output is non-NULL wherever we use it.

Fixes #6120.
2022-04-13 10:05:24 +02:00
Daniel De Graaf cf413b9c0b Shuffle variables to satisfy -Werror=restrict
This also fixes an invalid strlen invocation on uninitialized memory.
2022-04-09 18:27:57 +02:00
Daniel De Graaf 20181974c2 Avoid format-truncation warning
The existing code gives this error when compiled with GCC 12:

../sway/server.c: In function ‘server_init’:
../sway/server.c:217:75: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 8 [-Werror=format-truncation=]
  217 |                 snprintf(name_candidate, sizeof(name_candidate), "wayland-%d", i);
      |                                                                           ^~
../sway/server.c:217:66: note: directive argument in the range [-2147483647, 32]
  217 |                 snprintf(name_candidate, sizeof(name_candidate), "wayland-%d", i);
      |                                                                  ^~~~~~~~~~~~
../sway/server.c:217:17: note: ‘snprintf’ output between 10 and 20 bytes into a destination of size 16
  217 |                 snprintf(name_candidate, sizeof(name_candidate), "wayland-%d", i);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Because i is never negative, this is a false positive, but it is easy to
change i to unsigned to silence the error.
2022-04-09 18:27:57 +02:00
Yasin Silavi 09553a7b5b Fix farsi label 2022-04-07 19:36:46 +02:00
Manuel Stoeckl 8f036b6f78 sway/main: move constants off the stack
This makes stack traces from gdb slightly easier to read.
2022-03-29 08:42:17 +02:00
Oğuz Ersen fb3330c1fb bash-completion: localize variables 2022-03-27 11:27:57 +02:00
Leonardo Hernández Hernández 6c4c0387a2 sway/input: wlr_seat_keyboard() now takes wlr_keyboard 2022-03-23 18:09:54 +01:00
Leonardo Hernández Hernández ca016689a0 sway/input: fix bad position of wlr_drag 2022-03-22 09:00:28 +01:00
Simon Zeni 440d0bc22d sway/input: follow up wlroots input device events renaming 2022-03-17 21:52:59 +03:00
Simon Zeni 49b3ac9a2c sway/input/seat: take output name from specialized input device 2022-03-17 21:52:59 +03:00
Simon Zeni 0345148ea6 sway/input/cursor: take device mm size from wlr_tablet 2022-03-17 21:52:59 +03:00
Nihal Jere 1e79088a72 remove unnecessary strlen call 2022-03-15 11:40:32 +01:00
Nihal Jere 78758ef369 swaynag: remove redundant status variables in main
Instead, we just use `status` for all failures.
2022-03-15 11:40:32 +01:00
Nihal Jere 20729a6a5e swaynag: remove unnecessary zero of swaynag struct
Global variables are initialized to 0.
2022-03-15 11:40:32 +01:00
Nihal Jere 4780afb68b swaynag: statically allocate button_close, and move declaration
Every swaynag has a close button, so it doesn't make sense to
allocate it dynamically. The declaration is moved later to when
it is actually needed.
2022-03-15 11:40:32 +01:00
Nihal Jere 0babfce4b5 swaynag: allocate button_details with details
They are used together, so it doesn't make sense to allocate them
separately.
2022-03-15 11:40:32 +01:00
Bill Li f167acce3a Updating criteria checking with PCRE2 2022-03-15 11:28:04 +01:00
Simon Ser 3dffe7f3a6 swaybar: set opaque region
When the background color is fully opaque, set the surface's opaque
region to the whole surface.
2022-03-14 13:02:17 -04:00
Simon Ser dd8b6f5e68 swaybar: remove swaybar_output.input_region
No need to keep the region around, we can immediately destroy it
after the wl_surface.set_input_region request.
2022-03-14 13:01:29 -04:00
ndren f614f35e73
Replace pcre with pcre2
Closes: https://github.com/swaywm/sway/issues/6838
2022-03-12 14:02:32 +01:00
Simon Ser 04676936e7 Remove WLR_SWITCH_STATE_TOGGLE usage
Ref [1].

[1]: 4792446ee8
2022-03-08 13:24:11 -05:00
Nicolas Avrutin 9f98c38d3e commands/focus: fix segfault when no container is already focused.
Fixes #6690.
2022-03-06 18:24:16 -07:00
Moon Sungjoon 3444ce7302 sway/input: destroy sway_switch properly
Fix: #6861
Added seat_device_destroy function to seat_device_destroy function.
2022-03-05 20:39:47 +01:00
Alexander Gramiak d6f279902a sway/input: don't pass possibly invalid modifiers pointer
active_keyboard may be NULL, in which case an invalid pointer could be
passed to wlr_input_method_keyboard_grab_v2_send_modifiers. This
procedure call is unnecessary since wlroots commit 372a52ec "input
method: send modifiers in set_keyboard", so the call can simply be
removed.

Fixes #6836.
2022-03-04 08:37:07 +01:00
Nihal Jere 061ffc30ea swaynag: die on all allocation failures 2022-02-28 11:24:13 -05:00
Thomas Hebb 0ee54a5243 Don't enter seatop_move_floating when fullscreen
Currently, a floating window that's been fullscreened can send us
xdg_toplevel::move, and we'll enter seatop_move_floating, which lets us
drag the surface around while it's fullscreen. We don't want
this--fullscreen surfaces should always be aligned to the screen--so add
the same check that seatop_default already does when entering this mode.

Tested with Weston's weston-fullscreen demo, which sends a move request
if you click anywhere on its surface.
2022-02-24 12:12:12 +01:00
Thomas Hebb b38b845c63 Remove some erroneous apostrophes in comments 2022-02-22 09:50:58 +01:00
Simon Zeni 85d1c98476 sway/input: use wlr_input_device from input device base 2022-02-21 20:25:47 +03:00
Simon Zeni f8990523b4 sway/commands: add missing wlr_keyboard interface include in xkb_switch_layout 2022-02-21 20:25:47 +03:00
Simon Ser f707f583e1 Remove all sprintf calls
Replace them with snprintf, which ensures buffer overflows won't
happen.
2022-02-08 09:20:13 -05:00
Muhamed Hobi ac7892371c Fix snprintf compiler warning 2022-02-08 09:43:32 +01:00
Simon Ser 9a6687ee04 xdg-shell: use wlr_xdg_popup in sway_xdg_popup
Improved type safety.
2022-02-07 23:22:16 +03:00
Simon Ser f795aa1c95 xdg-shell: use wlr_xdg_toplevel in sway_view
Improved type safety.

Closes: https://github.com/swaywm/sway/issues/6813
2022-02-07 23:22:16 +03:00
Simon Ser 5c00f1f113 readme: use relative links for translations 2022-02-07 11:04:47 +01:00
Simon Ser 01706f7c90 readme: sort language list alphabetically 2022-02-07 11:03:03 +01:00
Simon Ser c256fd4743 readme: add link to Italian translation 2022-02-07 10:56:31 +01:00
Marco Rubin 3a75b4a6a8 Translated README into Italian 2022-02-07 10:55:55 +01:00
Alexander Browne 36f5467993 Minor update to focus_on_window_activation
Removed xwayland limitation since wayland clients are supported via xdg-activation.
2022-02-06 09:11:06 +01:00
Kirill Primak 30d27b5996 Chase wlroots xdg-shell refactor 2022-02-03 21:01:28 +01:00
Kirill Primak ee7668c1f2 chore: chase wlr_output_layout_get_box() update
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3439
2022-01-31 11:44:03 +01:00
Tuomas Yrjölä 69b430201c xwayland: listen to request_activate event
When REAPER submenu is closed `XCB_CLIENT_MESSAGE` with type
`NET_ACTIVE_WINDOW` is sent to set focus to parent menu.

Closes: https://github.com/swaywm/sway/issues/6324
2022-01-31 11:23:36 +01:00
Simon Ser 518e18a54b Use bools for CLI flags 2022-01-31 11:04:26 +01:00
Kirill Primak cd1ee0e172 swaynag: remove buffer destruction condition
An address of a variable can never be NULL, so checking it doesn't make
sense; and `destroy_buffer()` can operate on already destroyed buffers
anyway.

Fixes #6780
2022-01-23 10:41:57 -05:00
Tudor Brindus 8ca2847b42 input/cursor: pass through pointer hold gestures
This just follows swaywm/wlroots#3047, so `wl_pointer_gestures_v1`
clients can be notified of these events.
2022-01-22 23:43:46 +01:00
Ronan Pigott feea4b4410 cmd/swap: error on swapping a container with itself 2022-01-22 19:08:15 +01:00
Tobias Bengfort b4fd4bca0e tray: do not render passive items
https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem/#org.freedesktop.statusnotifieritem.status
2022-01-19 09:20:27 +01:00
Simon Ser a1905c6a08 build: execute wlroots subproject before finding deps
wlroots often requires dependencies more recent than Sway's.
Executing the wlroots subproject first will give Meson a chance to
find these newer dependencies, possibly via subprojects.

The subproject will override the "wlroots" dependency when executed,
so we don't need to use get_variable anymore.

References: https://github.com/swaywm/sway/pull/6498#issuecomment-1001746017
2022-01-18 13:57:50 -05:00
Rouven Czerwinski e4909ab4a3 transaction: destroying nodes aren't hidden
Commit 37d7bc6998 ("transaction: Only wait for ack from visible
views") introduced a check which uses view_is_visible() to check if a view
is still visible on the screen. However view_is_visible() will early
return in case the node is in the destroying state. This is incorrect
for transactions, since a destroying view which is visible will trigger
configure events for other clients. This bug was visible when repeatedly
opening and closing two views side by side, since we ignore the
destroying node we get a frame where the still open view is shown with
the old configure values and the rest is the desktop background. The
next frame is than correct again.

Fix this by considering destroying views as visible, we correctly wait
for them and send the configure events to other views in time, fixing
the background flicker.

Fixes #6473
2022-01-18 19:42:15 +01:00
Patrick Hilhorst b2ee964434 treat fullscreen windows as 'tiled' for commands/focus 2022-01-18 13:25:53 +01:00
Tudor Brindus 7d1ccafae5 input/cursor: treat swipe begin as idle activity too
Accidentally overlooked in fd53f80.
2022-01-17 23:17:36 +01:00
Tudor Brindus fd53f80156 input/cursor: count pointer gestures as idle activity
Fixes https://github.com/swaywm/sway/issues/6765.
2022-01-17 23:05:19 +01:00
Simon Ser 0ffd8178fe commands/focus: drop trailing whitespace 2022-01-16 19:15:57 +01:00
Simon Ser d6f8820a8b Upgrade for wlroots surface refactoring
See [1] for details.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3412
2022-01-13 14:01:37 +03:00
Kirill Chibisov dbaf2e4fdb build: fix building with basu
02b412a introduced the use of list for sdbus deps, however
it was assuming that all packages which were in a list has a version
higher than 239. That is true for libsystemd and libelogind, since they
use the same versions, however basu is using version numbers which are
way lower than what libsystemd/libelogind are using, so basu only build
is failing.
2022-01-12 17:25:34 +01:00
Aleksei Bavshin aa443629b5 xdg-shell: use toplevel geometry to adjust the popup box
`popup_unconstrain` uses view coordinates to init the output box for
popups. However wlroots expects the box to be set in a toplevel surface
coordinate system, which is not always equal to view. The difference
between those is a window geometry set via xdg-shell.

GTK4 reserves some space for client-side decoration and thus has a
window with top left corner not matching to (0, 0) of a surface. The box
calculated without taking that into account was slightly shifted
compared to the actual output and allowed to position part of the popup
off screen.
2022-01-12 14:55:56 +01:00
Kenny Levinsen e1db1f8218 Print deprecation notice when running SUID
SUID privilege drop is needed for the "builtin"-backend of libseat,
which copied our old "direct" backend behavior for the sake of
compatibility and ease of transition.

libseat now has a better alternative in the form of seatd-launch. It
uses the normal seatd daemon and libseat backend and takes care of SUID
for us.

Add a soft deprecation warning to highlight our future intent of
removing this code. The deprecation cycle is needed to avoid surprises
when sway no longer drops privileges.
2022-01-11 12:05:55 +01:00
Kenny Levinsen 470e04e8da meson: check: false on run_command
Future meson releases will change the default and warns when the
implicit default is used, breaking builds.

Explicitly set check: false to maintain behavior and silence warnings.
2022-01-11 11:51:49 +01:00
Simon Ser 6cb69a40c7 Add safety assert in parse_movement_unit
Let's add this just in case a caller passes argc == 0.

References: https://github.com/swaywm/sway/issues/6737#issuecomment-1008082540
2022-01-09 10:17:02 +01:00
Simon Ser e2b4c573d6 Destroy sub-surfaces with parent layer-shell surface
Closes: https://github.com/swaywm/sway/issues/6337
2022-01-08 19:07:27 -07:00
David96 1bf1d84b75 commands/move: Fix crash when pos_y is omitted
Fixes #6737
2022-01-09 00:58:42 +01:00
David Rosca f92329701b container: Fix crash when view unmaps + maps quickly
Followup on 4e4898e90f.

If a view quickly maps and unmaps repeatedly, there will be multiple
destroyed containers with same view in a single transaction. Each of
these containers will then try to destroy this view, resulting in use
after free.
The container should only destroy the view if the view still belongs
to the container.

Simple reproducer: couple XMapWindow + XUnmapWindow in a loop followed
by XDestroyWindow.

See #6605
2022-01-07 18:25:13 +01:00
Nathan Schulte 107d15fafd swaybar: fix tray item icon scaling, positioning 2022-01-07 15:06:29 +01:00
Nathan Schulte bb60381c75 swaybar: fix tray_padding vs min-height re: scale
Co-authored-by: xdavidwu <xdavidwuph@gmail.com>
2022-01-07 15:06:29 +01:00
Thomas Hebb 921b0a8633 input/seat: unset has_focus when focus_stack becomes empty
We currently track the focus of a seat in two ways: we use a list called
focus_stack to track the order in which nodes have been focused, with
the first node representing what's currently focused, and we use a
variable called has_focus to indicate whether anything has focus--i.e.
whether we should actually treat that first node as focused at any given
time.

In a number of places, we treat has_focus as implying that a focused
node exists. If it's true, we attempt to dereference the return value of
seat_get_focus(), our helper function for getting the first node in
focus_list, with no further checks. But this isn't quite correct with
the current implementation of seat_get_focus(): not only does it return
NULL when has_focus is false, it also returns NULL when focus_stack
contains no items.

In most cases, focus_stack never becomes empty and so this doesn't
matter at all. Since focus_stack stores a history of focused nodes, we
rarely remove nodes from it. The exception to this is when a node itself
goes away. In that case, we call seat_node_destroy() to remove it from
focus_stack and free it. But we don't unset has_focus if we've removed
the final node! This lets us get into a state where has_focus is true
but seat_get_focus() returns NULL, leading to a segfault when we try to
dereference it.

Fix the issue both by updating has_focus in seat_node_destroy() and by
adding an assertion in seat_get_focus() that ensures focus_stack and
has_focus are in sync, which will make it easier to track down similar
issues in the future.

Fixes #6395.

[1] There's some discussion in #1585 from when this was implemented
about whether has_focus is actually necessary; it's possible we could
remove it entirely, but for the moment this is the architecture we have.
2022-01-07 14:08:24 +01:00
Seth Barberee b8995ced8f [IPC] Add repeat delay/rate info to keyboard
Closes #6735

wlroots already has the info in the struct so let's access it and print it out.
2022-01-04 10:55:05 +01:00
Simon Ser eaeb173a4b build: bump version to 1.8-dev
Historically we've been sticking with the last release number in
the master branch. However that's a bit confusing, people can't
easily figure out whether they're using a release or a work-in-progress
snapshot. Only the commit hash appended to the version number may
help, but that's not very explicit and disappears when using a
tarball.

We could bump the version in master to the next release number.
However during the RC cycle there would be a downgrade from 1.8 to
1.8-rc1. Also it would be hard to tell the difference between a
stable release and an old snapshot.

This patch introduces a new pre-release identifier, "dev". It's
alphabetically before "rc" so it should be correctly sorted by
semver comparisons. "dev" is upgraded to "rc" (and then to stable)
when doing a release. The master branch always uses a "dev"
version, only release branches use "rc" or stable versions.
2021-12-23 19:08:59 +01:00
Simon Ser 59aebaa5f9 Add cairo_image_surface_create error handling
cairo_image_surface_create can fail, e.g. when running out of
memory or when the size is too big. Avoid crashing in this case.

Closes: https://github.com/swaywm/sway/issues/6531
2021-12-21 14:52:08 -07:00
Simon Ser 414950bbc8 swaybar: fix errno handling in status_handle_readable
If getline fails once, it was not reset before the next getline
call. errno is only overwritten by getline on error.
2021-12-21 12:12:54 +01:00
Simon Ser 513fa00a5e swaymsg: add GET_TREE pretty-printing 2021-12-21 11:07:11 +01:00
Simon Ser d9ce781d4c swaymsg: replace if with switch in pretty_print 2021-12-21 11:07:11 +01:00
Sefa Eyeoglu 17ee30d070 build: bump wlroots dependency to 0.16.0 2021-12-19 12:17:13 +01:00
Ronan Pigott 9ecbfe3665 output: emit node::destroy event
Now output_begin_destroy emits the node::destroy event similar to
workspace_begin_destroy. It currently has no listeners, since they
listen to output::disable or wlr_output::destroy instead.
2021-12-17 14:39:48 +01:00
Ronan Pigott ebfe432ec3 output: change output::destroy to output::disable
This changes output::destroy to output::disable and emits it only
once when an output is disabled, instead of twice in succession.
2021-12-17 14:39:48 +01:00
RoastVeg f2b6d1ec29 Handle border width and height on minimum floating sizes
This fixes: https://github.com/swaywm/sway/issues/5337

Co-authored-by: Moon Sungjoon <sumoon@seoulsaram.org>
2021-12-14 10:30:10 +01:00
Cole Mickens 0b4e3d39eb meson.build: require wayland-protocols 1.24
As far as I can tell `ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT` is introduced in wayland-protocols 1.24.
2021-12-14 10:00:15 +01:00
Simon Ser 57a7b3998e swaynag: remove xdg-output logic
We can just get the output name from wl_output directly, now that
wl_output version 4 exists.
2021-12-13 20:17:20 -06:00
Simon Ser 4732325f59 Add support for linux-dmabuf surface hints
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/1376
2021-12-13 09:59:33 -06:00
Alexander Orzechowski 8a3026337f view: Fix null dereference
There seems to be a null pointer access that can happen. I was able to
reproduce this by running the cemu emulator[1] with the new collabora
wine wayland driver[2] and opening and closing some sub menus.

Adding a trival null check seems to do the trick to stop sway from
crashing and returning to tty and everything else works normally.

[1]: http://cemu.info/
[2]: https://www.winehq.org/pipermail/wine-devel/2021-December/203035.html

Stack trace from lldb:

* thread #1, name = 'sway', stop reason = signal SIGSEGV: invalid address (fault address: 0xf8)
    frame #0: 0x00005555555c3fc3 sway`view_child_init(child=0x0000555555f67940, impl=0x00005555555ee030, view=0x00005555565bc590, surface=0x00005555565b6940) at view.c:1117:25
   1114		wl_signal_add(&view->events.unmap, &child->view_unmap);
   1115		child->view_unmap.notify = view_child_handle_view_unmap;
   1116	
-> 1117		struct sway_workspace *workspace = child->view->container->pending.workspace;
   1118		if (workspace) {
   1119			wlr_surface_send_enter(child->surface, workspace->output->wlr_output);
   1120		}
(lldb) up
error: sway {0x000342ab}: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x67) attribute, but range extraction failed (invalid range list offset 0x67), please file a bug and attach the file at the start of this error message
frame #1: 0x00005555555c39f8 sway`view_child_subsurface_create(child=0x00005555564a10d0, wlr_subsurface=0x0000555556586910) at view.c:985:2
   982 		}
   983 		subsurface->child.parent = child;
   984 		wl_list_insert(&child->children, &subsurface->child.link);
-> 985 		view_child_init(&subsurface->child, &subsurface_impl, child->view,
   986 			wlr_subsurface->surface);
   987 	
   988 		wl_signal_add(&wlr_subsurface->events.destroy, &subsurface->destroy);
(lldb) up
frame #2: 0x00005555555c3c2a sway`view_child_handle_surface_new_subsurface(listener=0x00005555564a1130, data=0x0000555556586910) at view.c:1031:2
   1028		struct sway_view_child *child =
   1029			wl_container_of(listener, child, surface_new_subsurface);
   1030		struct wlr_subsurface *subsurface = data;
-> 1031		view_child_subsurface_create(child, subsurface);
   1032	}
   1033	
   1034	static void view_child_handle_surface_destroy(struct wl_listener *listener,
(lldb) up
frame #3: 0x00007ffff78f4bfe libwlroots.so.10`wlr_signal_emit_safe(signal=0x00005555565b2470, data=0x0000555556586910) at signal.c:29:3
   26  			wl_list_remove(&cursor.link);
   27  			wl_list_insert(pos, &cursor.link);
   28  	
-> 29  			l->notify(l, data);
   30  		}
   31  	
   32  		wl_list_remove(&cursor.link);
(lldb) up
frame #4: 0x00007ffff78e5a41 libwlroots.so.10`subsurface_parent_commit(subsurface=0x0000555556586910) at wlr_surface.c:517:3
   514 	
   515 		if (!subsurface->added) {
   516 			subsurface->added = true;
-> 517 			wlr_signal_emit_safe(&subsurface->parent->events.new_subsurface,
   518 				subsurface);
   519 		}
   520 	}
(lldb) up
frame #5: 0x00007ffff78e56fa libwlroots.so.10`surface_commit_state(surface=0x00005555565b21b0, next=0x00005555565b2338) at wlr_surface.c:439:3
   436 			wl_list_insert(&surface->current.subsurfaces_above,
   437 				&subsurface->current.link);
   438 	
-> 439 			subsurface_parent_commit(subsurface);
   440 		}
   441 		wl_list_for_each_reverse(subsurface, &surface->pending.subsurfaces_below,
   442 				pending.link) {
(lldb) up
frame #6: 0x00007ffff78e5b88 libwlroots.so.10`surface_handle_commit(client=0x0000555556564c80, resource=0x0000555556599a20) at wlr_surface.c:555:3
   552 		if (surface->pending.cached_state_locks > 0 || !wl_list_empty(&surface->cached)) {
   553 			surface_cache_pending(surface);
   554 		} else {
-> 555 			surface_commit_state(surface, &surface->pending);
   556 		}
   557 	}
   558 	
(lldb) up
frame #7: 0x00007ffff7000d4a libffi.so.8`___lldb_unnamed_symbol118 + 82
libffi.so.8`___lldb_unnamed_symbol118:
->  0x7ffff7000d4a <+82>: leaq   0x18(%rbp), %rsp
    0x7ffff7000d4e <+86>: movq   (%rbp), %rcx
    0x7ffff7000d52 <+90>: movq   0x8(%rbp), %rdi
    0x7ffff7000d56 <+94>: movq   0x10(%rbp), %rbp
(lldb) up
frame #8: 0x00007ffff7000267 libffi.so.8`___lldb_unnamed_symbol115 + 439
libffi.so.8`___lldb_unnamed_symbol115:
->  0x7ffff7000267 <+439>: movq   -0x38(%rbp), %rax
    0x7ffff700026b <+443>: subq   %fs:0x28, %rax
    0x7ffff7000274 <+452>: jne    0x7ffff70004e7            ; <+1079>
    0x7ffff700027a <+458>: leaq   -0x28(%rbp), %rsp
(lldb) up
frame #9: 0x00007ffff795a173 libwayland-server.so.0`___lldb_unnamed_symbol271 + 371
libwayland-server.so.0`___lldb_unnamed_symbol271:
->  0x7ffff795a173 <+371>: movq   0x8(%r12), %rax
    0x7ffff795a178 <+376>: movq   0x8(%rax), %rdi
    0x7ffff795a17c <+380>: movl   (%r12), %eax
    0x7ffff795a180 <+384>: testl  %eax, %eax
(lldb) up
frame #10: 0x00007ffff795555c libwayland-server.so.0`___lldb_unnamed_symbol210 + 588
libwayland-server.so.0`___lldb_unnamed_symbol210:
->  0x7ffff795555c <+588>: jmp    0x7ffff7955435            ; <+293>
    0x7ffff7955561 <+593>: nopl   (%rax)
    0x7ffff7955568 <+600>: callq  *0xd76a(%rip)
    0x7ffff795556e <+606>: cmpl   $0xb, (%rax)
(lldb) up
frame #11: 0x00007ffff795804a libwayland-server.so.0`wl_event_loop_dispatch + 202
libwayland-server.so.0`wl_event_loop_dispatch:
->  0x7ffff795804a <+202>: addq   $0xc, %r15
    0x7ffff795804e <+206>: cmpq   %r15, %rbp
    0x7ffff7958051 <+209>: jne    0x7ffff7958038            ; <+184>
    0x7ffff7958053 <+211>: movq   0x8(%rsp), %rcx1
(lldb) up
frame #12: 0x00007ffff7955bc7 libwayland-server.so.0`wl_display_run + 39
libwayland-server.so.0`wl_display_run:
->  0x7ffff7955bc7 <+39>: movl   0x8(%rbx), %eax
    0x7ffff7955bca <+42>: testl  %eax, %eax
    0x7ffff7955bcc <+44>: jne    0x7ffff7955bb0            ; <+16>
    0x7ffff7955bce <+46>: popq   %rbx
(lldb) up
frame #13: 0x00005555555756eb sway`server_run(server=0x00005555555f0640) at server.c:296:2
   293 	void server_run(struct sway_server *server) {
   294 		sway_log(SWAY_INFO, "Running compositor on wayland display '%s'",
   295 				server->socket);
-> 296 		wl_display_run(server->wl_display);
   297 	}
(lldb) up
frame #14: 0x0000555555574947 sway`main(argc=1, argv=0x00007fffffffe8d8) at main.c:428:2
   425 			swaynag_show(&config->swaynag_config_errors);
   426 		}
   427 	
-> 428 		server_run(&server);
   429 	
   430 	shutdown:
   431 		sway_log(SWAY_INFO, "Shutting down sway");
(lldb) up
frame #15: 0x00007ffff761db25 libc.so.6`__libc_start_main + 213
libc.so.6`__libc_start_main:
->  0x7ffff761db25 <+213>: movl   %eax, %edi
    0x7ffff761db27 <+215>: callq  0x7ffff7635630            ; exit
    0x7ffff761db2c <+220>: movq   (%rsp), %rax
    0x7ffff761db30 <+224>: leaq   0x163929(%rip), %rdi
(lldb) up
frame #16: 0x00005555555656be sway`_start + 46
sway`_start:
->  0x5555555656be <+46>: hlt    
    0x5555555656bf:       nop    
sway`deregister_tm_clones:
    0x5555555656c0 <+0>:  leaq   0x8aeb9(%rip), %rdi       ; optind@GLIBC_2.2.5
    0x5555555656c7 <+7>:  leaq   0x8aeb2(%rip), %rax       ; optind@GLIBC_2.2.5

Signed-off-by: Alexander Orzechowski <orzechowski.alexander@gmail.com>
2021-12-13 14:51:13 +01:00
Vsevolod f7725011ef
Add focused_tab_title 2021-12-10 16:09:29 +01:00
Simon Ser 3f58f12617 Fixup headless output names
We use the headless backend to create a special fallback output
used when no other output is connected. However this messes up the
"real" headless output names users have come to expect (e.g.
currently the first headless output will be named "HEADLESS-2"
instead of "HEADLESS-1").

Fix this by setting the output name with [1].

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3395
2021-12-09 10:47:01 -06:00
M.Zeinali 1eaa61f503
readme: use right-to-left marks in ir translation 2021-12-07 15:26:57 +01:00
Kirill Primak 03a29ed36d output: remove surface buffer damage check
A surface can have effective damage even without any buffer damage
committed.
2021-12-06 16:44:34 +01:00
Simon Ser b518b1295c Delete .clang-format
This file isn't accurate, and clang-format can't describe our code
style.

References: https://github.com/swaywm/sway/pull/6249#issuecomment-986214042
2021-12-06 08:27:11 -06:00
Simon Ser 02b412a3d4 build: use list for sdbus dep
This allows to simplify our logic. Meson will pick the first found
library.
2021-11-26 12:10:18 -06:00
Simon Zeni 0cd8efe0bb sway: replace noop_output by fallback_output
wlroots removed the support for the noop backend. Instead we rely on the
headless backend to provide the fallback output.
2021-11-25 17:48:34 +01:00
Simon Ser 729e18bff5 Replace wlr_headless_backend_create_with_renderer call
Update for the wlroots breaking change in [1].

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3367
2021-11-25 09:39:06 -06:00
Ludvig Michaelsson f627cd77d6 swaybar: signal status command's process group
Make the status command a process group leader and change the kill(2)
calls to target the new process group. Signals sent by swaybar will then
be received by both the status command and its children, if any. While
here, check the result of fork(2).

Without this, children spawned by the status command may not receive the
signals sent by swaybar. As a result, these children may be orphaned on
reload.

The issue could be shown by setting the bar to

    bar {
        status_command i3status | tee /tmp/i3status.out
    }

which would leave orphaned processes for each reload of sway

    $ ps o pid,ppid,cmd | grep i3status | grep -v grep
    43633   43624 sh -c i3status | tee /tmp/i3status.out
    43634   43633 i3status
    43635   43633 tee /tmp/i3status.out

    $ swaymsg reload

    $ ps o pid,ppid,cmd | grep i3status | grep -v grep
    43634       1 i3status
    43635       1 tee /tmp/i3status.out
    43801   43788 sh -c i3status | tee /tmp/i3status.out
    43802   43801 i3status
    43803   43801 tee /tmp/i3status.out

This fixes #5584.
2021-11-25 12:09:12 +01:00
Aleksei Bavshin 94dc486f0e ipc: make bar <bar_id> mode|hidden_state behave as documented
sway-bar(5) says:

> For compatibility with i3, bar mode <mode> [<bar-id>] syntax is
> supported along with the sway only bar <bar-id> mode <mode> syntax.

while the actual behavior is that `bar_cmd_mode` ignores already
selected `config->current_bar` and applies the change to all the
configured bars.
2021-11-25 11:32:46 +01:00
Manuel Stoeckl a23cdbbea1 Add 'output render_bit_depth [8|10]' command
This makes it possible to hint to the renderer and backends how many
bits per channel the buffers that the compositor draws windows onto
should have. Renderers and backends may deviate from this if they
do not support the formats with higher bit depth.
2021-11-23 15:51:54 +01:00
Simon Zeni 5865af75cf sway: create wlr_renderer and wlr_allocator
wlroots now required the compositor to create its own wlr_renderer and
wlr_allocator to initialize the wlr_output
2021-11-18 17:47:19 +01:00
Kirill Primak cbecc5cbae container: fix surface_is_popup() 2021-11-15 10:12:23 +01:00
Eric Engestrom bb7bb3676d sway: allow IPCs on proprietary drivers
Proprietary drivers require --unsupported-gpu to be allowed, and IPCs
require no option to be passed.

The only way to satisfy both is to run IPCs before checking for
proprietary drivers.
2021-11-14 10:43:09 +03:00
Manuel Stoeckl fc25e4944e Update URL to wlroots project (GitHub->GitLab) 2021-11-02 08:43:24 +01:00
Simon Ser 38020d157d Bump RLIMIT_NOFILE
Wayland compositors handle many file descriptors: client
connections, DMA-BUFs, sync_files, wl_data_device pipes, and so
on. Bump the limit to the max.

Closes: https://github.com/swaywm/sway/issues/6285
2021-10-30 08:19:35 -06:00
bR3iN 9969de9e00 Add smart_gaps inverse_outer command
Add a subcommand for `smart_gaps` that enables outer gaps only
on workspaces with exactly one visible child.
Also add documentation for `smart_gaps toggle`.
2021-10-29 13:37:58 +02:00
Rasmus Moorats aaf68cf423 fix cursor input for layer-shell surfaces
previously, fullscreen global containers would grab cursor input
even if a shell-layer surface was on top of it

related issue: https://github.com/swaywm/sway/issues/6501
2021-10-26 15:13:37 +03:00
Jason Nader 9303bed4d4 refactor: use JSON_MAX_DEPTH everywhere 2021-10-25 10:18:40 +02:00
Sefa Eyeoglu b223f70250 refactor: use sway_abort instead 2021-10-22 09:57:05 +02:00
Sefa Eyeoglu 96baef8ae9 fix: use sane value for json_tokener max_depth
INT_MAX causes a NULL pointer if there is not enough memory available to
fit (INT_MAX * sizeof(struct json_tokener_srec)).
2021-10-22 09:57:05 +02:00
Sefa Eyeoglu 944d7031c5 fix: handle NULL from json_tokener_new_ex
if there is not enough memory to fit json_tokener and (depth *
json_tokener_srec) in RAM, don't segfault.
2021-10-22 09:57:05 +02:00
siikamiika 21d2fdf74c view: add new container as a sibling of tiled view
If the focused container is floating by itself, create a new container
in tiling mode as a sibling of the inactive focused container instead of
creating it as a sibling of everything that is in tiling mode in that
workspace. This is the i3 behavior.
2021-10-21 13:16:36 -07:00
siikamiika 197d0ab82f commands/focus: focus view inside container
seat_get_focus_inactive_floating and seat_get_focus_inactive_tiling do
not always return a view, so get the previously focused view from the
container with seat_get_focus_inactive_view. This is the i3 behavior.
2021-10-21 13:13:54 -07:00
David Rosca 215787e8b2 xwayland: Clear wlr_xwayland_surface in handle_destroy
If the destroyed xwayland view is in transaction, it won't
be destroyed immediately. wlr_xwayland_surface then becomes
dangling pointer.

Closes #6605
Closes #5884
2021-10-19 10:42:19 +03:00
Simon Ser b48cb6b0ec Remove --my-next-gpu-wont-be-nvidia
Nvidia has historically been a bad actor in the open-source graphics
ecosystem because they required a special EGLStreams code-path
instead of exposing the de-facto standard GBM API. However, with
their upcoming release they now support GBM as well.

This is a push in the right direction for Nvidia, so there's no
reason we should be more hostile to them than to any other proprietary
driver. Let's remove the --my-next-gpu-wont-be-nvidia flag, and advise
users to use --unsupported-gpu now.

Note, proprietary Nvidia drivers are still unsupported by the Sway
project (just like all other proprietary drivers).
2021-10-19 09:26:06 +02:00
Jason Nader db70f6496c swaymsg: fix misplaced return value 2021-10-18 14:20:24 +02:00
Jason Nader 55cd8abd76 swaymsg: be explicit about the json parser error 2021-10-18 14:20:24 +02:00
Jason Nader f873bcc4e1 swaymsg: use INT_MAX max JSON depth when parsing IPC response
Same reasoning as fe11caeac9.
Without this, swaymsg would fail with a cryptic error message
when the JSON was nested too deep.
2021-10-18 14:20:24 +02:00
Nihal Jere 119f31edb4 config.in: use swaynag -B instead of -b
'-b' spawns a terminal, which is unnecessary for this use case
2021-10-17 21:30:33 +02:00
Simon Ser 1df2450689 github: don't truncate debug logs
This happens a lot, the latest one is [1].

[1]: https://github.com/swaywm/sway/issues/6570
2021-10-17 21:28:51 +02:00
Birger Schacht ca8c6c3d18 Fix a couple of typos 2021-10-16 02:16:12 -04:00
Simon Ser 0c210a5e68 Handle present events with NULL timespec field
See [1].

[1]: https://github.com/swaywm/wlroots/pull/3245
2021-10-15 19:34:03 +02:00
Jonas Große Sundrup 555cd96e05 cross-reference further documentation 2021-10-15 15:20:40 +02:00
Jonas Große Sundrup 35d29185a8 change incorrectly documented output types 2021-10-15 15:20:40 +02:00
Jonas Große Sundrup bccf76d90b clarify the type of raw output 2021-10-15 15:20:40 +02:00
siikamiika f4db502d44 use node_is_view 2021-10-10 09:35:15 +02:00
Jari Ronkainen 624ffa4516 Improve built-in touchscreen detection
Adds detection code to handle pci-*-platform-* strings
in ID_PATH

References: https://github.com/swaywm/sway/issues/6590

Signed-off-by: Jari Ronkainen <ronchaine@gmail.com>
2021-10-08 19:09:42 +02:00
Nathan Schulte 83310f5abf swaybar: fix cairo_font_options leak 2021-10-08 09:33:03 +02:00
Tassilo Horn a47f8ef478 Fix compile after wlroots commit c3e54021f8bbf3ec1c1e5906459be0ae85f5fb8c 2021-10-07 21:29:37 +03:00
Simon Ser 06e97e51af readme: drop recommendation about packaging
- The contact info is out-of-date
- Sway is packaged in many distributions now
- I don't think we necessarily need to mention this in the README
2021-10-07 19:08:58 +03:00
Bartel Sielski 8fa7b99859 idle_inhibit: Fix tree view after changes in commit 152a559e
Commit 152a559e replaced the view pointer in the inhibitor struct with a
pointer to the wlr_inhibitor for application inhibitors. But this was not
changed in the sway_idle_inhibit_v1_application_inhibitor_for_view function.
This caused a bug in the sway tree view where the application inhibitor is
always "none".
2021-10-04 16:25:35 +02:00
Elyes HAOUAS 8aae6a8eab sway-input.5.scd: Fix spelling errors
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2021-10-02 10:21:28 +02:00
Evgeniy Khramtsov ff468584ab commands: Remove unused code after 1d3681f521
Clang 13 reports:

../sway/commands.c:470:23: error: variable 'context' set but not used
[-Werror,-Wunused-but-set-variable]
        enum command_context context = 0;
                             ^
Last use of was removed in commit 1d3681f521.

Downstream PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258813
2021-10-01 15:45:09 +02:00
Simon Ser c43f1fbf1c Chase wlr_xdg_surface breaking changes
See [1].

[1]: https://github.com/swaywm/wlroots/pull/3106
2021-10-01 00:21:56 +03:00
Simon Ser 1bd8e3b469 Add support for DRM panel orientation
References: https://github.com/swaywm/wlroots/pull/3205
2021-09-28 21:27:15 +02:00
Simon Ser 5fdc1c894d readme: add missing space 2021-09-28 21:01:28 +02:00
Kirill Primak 5fd5d6434e layer-shell: fix commit handler
This commit makes sure the extents are kept up-to-date, fixes not
damaging the surface if its layer shell-specific state didn't change,
and adds a check if the layer shell-specific state didn't change but the
surface got mapped/unmapped, which could affect keyboard focus.
2021-09-25 22:21:51 +03:00
Kirill Primak c11b5db4d6 layer-shell: check committed bitmask
This avoids infinite configure-ack_configure-commit loop.
2021-09-24 14:40:59 +02:00
Kirill Primak b7b3ef6dcf layer-shell: chase wlr layer surface refactor 2021-09-23 21:32:56 +02:00
Kirill Primak b7b96399e1 xdg-shell: remove unused request_maximize listener 2021-09-21 14:29:37 +02:00
Kirill Primak b1d41db6cf Revert "xdg_shell: schedule configure on maximize requests"
This reverts commit 4dd46f06ac, as the
logic is now handled by wlroots.
2021-09-21 14:29:37 +02:00
Kirill Primak eb03298b46 xdg-shell: chase wlr xdg toplevel refactor 2021-09-21 10:12:27 +02:00
Simon Ser 82d5f12914 Add -Dnoscanout debug option
This can help debugging direct scan-out issues, such as [1].

[1]: https://github.com/swaywm/wlroots/issues/3185
2021-09-20 14:22:35 +02:00
Nathan Schulte 033061aee6 swaybar: properly draw blocks with transparent black border
while the draw itself is a no-op, alignment must still be accounted
this requires more signalling about the blocks (border_set; was the
border set?)
2021-09-20 09:53:32 +02:00
Hugo Osvaldo Barrera a345180520 Drop hardcoded font metric values 2021-09-20 09:25:47 +02:00
Hugo Osvaldo Barrera c16b2a26ed Avoid unecessary font metric calculations
Prior to 62d90a8e, titlebar's font height (and other related values)
would change any time any titlebar's content changed, so these values
were recalculated each time any titlebar's content changed (or a new
titlebar was created).

However, since the above was merge, these values no longer change so
often and we only need to recalculate them when the configured font
changes (and stop calling `config_update_font_height` each time
titlebars are rendered).

This commit removes all the unecessary calls to this function and avoids
all those unecessary calculations. Whenever the font strays from the
default value, the `font` command is called, and it calls
`config_update_font_height`, which is enough to keep the value always up
to date.

I've also added a default value to the `font_baseline` config, since
otherwise that's zero for setups that don't explicitly specify a font.
2021-09-20 09:25:47 +02:00
aajonusonline 49da73d4ac sway-ipc.7.scd: fix typo 2021-09-19 17:28:37 +02:00
Christian Llupo f1f283dd77 README: Added Greek translation 2021-09-19 14:14:42 +02:00
Nathan Schulte 8d0a84f3c7 swaybar: properly draw urgent block right border
introduced via #3287 -- https://github.com/swaywm/sway/pull/3287/files#diff-a1e918ce0bc71f4f7934767541319e724a51a34a5418ecdc286065e50921eda4L239
uncovered via #3394 -- https://github.com/swaywm/sway/pull/3394/files#diff-a1e918ce0bc71f4f7934767541319e724a51a34a5418ecdc286065e50921eda4R258
2021-09-15 09:26:08 +02:00
Simon Ser 9727db67cf build: remove scdoc stdin/stdout hack
Since [1], Meson allows feeding the input file as stdin and
capturing stout to the output file. We don't need the sh hack
anymore.

[1]: https://github.com/mesonbuild/meson/pull/8923
2021-09-15 08:21:20 +02:00
Kenny Levinsen 94e041b5f6 readme: Align Danish translation with main README 2021-09-13 17:05:28 +02:00
Simon Ser 1b86008721 readme: mention seatd
When seatd is used, it isn't necessary to suid the sway binary.
2021-09-13 16:10:05 +02:00
xdavidwu 806b59eca3 swaynag: fix pointer button events on scaled outputs
sway#6504 simplified rendering code by setting scaling at cairo, but
that also changed button position records into ones without scale
multiplication, breaking button events. This fixes it by not multiplying
scale on events handling as well.
2021-09-13 14:46:01 +02:00
Simon Ser 3f7a04df22 Rename pango_printf to render_text
This avoids using the pango_ prefix, reserved for functions coming
from the Pango library.
2021-09-13 14:22:51 +02:00
Simon Ser 671bb448a1 readme: link to gamja for IRC
gamja offers a better experience than Kiwi.

Obviously I'm 100% biased. Completely fine to not make the switch if someone feels differently.
2021-09-13 10:58:45 +02:00
Simon Ser d0cb52db64 readme: switch to Libera Chat for ir 2021-09-13 08:29:12 +02:00
Caduser2020 57ae751655 Simplify swaybar/swaynag scaling code
Use `cairo_scale` to set the scale factor, removing redundant
multiplications by `output->scale`.
2021-09-12 09:05:12 +02:00
Simon Zeni 30c28ff8f7 introduce wlr_drm_lease_v1
This prevents sway from extending the desktop to i.e. VR headsets, and makes
them available for DRM leasing.

Non-desktop wlr_outputs will be offered through the wlr_drm_lease_v1_manager
interface for client to lease.
2021-09-09 15:25:19 +02:00
Kirill Primak e76e13ef85 view: fix child position calc
Previously, the position was calculated incorrectly for nested
subsurfaces.
2021-09-08 09:36:17 +02:00
lbonn adf9e16c88 build: subproject support for wayland-protocols
As in wlroots: [1]

[1]: https://github.com/swaywm/wlroots/pull/2953
2021-09-08 08:19:40 +02:00
Kirill Primak 91d6d00414 render: fix -Ddamage=rerender 2021-09-07 14:52:29 +02:00
Kirill Primak ae80bdedf9 surface: chase wlr subsurface list/link change 2021-09-06 17:39:28 +02:00
Kirill Primak 72b0491ca0 view: fix saved buffer order 2021-09-05 12:31:46 +02:00
Daniel De Graaf 69a7b9215e Fix overly-wide mark textures
The width of the texture needs to be calculated using the string that is
actually displayed in the texture.
2021-09-04 17:23:06 +02:00
Ronan Pigott 00b10a93f1 commands: update split none command for a047b5ee4 2021-09-04 00:24:47 +02:00
Ronan Pigott de3c290427 command: implement split none 2021-09-03 23:50:20 +02:00
Simon Plakolb 4baf845a3a seatop_down: End if surface is destroyed or other seatop starts
If the surface the pointer started to interact with is destroyed we also
want the seatop_down to end. In case a drag is initiated we receive a
call to handle_end.
2021-09-02 13:13:40 -04:00
Simon Plakolb 9e58425cb3 input: Use seatop_down on layer surface click
This solves an issue where layer-shell items would not receive a button
release event when the pointer left them while being pressed. The
default seatop changes focus immediately while seatop_down defers any
focus changes until the pointer is released or seatop_down is destroyed.
2021-09-02 13:13:40 -04:00
David Rosca 57d6f6f19e Add output modeline command
Only works with DRM backend.
2021-08-31 17:29:40 +02:00
Tudor Brindus daaec72ac0 desktop/xwayland: restack surface upon activation
This commit updates Sway for swaywm/wlroots#2915.
2021-08-28 22:04:31 +02:00
Nihal Jere 1ea5f015f5 config.in: use portable hour specifier
`%l` is GNU specific. `%I` does the same thing but padded by zeros,
and is POSIX compliant.
2021-08-27 19:28:56 +02:00
Hugo Osvaldo Barrera 9acb015755 Deduplicate code for rendering titlebar texts
The title itself and marks were being rendered by two very-similar yet
different functions, and any changes made to one had to be reflected on
the other.

This mostly prevents such oversights from happening, and keeps makes
sure we keep both consistent.
2021-08-27 10:12:57 +02:00
Hugo Osvaldo Barrera 62d90a8e95 Use fixed titlebar heights
Use fixed titlebar heights. The default height is calculated based on
font metrics for the configured font and current locale.

Some testing with titles with emoji and CJK characters (which are
substantially higher in my setup) shows that the titlebars retain their
initial value, text does shift up or down, and all titlebars always
remain aligned.

Also drop some also now-unecessary title_height calculations.

Makes also needed to be updated, since they should be positioned with
the same rules.
2021-08-26 20:16:14 +02:00
grumpey bb3fd0abc5 Update Pango font description URL in sway.5.scd
Along with f4cda51 fixes #6217.
2021-08-19 18:06:29 +02:00
quinno d0c5c5a60b Fix typo in sway.5.scd
small typo fix (ptt => ppt)
2021-08-16 14:05:48 +02:00
Simon Ser c9060bcc12 layer-shell: replace close() with destroy()
Update for the wlroots breaking change in [1].

[1]: https://github.com/swaywm/wlroots/pull/3108
2021-08-14 20:29:59 +02:00
Eric Engestrom b17cf58a4d cmd_bind_or_unbind_switch: fix copy/paste typo error message
`[0]` is the switch type, not its state; we want `[1]` for that, and
it's a string not an int :)
2021-08-14 10:46:17 +02:00
Simon Ser 4cdc4ac63a Fallback to other output modes if preferred mode fails
Sometimes the preferred mode is not available due to hardware
constraints (e.g. GPU or cable bandwidth limitations). In these
cases it's better to fallback to lower modes than to end up with
a black screen.
2021-08-12 21:06:26 +02:00
Ronan Pigott f67ed6772c layer_shell: damage previous area when a surface shrinks
When a layer surface shrinks we need to damage the area it previously
occupied, but we don't know the location of all its subsurfaces in the
previous state, so instead damage a rectangle that encloses the entire
previous extent.
2021-08-12 10:05:12 +02:00
Dudemanguy acf946fe4c xdg-decoration: let floating clients set borders
The xdg-decoration protocol allows clients to request whether they want
to use server side decorations or client side decorations. Currently,
sway ignores this and always enforces whatever the server is currently
set to. Although tiled clients cannot be allowed to set borders, there
is no harm in listening requests from floating clients. Sidenote: also
fix an unrelated style error.
2021-08-12 10:02:17 +02:00
Simon Ser 7a15e715b7 Document view_map 2021-08-12 00:15:04 +02:00
mzeinali b345d6e5d2 Add persian README file 2021-08-10 15:55:57 +02:00
David Rosca d0fe721fbb seatop_down: Change type of sx, sy to double in begin_seatop_down
Losing the precision resulted in wlr_cursor and wlr_seat::pointer_state
getting out of sync during pointer motion in seatop_down.
Since the difference was always under 1 px, it was practically
impossible to notice in normal use.

But because of being out of sync, cursor_rebase would always end up
incorrectly calling wlr_seat_pointer_notify_motion from
seatop_default_begin (on releasing mouse button) which broke cursor
locking.

See #5405
Closes #4632
2021-08-05 09:26:11 -04:00
frogtile f4cda5157e
man: update Pango font description URL
The old URL gives a 404.
2021-08-04 02:15:04 +02:00
Simon Zeni 6ffa4b1f70 view: remove reference to wlr_wl_shell_surface 2021-07-27 17:31:29 +02:00
Simon Ser daf9ad1af7 swaybar: log Wayland display errors 2021-07-26 16:58:28 +02:00
Simon Ser a71bbdd322 swaybar: exit cleanly when disconnected from IPC 2021-07-26 16:58:28 +02:00
Simon Ser 2e03a61262 Fix wl_pointer.frame not sent on touch emulation
When emulating touch, the simulating_pointer_from_touch field is
set to true. It's switched back to false when a touch_up event is
received. However we need to ensure we always send a wl_pointer.frame
event following a group of other wl_pointer events.

Since a touch_frame event is always guaranteed to come after a group
of touch events, unset simulating_pointer_from_touch in the touch_frame
handler instead of the touch_up handler. Add a new field to know whether
the touch_frame handler should stop emulation.
2021-07-26 16:58:11 +02:00
Tobias Stoeckmann e7f4e50da0 Fix crash when starting without HOME
If HOME environment variable is not set, sway fails startup with a
segmentation fault due to null pointer dereference.

Also check calloc return value and only perform the fallback code when
really needed.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2021-07-23 20:05:16 +02:00
bR3iN c9458b9fb1 Add gaps <type> <scope> toggle <px> command
Add a subcommand for `gaps` that allows to toggle gaps at
runtime. This functionality is part of i3-gaps since [1]
but is missing in sway.

[1] https://github.com/Airblader/i3/pull/264
2021-07-22 10:12:33 +02:00
Dylan Araps 2024725cc0 Add meson options to enable/disable swaybar and swaynag 2021-07-21 18:24:09 +02:00
Hugo Osvaldo Barrera 96102184ab grimshot: Exit 1 on cancellation
Whenever the selection is cancelled by the user, exit 1, since not
screenshot has been taken.
2021-07-10 13:03:42 +02:00
Simon Ser 7114030159 Add support for touch frame events
Update for the breaking change in [1].

[1]: https://github.com/swaywm/wlroots/pull/3001
2021-07-08 09:18:20 +02:00
Simon Ser 4832fc937f Update wlr_box includes
Update for the breaking change in [1].

[1]: https://github.com/swaywm/wlroots/pull/3011
2021-07-07 11:29:14 +02:00
Dudemanguy c41dc33590 container: ignore borders in fullscreen windows
When setting the geometry from content for floating windows, the
coordinates for borders are normally taken into account. However in the
case of a floating fullscreen window, we should not be doing this. Since
the content of the container takes the space of the entire output, this
causes the calculated borders to neccesarily be outside of the output.
This later causes a problem when sending surface entrance events since
in a multi-monitor setup, the border coordinates will overlap with
another output despite the surface not actually being on that output at
all. The fix is to just ignore border coordinates for a floating
fullscreen container since fullscreen, of course, does not actually have
any borders. Fixes #6080.
2021-07-06 22:54:24 +02:00
Simon Ser 22226560e3 tree/container: fix indentation 2021-07-05 10:09:39 +02:00
Jack Byrne 1b8719f167 Change 'Danish' to 'Dansk' in README
Danish is the only language in the README that is not named in its own language.

<sorry for the frivolity but the inconsistency bugs me>
2021-06-30 16:16:53 +02:00
Simon Ser 56733bc6fe ci: make Meson warnings fatal
New warnings can be hard to notice in CI, since CI will just pass in
that case. Meson sometimes uses warnings for important mistakes, e.g.
invalid option.

Let's turn warnings into errors so that we can spot these more easily.
2021-06-30 13:37:00 +02:00
Simon Ser 151193b4cd build: use ExternalProgram.full_path instead of path
ExternalProgram.path has been deprecated.
2021-06-30 13:37:00 +02:00
Simon Ser 5f3773f21e build: use Dependency.get_variable instead of get_pkgconfig_variable
Dependency.get_pkgconfig_variable has been deprecated.
2021-06-30 13:37:00 +02:00
Simon Ser 8348178c66 build: use meson.global_build_root()
meson.build_root() is deprecated.

References: https://github.com/mesonbuild/meson/pull/8629
2021-06-30 13:37:00 +02:00
Simon Ser 5cdce42d1b contrib: drop incr_version script
This isn't used anymore.
2021-06-24 18:35:00 +02:00
Simon Ser c53ef02385 build: bump wlroots dependency to 0.15.0 2021-06-23 14:32:31 +02:00
Kenny Levinsen 4df9f49dc1 ci: Test wlroots static linking 2021-06-23 09:55:36 +02:00
Kenny Levinsen 80315217f7 input: Move get_current_time_msec in from util
get_current_time_msec is only used in cursor.c, so we can move it in and
make it static. This is primarily intended to avoid a symbol collision
with wlroots, which we unfortunately do not have a good solution for
yet.
2021-06-23 09:55:36 +02:00
Ragnar Groot Koerkamp f81dc1ecc0 Update clang format to better match existing code 2021-06-22 20:21:45 +02:00
Ragnar Groot Koerkamp c0c4e260c4 Revert "Add workspace {prev,next}_on_output --create"
This reverts commit 487c83f0de.

The --create flag is undocumented, not in i3, and at least partially
broken (#5913), so this removes the feature.
2021-06-22 19:00:31 +02:00
novenary dbc326ba84 Don't apply hide_edge_borders to any floating container
This fixes the following scenario:
- Place a floating window so its border is right at the edge of the
  screen
- Create a new split
- The border disappears
- Moving the window does not restore the border
2021-06-20 15:39:04 -04:00
Ragnar Groot Koerkamp d5c71231e5 Only call workspace_auto_back_and_forth when needed
Instead of disabling it for some workspace subcommands, this explicitly
calls it only in the 2 places it's actually needed: for switching to a
named or numbered workspace.
2021-06-18 16:15:02 +02:00
Ragnar Groot Koerkamp 3080f1b9ce Move auto_back_and_forth logic out of workspace_switch
This extracts the code to a separate workspace_auto_back_and_forth
function.
It also removes the bool argument by adding an extra if statement at the call
site, and repurposes the no_auto_back_and_forth variable to
auto_back_and_forth for simpler understanding.
2021-06-18 16:15:02 +02:00
Ragnar Groot Koerkamp 771cff23fb Fix #6299 Disable auto_back_and_forth for next_on_output
This forces no_auto_back_and_forth to true for `workspace
next_on_output` and `workspace prev_on_output` to keep parity with i3.
In i3, running next_on_output never changes focus to another output.
In Sway currently, with workspace_auto_back_and_forth set to yet,
running next_on_output on an output with only a single active workspace
will typically end up focussing the other output:
1. next_on_output focusses the current workspace, because it's the only
one
2. auto_back_and_forth focusses the last focussed workspace, because the
current workspace to focus is the current one. This will usually be on
the other monitor if the workspace there was last focussed.
2021-06-18 09:37:28 +02:00
James Edwards-Jones d13090be54 swaynag: adds option to set wayland shell layer
Uses --layer/-y set to overlay|top|bottom|background
2021-06-17 11:47:49 +02:00
Rahiel Kasim 75a4122f7a fix typo in sway-output.5.scd 2021-06-13 17:22:33 +02:00
Daniel Eklöf 3bf99198a6 sway: restore SIGPIPE handler before exec:ing swaybar
Sway ignores SIGPIPE (by installing a SIG_IGN handler), in order to
“prevent IPC from crashing Sway”.

SIG_IGN handlers are the *only* signal handlers inherited in
sub-processes. As such, we should be a good citizen and restore the
SIGPIPE handler to its default handler.

Original bug report:
https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1806907.html
2021-06-05 11:50:11 +02:00
Daniel Eklöf 1dd6df6a5d sway: commands: exec: restore SIGPIPE before exec:ing
Sway ignores SIGPIPE (by installing a SIG_IGN handler), in order to
“prevent IPC from crashing Sway”.

SIG_IGN handlers are the *only* signal handlers inherited in
sub-processes. As such, we should be a good citizen and restore
the SIGPIPE handler to its default handler.

Original bug report:
https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1806907.html
2021-06-05 11:50:11 +02:00
Daniel Otero b997147284 config: Fix swaybar pango_markup inconsistency
Until now, swaybar did not have pango markup enabled by default, even if
the sway config had it on. This patch aims to mimic the i3 behavior, but
maintaining the functionality of the "pango_markup" sway config command.
2021-06-03 14:18:23 +02:00
Bill Doyle cad6e59b93 Only defer seat attachment during initial startup
Deferred commands are only run once, during sway startup. This means
that deferring seat attachment based on whether we are reading the
config prevents devices from being reattached to the correct seat during
a config reload. Instead, only defer if the config is not yet active.

Fixes #6048.
2021-06-03 14:07:18 +02:00
Simon Ser 3162766eef Iterate over subsurfaces below the parent surface
Update for the breaking change in [1].

[1]: https://github.com/swaywm/wlroots/pull/2948
2021-06-03 14:06:29 +02:00
Simon Ser 9755684fb0 Implement xdg-activation-v1
See https://github.com/swaywm/wlroots/pull/2718.
2021-06-02 19:39:40 +02:00
sergio 92ba229094 details-gackground typo fix 2021-05-28 17:18:36 +02:00
Simon Ser f443c73a2a readme: switch back to IRC web client 2021-05-26 22:09:05 +02:00
apt-ghetto 1651f21061 Fix IRC links in READMEs and templates
Change the webchat links from freenode.net to point to the new
destination libera.chat.

Co-authored-by: Simon Ser <contact@emersion.fr>
2021-05-26 08:25:13 +02:00
Bart Pelle e318b27685 docs: fix invalid release signing keys 2021-05-25 21:17:54 +02:00
Tobias Langendorf 12e223e797 remove usage of wlr_texture_get_size
update for wlroots 6369f7093178f0d66414eb67c312a403bfbb84a4
2021-05-17 10:48:54 +02:00
Ronan Pigott 5a73dc1bc2 view: commit transactions for foreign toplevel requests 2021-05-17 08:57:20 +02:00
Manuel Stoeckl 31b4b96ebf commands/exec: stop truncating >4095-byte commands 2021-05-10 10:57:58 +02:00
Ronan Pigott 137dbf3e6d cmd_fullscreen: ignore fullscreen request on workspaces 2021-05-10 10:30:44 +02:00
Issam E. Maghni d45623c2db cairo: Replace <cairo/cairo.h> by <cairo.h>
For full context, read
https://gitlab.freedesktop.org/cairo/cairo/-/issues/479
TL;DR, cairo’s pc file adds `/cairo` to CFLAGS.
So namespace cairo shouldn’t be used.
2021-05-10 10:28:32 +02:00
Drew DeVault 009c58fc95 config.in: change terminal emulator to foot
This is my preferred terminal emulator now. Seeing as the default config
file is basically "Drew's preferences watered down a bit for a general
audience", I reckon it should be updated accordingly :)
2021-05-06 20:52:51 +02:00
tomKPZ f9a5c18c93 Add tab dragging functionality
Implements functionality described in [1].  Please see the issue for a
video with a demonstration of the new behavior.

An issue is that titlebars cover up a significant portion of the top
edge drop area.  The solution is simply to change the edge drop area
hitbox to start at the contents instead of the container.

[1] https://github.com/swaywm/sway/issues/6218
2021-05-06 00:24:55 -04:00
Erik Reider d65e67face Added scroll_factor input variable to ipc output 2021-05-05 19:50:15 +02:00
Simon Ser d7ec66d563 build: remove sd-bus status item
sd-bus == tray, no need to print the same thing twice.
2021-05-04 21:07:04 +02:00
Elyesa f8d7c170cd
Add Turkish README 2021-05-03 11:58:18 +02:00
Bartłomiej Burdukiewicz 7c74f01f0a main: removed vc4 detection code.
Signed-off-by: Bartłomiej Burdukiewicz <bartlomiej.burdukiewicz@gmail.com>
2021-04-29 18:04:34 +02:00
Rouven Czerwinski 30e400c0a3 view: handle case where map_ws is NULL
When a criteria places the view into the scratchpad, map_ws is NULL and
trying to access map_ws->fullscreen will result in SIGSEGFAULT with:

  #0  0x0000000000455327 in should_focus (view=0x15a6a70) at ../sway/tree/view.c:604
          prev_con = 0x0
          len = <optimized out>
          seat = 0x12233c0
          prev_ws = 0x1264c80
          map_ws = 0x0
          criterias = <optimized out>
          seat = <optimized out>
          prev_con = <optimized out>
          prev_ws = <optimized out>
          map_ws = <optimized out>
          criterias = <optimized out>
          len = <optimized out>
          num_children = <optimized out>
  #1  view_map (view=view@entry=0x15a6a70, wlr_surface=0x15a5cb0, fullscreen=<optimized out>, fullscreen_output=<optimized out>, decoration=<optimized out>) at ../sway/tree/view.c:809
          __PRETTY_FUNCTION__ = "view_map"
          ws = <optimized out>
          seat = <optimized out>
          node = <optimized out>
          target_sibling = <optimized out>
          container = 0x1625400
          set_focus = <optimized out>
          app_id = <optimized out>
          class = <optimized out>
  #2  0x0000000000423a7e in handle_map (listener=0x15a6c78, data=<optimized out>) at ../sway/desktop/xdg_shell.c:454
          xdg_shell_view = 0x15a6a70
          view = 0x15a6a70
          xdg_surface = 0x15a6620
          csd = <optimized out>
  #3  0x00007f508bd3674c in wlr_signal_emit_safe (signal=signal@entry=0x15a6718, data=data@entry=0x15a6620) at ../subprojects/wlroots/util/signal.c:29
          pos = 0x15a6c78
          l = 0x15a6c78
          cursor = {link = {prev = 0x15a6c78, next = 0x7fff53d58190}, notify = 0x7f508bd366c0 <handle_noop>}
          end = {link = {prev = 0x7fff53d58170, next = 0x15a6718}, notify = 0x7f508bd366c0 <handle_noop>}
  #4  0x00007f508bd15b29 in handle_xdg_surface_commit (wlr_surface=<optimized out>) at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_surface.c:384
          surface = 0x15a6620
  #5  0x00007f508bd2e981 in surface_commit_state (surface=surface@entry=0x15a5cb0, next=next@entry=0x15a5e18) at ../subprojects/wlroots/types/wlr_surface.c:455
          __PRETTY_FUNCTION__ = "surface_commit_state"
          invalid_buffer = <optimized out>
          subsurface = 0x15a6038
  #6  0x00007f508bd2f53b in surface_commit_pending (surface=0x15a5cb0) at ../subprojects/wlroots/types/wlr_surface.c:474
          next_seq = 3
          next_seq = <optimized out>
  #7  surface_commit (client=<optimized out>, resource=<optimized out>) at ../subprojects/wlroots/types/wlr_surface.c:542
          surface = 0x15a5cb0
          subsurface = <optimized out>

If map_ws is NULL we assume the view is places into the scratchpad and
return false as well.
2021-04-29 09:06:05 +02:00
Ronan Pigott a6dc829ed0 xdg-shell: ignore unecessary fullscreen request ouput hints 2021-04-26 13:14:24 -07:00
Ronan Pigott c12169953a workspace: reap empty parents when adding tiles 2021-04-26 13:14:24 -07:00
Simon Ser fd36289faa Remove support for arbitrary rotations
There was some unused code-paths for rendering surfaces with an
arbitrary rotation applied. This was imported from rootston.

Since we don't have plans to make use of this, remove it.
2021-04-26 10:36:25 +02:00
Kenny Levinsen 4e6f515253 desktop/render: Pass explicit clip box to render
render_surface_iterator previously deduced the clip box from an optional
container passed with render data. This causes problems when offsets in
view geometry need to be compensated for in the clip dimensions.

Instead, prepare the clip box in render_view_toplevels where the offsets
are being applied, and compensate for them immediately.

A similar compensation is applied to render_saved_view.

Closes: https://github.com/swaywm/sway/issues/6223
2021-04-26 09:24:12 +02:00
Kenny Levinsen 7ec9d07fc5 Remove usage of surface->sx|sy
These coordinates contain the all-time accumulated buffer attach point,
which is a way to perform incremental client-side initiated movement of
windows, intended as a way to maintain logical window positioning while
compensating for layout changes such as folding in a left side panel.

This value is not useful for implementing this feature, and break things
if they ever become non-zero. Their inclusion in calculations also tend
to cause confusion.

Remove usage of these coordinates, removing the ability for clients to
move themselves. This may again be supported if a better API is made
available from wlroots.
2021-04-26 09:24:12 +02:00
Tudor Brindus 80128d23ba tree/view: don't give focus to views mapped under fullscreen views
Fixes #6211.
2021-04-25 11:20:56 +02:00
Dominique Martinet 8529141150 view_destroy: fix use-after-free with subsurface_destroy
remove view from its own unmap event listener so when subsurfaces
link try to remove themselves they won't run into it.

This fixes the following ASAN use-after-free error on a build slightly
modified to instrument wl_list operations:
==71705==ERROR: AddressSanitizer: heap-use-after-free on address 0x6160000829a0 at pc 0x000000508eb7 bp 0x7ffec8fd8030 sp 0x7ffec8fd8028
WRITE of size 8 at 0x6160000829a0 thread T0
    #0 0x508eb6 in wl_list_remove ../common/list.c:181
    #1 0x4f4998 in view_child_destroy ../sway/tree/view.c:1131
    #2 0x4f38fa in subsurface_handle_destroy ../sway/tree/view.c:946
    #3 0x7fda50744892 in wlr_signal_emit_safe ../util/signal.c:29
    #4 0x7fda5072f0dd in subsurface_destroy ../types/wlr_surface.c:649
    #5 0x7fda507312c4 in subsurface_handle_surface_destroy ../types/wlr_surface.c:1094
    #6 0x7fda50744892 in wlr_signal_emit_safe ../util/signal.c:29
    #7 0x7fda5072f305 in surface_handle_resource_destroy ../types/wlr_surface.c:677
    #8 0x7fda508180ce in destroy_resource (/lib64/libwayland-server.so.0+0xc0ce)
    #9 0x7fda508187f2 in wl_client_destroy (/lib64/libwayland-server.so.0+0xc7f2)
    #10 0x7fda50818e5f in wl_client_connection_data (/lib64/libwayland-server.so.0+0xce5f)
    #11 0x7fda50818219 in wl_event_loop_dispatch (/lib64/libwayland-server.so.0+0xc219)
    #12 0x7fda50818984 in wl_display_run (/lib64/libwayland-server.so.0+0xc984)
    #13 0x43122c in server_run ../sway/server.c:254
    #14 0x42f47c in main ../sway/main.c:433
    #15 0x7fda503cab74 in __libc_start_main (/lib64/libc.so.6+0x27b74)
    #16 0x40f6fd in _start (/opt/wayland/bin/sway+0x40f6fd)

0x6160000829a0 is located 288 bytes inside of 592-byte region [0x616000082880,0x616000082ad0)
freed by thread T0 here:
    #0 0x7fda50f01a27 in free (/lib64/libasan.so.6+0xaea27)
    #1 0x4532d8 in destroy ../sway/desktop/xdg_shell.c:262
    #2 0x4ed17b in view_destroy ../sway/tree/view.c:67
    #3 0x4ed300 in view_begin_destroy ../sway/tree/view.c:83
    #4 0x454a3f in handle_destroy ../sway/desktop/xdg_shell.c:507
    #5 0x7fda50744892 in wlr_signal_emit_safe ../util/signal.c:29
    #6 0x7fda506e2c87 in reset_xdg_surface ../types/xdg_shell/wlr_xdg_surface.c:481
    #7 0x7fda506e3018 in destroy_xdg_surface ../types/xdg_shell/wlr_xdg_surface.c:516
    #8 0x7fda506dfbe5 in xdg_client_handle_resource_destroy ../types/xdg_shell/wlr_xdg_shell.c:71
    #9 0x7fda508180ce in destroy_resource (/lib64/libwayland-server.so.0+0xc0ce)

previously allocated by thread T0 here:
    #0 0x7fda50f01ed7 in calloc (/lib64/libasan.so.6+0xaeed7)
    #1 0x454bc8 in handle_xdg_shell_surface ../sway/desktop/xdg_shell.c:528
    #2 0x7fda50744892 in wlr_signal_emit_safe ../util/signal.c:29
    #3 0x7fda506e2363 in handle_xdg_surface_commit ../types/xdg_shell/wlr_xdg_surface.c:378
    #4 0x7fda5072e368 in surface_commit_state ../types/wlr_surface.c:455
    #5 0x7fda5072e51d in surface_commit_pending ../types/wlr_surface.c:474
    #6 0x7fda5072ea58 in surface_commit ../types/wlr_surface.c:542
    #7 0x7fda4fb3ac03 in ffi_call_unix64 (/lib64/libffi.so.6+0x6c03)

Fixes #5168
2021-04-22 23:19:08 +02:00
Simon Ser 31a2252e83 commands/exec_always: log error on execlp failure
And exit(1) instead of indicating success.
2021-04-22 23:12:49 +02:00
Simon Ser 7beeb9e61b Use execlp("sh") instead of execl("/bin/sh")
This stops assuming the POSIX shell command is located in /bin.
2021-04-22 23:12:49 +02:00
Simon Ser e3e99d961d Avoid creating zero-sized textures for marks
Same as 6327f1b361 ("Avoid creating zero-sized textures for titlebars")
but for marks.
2021-04-20 17:29:16 +02:00
Simon Ser 3173a4f353 Use cairo_image_surface_get_stride instead of guessing it 2021-04-20 17:28:30 +02:00
Simon Ser 6327f1b361 Avoid creating zero-sized textures for titlebars
Creating a zero-sized wlr_texture is incorrect.
2021-04-20 17:22:06 +02:00
Michael Weiser 730efbc89c Prevent use-after-free on first bar subcommand error
If any error is encountered during execution of the first subcommand of
a freshly created bar configuration, parsing apparently is to be aborted
and the current bar config is freed. The pointer to that memory is left
dangling though, leading to a use-after-free on successive bar
subcommands. This quite reliably ends in a crash like so:

sway -c reproducer.config
00:00:00.083 [sway/config.c:865] Error on line 2 'foo bar': Unknown/invalid command 'foo' (s)
free(): double free detected in tcache 2
00:00:00.608 [swaynag/swaynag.c:451] failed to register with the wayland display
Aborted (core dumped)

Minimal reproducer config:
bar {
        foo bar
        position top
}

Other messages:
malloc(): unaligned fastbin chunk detected
double free or corruption (fasttop)

The invalid command has to be the first for a newly created bar config.
Removing the command or switching order so it's not the first one masks
the problem.

Prevent this from occuring by resetting the pointer to NULL after
freeing the memory.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2021-04-18 20:53:36 -07:00
Ronan Pigott ecfd687977 cmd_fullscreen: allow fullscreen on fullscreen split containers
Using the fullscreen command on a child of a fullscreen split
container will now fullscreen the child instead of unfullscreening
the parent.
2021-04-16 11:36:14 +02:00
ash lea eb9e77f4ea container: don't set fullscreen on children
the original behavior set fullscreen for all descendents of a container,
which causes issues when firefox is one of those children because it
sends its own set_fullscreen request in response to being fullscreened.
2021-04-15 16:58:27 -07:00
Kenny Levinsen 4e77bc2935 meson: libseat is no longer optional
See: https://github.com/swaywm/wlroots/pull/2839
2021-04-14 23:29:09 +02:00
Kenny Levinsen fcfe52de29 ci: Install libseat 2021-04-14 23:29:09 +02:00
fwsmit 8106f01c17 desktop/layer_shell: fix centering for opposing anchors 2021-04-12 12:13:25 -07:00
Elyes HAOUAS b40c6448e6 desktop/layer_shell.c: Fix misspelled "exclusive"
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2021-04-12 18:07:18 +02:00
Simon Ser 78fc9d0d2d Log wlroots version on startup
Can be useful to make sure a bugfix is included. In the future maybe
the wlroots version string could include a commit hash when built
from source, too.
2021-04-12 16:18:17 +02:00
Ronan Pigott a558866f42 container: retain focus position on floating enable
When a tiling container is floated, the focus stack needs to be
appropraitely modified to return the container to its original
position in the tree upon floating disable, like i3.
2021-04-11 21:01:33 -04:00
Simon Ser 1a72049c04 Remove WLR_HAS_XDG_FOREIGN checks
References: https://github.com/swaywm/wlroots/pull/2833
2021-04-11 19:14:05 +02:00
Simon Ser 86b08e3257 desktop/render: remove unused wlr_gles2_texture_attribs
We were calling wlr_gles2_texture_get_attribs, but we were never
using the result.
2021-04-11 12:15:51 +02:00
Simon Ser e49a98fcb3 build: stop checking for logind
wlroots has removed its logind session backend [1]. It now relies
on libseat only.

[1]: https://github.com/swaywm/wlroots/pull/2786
2021-04-11 12:14:40 +02:00
Aljaz Gantar 1a0f86be4e refactor icon_for_window function 2021-04-09 22:08:53 +02:00
Aljaz Gantar 61df9eb62a fix type error when class_name none 2021-04-09 22:08:53 +02:00
Simon Ser 7a68a28475 build: update wlroots dependency version to 0.14.x
The latest commit of Sway always requires the latest commit of
wlroots.
2021-04-08 08:55:20 +02:00
Simon Ser 8cd014cab7 build: bump version to 1.6 2021-04-07 22:02:55 +02:00
István Donkó 6e34aac2f1
Add Hungarian translation for the README
Co-authored-by: Tamás Táncos <tamas.tancos@emarsys.com>
2021-04-03 14:26:53 +02:00
Simon Ser 4402507b7b readme: make it clearer that meson takes a dir as argument
"build" can easily be misinterpreted as a Meson subcommand.
2021-04-03 14:24:53 +02:00
Ronan Pigott 62fbf33ce2 output: damage whole output when exiting scanout 2021-04-01 12:24:33 +02:00
Simon Ser db0d63313d Remove advice about Firefox from issue template
Firefox got a lot better. I think now would be a good time to remove
the advice from the issue template. We can always add it back if we
start getting invalid bug reports again.
2021-03-30 18:32:55 +02:00
Simon Ser 276a37a605 ci: add xcb-util-wm dependency for wlroots
This is now a mandatory dependency for wlroots.
2021-03-30 18:22:01 +02:00
columbarius 1d62d6bfa0
config: allow whitespaces in config path 2021-03-25 17:22:26 +01:00
Ivan Fedotov 346f5a9d14 Add toggle logic inside DPMS handler
Logic that obtains current DPMS state is put inside the handler.

sway_output from which the current DPMS state will be obtained is selected by the following logic:
* For '-' and '--' the focused output is used;
* For '*' error "Cannot apply toggle to all outputs" is reported;
* For everything else all_output_by_name_or_id() is used.

Fixes #5929.
2021-03-25 11:01:04 +01:00
277 changed files with 12641 additions and 8939 deletions

View file

@ -4,22 +4,28 @@ packages:
- eudev-dev
- gdk-pixbuf-dev
- json-c-dev
- lcms2-dev
- libdisplay-info-dev
- libevdev-dev
- libinput-dev
- libseat-dev
- libxcb-dev
- libxkbcommon-dev
- mesa-dev
- meson
- pango-dev
- pcre2-dev
- pixman-dev
- scdoc
- wayland-dev
- wayland-protocols
- xcb-util-image-dev
- xwayland
- xcb-util-wm-dev
- xwayland-dev
- hwdata-dev
sources:
- https://github.com/swaywm/sway
- https://github.com/swaywm/wlroots
- https://gitlab.freedesktop.org/wlroots/wlroots.git
tasks:
- wlroots: |
cd wlroots
@ -28,11 +34,23 @@ tasks:
sudo ninja -C build install
- setup: |
cd sway
meson build -Dauto_features=enabled -Dtray=disabled
meson build --fatal-meson-warnings -Dauto_features=enabled -Dtray=disabled
- build: |
cd sway
ninja -C build
- build-no-xwayland: |
cd sway
cd wlroots
meson configure build -Dxwayland=disabled
ninja -C build
sudo ninja -C build install
cd ../sway
meson configure build --clearcache
ninja -C build
- build-static: |
cd sway
mkdir subprojects
ln -s ../../wlroots subprojects/wlroots
rm -rf build
meson build --fatal-meson-warnings --default-library=static --force-fallback-for=wlroots
ninja -C build

View file

@ -3,20 +3,26 @@ packages:
- cairo
- gdk-pixbuf2
- json-c
- lcms2
- libdisplay-info
- libegl
- libinput
- libxcb
- libxkbcommon
- meson
- pango
- pcre2
- scdoc
- wayland
- wayland-protocols
- xcb-util-image
- xcb-util-wm
- xorg-xwayland
- seatd
- hwdata
sources:
- https://github.com/swaywm/sway
- https://github.com/swaywm/wlroots
- https://gitlab.freedesktop.org/wlroots/wlroots.git
tasks:
- wlroots: |
cd wlroots
@ -25,7 +31,7 @@ tasks:
sudo ninja -C build install
- setup: |
cd sway
meson build -Dauto_features=enabled -Dsd-bus-provider=libsystemd
meson build --fatal-meson-warnings -Dauto_features=enabled -Dsd-bus-provider=libsystemd
- build: |
cd sway
ninja -C build

View file

@ -4,9 +4,11 @@ packages:
- devel/json-c
- devel/libevdev
- devel/meson
- devel/pcre2
- devel/pkgconf
- graphics/cairo
- graphics/gdk-pixbuf2
- graphics/lcms2
- graphics/wayland
- graphics/wayland-protocols
- textproc/scdoc
@ -19,13 +21,17 @@ packages:
- devel/libudev-devd
- graphics/libdrm
- graphics/mesa-libs
- sysutils/libdisplay-info
- sysutils/seatd
- x11/libinput
- x11/libX11
- x11/pixman
- x11/xcb-util-wm
- x11-servers/xwayland
- misc/hwdata
sources:
- https://github.com/swaywm/sway
- https://github.com/swaywm/wlroots
- https://gitlab.freedesktop.org/wlroots/wlroots.git
tasks:
- setup: |
cd sway
@ -33,7 +39,7 @@ tasks:
cd subprojects
ln -s ../../wlroots wlroots
cd ..
meson build -Dtray=enabled -Dsd-bus-provider=basu
meson build --fatal-meson-warnings -Dtray=enabled -Dsd-bus-provider=basu
- build: |
cd sway
ninja -C build

View file

@ -1,16 +0,0 @@
BasedOnStyle: LLVM
IndentWidth: 4
TabWidth: 4
UseTab: Always
BreakBeforeBraces: Attach
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
SortIncludes: false
ColumnLimit: 80
AlignAfterOpenBracket: DontAlign
BinPackParameters: false
BinPackArguments: false
ContinuationIndentWidth: 8
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortLoopsOnASingleLine: true
ReflowComments: false

View file

@ -6,9 +6,8 @@ labels: 'bug'
---
### Please read the following before submitting:
- Please do NOT submit bug reports for questions. Ask questions on IRC at #sway on irc.freenode.net.
- Please do NOT submit bug reports for questions. Ask questions on IRC at #sway on Libera Chat.
- Proprietary graphics drivers, including nvidia, are not supported. Please use the open source equivalents, such as nouveau, if you would like to use Sway.
- Problems with the Wayland version of Firefox are likely to be Firefox bugs. Start by submitting your issue to the Firefox Bugzilla and come back here only after they confirm otherwise.
- Please do NOT submit issues for information from the github wiki. The github wiki is community maintained and therefore may contain outdated information, scripts that don't work or obsolete workarounds.
If you fix a script or find outdated information, don't hesitate to adjust the wiki page.
@ -19,6 +18,7 @@ labels: 'bug'
- **Debug Log:**
- Run `sway -d 2> ~/sway.log` from a TTY and upload it to a pastebin, such as gist.github.com.
- This will record information about sway's activity. Please try to keep the reproduction as brief as possible and exit sway.
- Attach the **full** file, do not truncate it.
- **Configuration File:**
- Please try to produce with the default configuration.

View file

@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Questions
url: "http://webchat.freenode.net/?channels=sway&uio=d4"
about: "Please ask questions on IRC in #sway on irc.freenode.net"
url: "https://libera.chat"
about: "Please ask questions on IRC in #sway on Libera Chat"

1
.gitignore vendored
View file

@ -6,6 +6,7 @@ bin/
test/
build/
build-*/
.cache/
.lvimrc
config-debug
wayland-*-protocol.*

1
.mailmap Normal file
View file

@ -0,0 +1 @@
Ronan Pigott <ronan@rjp.ie> <rpigott@berkeley.edu>

View file

@ -1,9 +1,8 @@
# Contributing to sway
Contributing just involves sending a pull request. You will probably be more
successful with your contribution if you visit
[#sway-devel](https://webchat.freenode.net/?channels=sway-devel) on
irc.freenode.net upfront and discuss your plans.
successful with your contribution if you visit #sway-devel on Libera Chat
upfront and discuss your plans.
Note: rules are made to be broken. Adjust or ignore any/all of these as you see
fit, but be prepared to justify it to your peers.

91
README.ar.md Normal file
View file

@ -0,0 +1,91 @@
# sway
sway
هو مدير للمجموعات المركبة لـ[Wayland] متوافق مع [i3] -
إقرأ [الأسئلة الشائعة](https://github.com/swaywm/sway/wiki)
انضم الى [قناة IRC](https://web.libera.chat/gamja/?channels=#sway)
## تواقيع الإصدار
تٌوقع الإصدارات بـواسطة [E88F5E48] و تُنشر على [GitHub](https://github.com/swaywm/sway/releases)
## التثبيت
### بإستخدام الحزم
يتوفر Sway للعديد من التوزيعات، حاول تثبيت حزمة "sway" لتوزيعتك
### التجميع من المصدر
إطلع على [صفحة الويكي هذه](https://github.com/swaywm/sway/wiki/Development-Setup) إذا أردت بناء الـHEAD من sway و wlroots لأغراض الفحص والتطوير
تثبيت اللوازم:
* meson \*
* [wlroots]
* wayland
* wayland-protocols \*
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (optional: system tray)
* [scdoc] (optional: man pages) \*
* git (optional: version info) \*
_\* Compile-time dep_
نفذ هذه الأوامر:
meson build/
ninja -C build/
sudo ninja -C build/ install
## الإعدادات
إذا كنت بالفعل تستخدم i3، فعليك نسخ إعدادات i3 لديك إلى `~/.config/sway/config` وسوف تعمل تلقائياً.
و إلا عليك نسخ ملف الإعدادات النموذج إلى `config/sway/config` الموجود عادةً في `/etc/sway/config.`
## التشغيل
شغل `sway` بإستخدام أمر TTY.
قد يعمل بعض مدراء العرض مع أنهم غير مدعومون من sway
(gdm مثلاً يعمل بشكل جيد إلى حد ما)
[en]: https://github.com/swaywm/sway#readme
[ar]: README.ar.md
[cs]: README.cs.md
[de]: README.de.md
[dk]: README.dk.md
[es]: README.es.md
[fr]: README.fr.md
[ge]: README.ge.md
[gr]: README.gr.md
[hi]: README.hi.md
[hu]: README.hu.md
[ir]: README.ir.md
[it]: README.it.md
[ja]: README.ja.md
[ko]: README.ko.md
[nl]: README.nl.md
[no]: README.no.md
[pl]: README.pl.md
[pt]: README.pt.md
[ro]: README.ro.md
[ru]: README.ru.md
[sv]: README.sv.md
[tr]: README.tr.md
[uk]: README.uk.md
[zh-CN]: README.zh-CN.md
[zh-TW]: README.zh-TW.md
[i3]: https://i3wm.org/
[Wayland]: http://wayland.freedesktop.org/
[FAQ]: https://github.com/swaywm/sway/wiki
[IRC channel]: https://web.libera.chat/gamja/?channels=#sway
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
[GitHub releases]: https://github.com/swaywm/sway/releases
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc

92
README.cs.md Normal file
View file

@ -0,0 +1,92 @@
# sway
sway je s [i3] kompatibilní [Wayland] kompozitor. Přečtěte si [FAQ]. Připojte se na
[IRC kanál][IRC channel] \(#sway na irc.libera.chat).
## Podpisy vydání
Vydání jsou podepsána [E88F5E48] a publikována [na GitHubu][GitHub releases].
## Instalace
### Z balíčků
Sway je dostupný ve spoustě distribucí. Zkuste nainstalovat balíček "sway" ve vaší
distribuci.
### Kompilace ze zdrojových kódů
Podívejte se na [tuto stránku wiki][Development setup], pokud chcete sestavit HEAD
sway a wlroots pro testování nebo vývoj.
Nainstalujte závislosti:
* meson \*
* [wlroots]
* wayland
* wayland-protocols \*
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (volitelné: oznamovací oblast)
* [swaybg] (volitelné: tapeta)
* [scdoc] (volitelné: manuálové stránky) \*
* git (volitelné: informace o verzi) \*
_\* Závislost pouze pro kompilaci_
Spusťte tyto příkazy:
meson build/
ninja -C build/
sudo ninja -C build/ install
## Konfigurace
Pokud již používáte i3, zkopírujte svou konfiguraci i3 do `~/.config/sway/config`
a ta bude ihned fungovat. Jinak zkopírujte do `~/.config/sway/config` ukázkový
konfigurační soubor. Ten se obvykle nachází v `/etc/sway/config`.
Pro více informací o konfiguraci spusťte `man 5 sway`.
## Spuštění
Spusťte `sway` z TTY. Některé správce zobrazení mohou fungovat, ale nejsou
podporovány sway (je známo, že gdm funguje docela dobře).
[en]: https://github.com/swaywm/sway#readme
[ar]: README.ar.md
[cs]: README.cs.md
[de]: README.de.md
[dk]: README.dk.md
[es]: README.es.md
[fr]: README.fr.md
[ge]: README.ge.md
[gr]: README.gr.md
[hi]: README.hi.md
[hu]: README.hu.md
[ir]: README.ir.md
[it]: README.it.md
[ja]: README.ja.md
[ko]: README.ko.md
[nl]: README.nl.md
[no]: README.no.md
[pl]: README.pl.md
[pt]: README.pt.md
[ro]: README.ro.md
[ru]: README.ru.md
[sv]: README.sv.md
[tr]: README.tr.md
[uk]: README.uk.md
[zh-CN]: README.zh-CN.md
[zh-TW]: README.zh-TW.md
[i3]: https://i3wm.org/
[Wayland]: http://wayland.freedesktop.org/
[FAQ]: https://github.com/swaywm/sway/wiki
[IRC channel]: https://web.libera.chat/gamja/?channels=#sway
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
[GitHub releases]: https://github.com/swaywm/sway/releases
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
[swaybg]: https://github.com/swaywm/swaybg/
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc

View file

@ -1,30 +1,30 @@
# Sway
Sway ist ein [i3](https://i3wm.org/)-kompatibler [Wayland](http://wayland.freedesktop.org/)-Compositor. Lies die [FAQ](https://github.com/swaywm/sway/wiki). Tritt dem [IRC Channel](http://webchat.freenode.net/?channels=sway&uio=d4) bei (#sway on irc.freenode.net; Englisch).
Sway ist ein [i3](https://i3wm.org/)-kompatibler [Wayland](http://wayland.freedesktop.org/)-Compositor. Lies die [FAQ](https://github.com/swaywm/sway/wiki). Tritt dem [IRC Channel](https://web.libera.chat/gamja/?channels=#sway) bei (#sway on irc.libera.chat; Englisch).
## Signaturen
Jedes Release wird mit dem PGP-Schlüssel [B22DA89A](http://pgp.mit.edu/pks/lookup?op=vindex&search=0x52CB6609B22DA89A) signiert und auf GitHub veröffentlicht.
Jedes Release wird mit dem PGP-Schlüssel [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48) signiert und [auf GitHub](https://github.com/swaywm/sway/releases) veröffentlicht.
## Installation
### Mit der Paketverwaltung
Sway kann in vielen Distributionen direkt durch die Paketverwaltung installiert werden. Das Paket sollte "sway" heißen. Falls es kein solches Paket gibt, kannst du im [Wiki](https://github.com/swaywm/sway/wiki/Unsupported-packages) (englisch) nach mehr Informationen bezüglich deiner Distribution suchen.
Falls du sway für deine eigene Distribution als Paket bereitstellen möchtest, solltest du die Entwickler per IRC oder E-Mail (sir@cmpwn.com) kontaktieren.
### Über die Paketverwaltung
Sway kann in vielen Distributionen direkt durch die Paketverwaltung installiert werden. Versuche einfach das Packet "sway" zu installieren.
### Quellcode selbst kompilieren
sway benötigt die folgenden Pakete:
* meson\*
* [wlroots](https://github.com/swaywm/wlroots)
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
* wayland
* wayland-protocols\*
* pcre
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (Optional, wird für das Benachrichtigungsfeld (System Tray) benötigt)
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc)\* (Optional, wird für die Dokumentation (Man Pages) benötigt)
* git\*
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (Optional, wird für die Dokumentation (Man Pages) benötigt)\*
* git (Optional: Versionsinfo)\*
_\*Werden nur während des Kompilierens benötigt_
@ -34,12 +34,6 @@ Führe die folgenden Befehle aus:
ninja -C build
sudo ninja -C build install
Falls dein System nicht logind benutzt, musst du sway noch die passenden Berechtigungen geben:
sudo chmod a+s /usr/local/bin/sway
Sway läuft nur in der Startphase mit Root-Rechten.
## Konfiguration
Falls du von i3 migrierst, kannst du deine Konfigurationsdatei nach `~/.config/sway/config` kopieren und die Einstellungen sollten ohne Weiteres funktionieren. Ansonsten kannst du die Beispielkonfiguration, die normalerweise in `/etc/sway/config` liegt, nach `~/.config/sway/config` kopieren. Die Dokumentation zur Konfigurationsdatei findest du in `man 5 sway`.

View file

@ -1,41 +1,43 @@
# Sway
Sway er en [i3](https://i3wm.org/)-kompatibel [Wayland](http://wayland.freedesktop.org/) compositor.
Læs [Ofte stillede spørgsmål](https://github.com/swaywm/sway/wiki).
Deltag på [IRC kanalen](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway på irc.freenode.net).
Sway er en [i3]-kompatibel [Wayland] compositor. Læs [Ofte stillede spørgsmål].
Deltag på [IRC kanalen][IRC kanal] \(#sway på irc.libera.chat).
## Udgivelses Signaturer
Udgivelser er signeret med [B22DA89A](http://pgp.mit.edu/pks/lookup?op=vindex&search=0x52CB6609B22DA89A)
og publiseret på [GitHub](https://github.com/swaywm/sway/releases).
Udgivelser er signeret med [E88F5E48] og publiceret [på GitHub][GitHub
releases].
## Installation
### Fra Pakker
### Fra pakker
Sway er tilgængelig i mange distributioner. Prøv at installere pakken "sway". Hvis den ikke er tilgængelig, så tjek [denne wiki-side](https://github.com/swaywm/sway/wiki/Unsupported-packages)
for information om installation til din(e) distribution(er).
Sway er tilgængelig i mange distributioner. Prøv at installere "sway" pakken
fra din.
Hvis du er interesseret i at lave en Sway pakke til din distribution, burde du besøge IRC
kanalen eller sende en e-mail til sir@cmpwn.com for rådgivning.
Hvis du er interesseret i at pakke Sway til din distribution, kan du tage forbi
IRC kanalen eller sende en email til sir@cmpwn.com for rådgivning.
### Kompilering fra kildekode
Installation afhænger af følgende programmer:
Se [denne wiki-side][Opsætning til udvikling] hvis du vil bygge HEAD af sway og
wlroots til test eller udvikling.
Installationsafhængigheder:
* meson \*
* [wlroots](https://github.com/swaywm/wlroots)
* [wlroots]
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (valgfrit tillæg: system tray)
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (valgfrit tillæg: man pages) \*
* gdk-pixbuf2 (valgfrit: system tray)
* [scdoc] (valgfrit: man pages) \*
* git \*
_\*Kompiler krav_
_\*Kompileringsafhængighed_
Kør følgende kommandoer:
@ -43,21 +45,24 @@ Kør følgende kommandoer:
ninja -C build
sudo ninja -C build install
På systemer uden 'logind', behøver du at sætte ejerens bruger-id for Sways eksekverbare filer - såkaldt SUID (Set owner User ID):
sudo chmod a+s /usr/local/bin/sway
Sway vil frasige sig 'root' tilladelser kort efter opstart
## Konfiguration
Hvis du allerede bruger i3, bør du kopiere din i3-konfiguration til `~/.config/sway/config` og
det vil bare fungerer. Ellers skal du kopiere eksempel konfigurations filen til
`~/.config/sway/config`. Den er normalt placeret i `/etc/sway/config`.
Kør `man 5 sway` for at få oplysninger om konfigurationen.
Hvis du allerede bruger i3 kan du bare kopiere din i3 konfiguration til
`~/.config/sway/config`. Ellers skal du kopiere eksempelkonfigurationsfilen til
`~/.config/sway/config`. Den er normalt placeret i `/etc/sway/config`. Kør
`man 5 sway` for at få oplysninger om konfigurationen.
## Kører
## Eksekvering
Kør `sway` fra en TTY. Nogle display managers fungerer muligvis, men understøttes ikke af
Sway (gdm er kendt for at fungere temmelig godt).
Kør `sway` fra en TTY. Nogle display managers kan fungere, men Sway yder ikke
support til dem (gdm er kendt for at fungere temmelig godt).
[i3]: https://i3wm.org/
[Wayland]: http://wayland.freedesktop.org/
[Ofte stillede spørgsmål]: https://github.com/swaywm/sway/wiki
[IRC kanal]: https://web.libera.chat/gamja/?channels=#sway
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
[GitHub releases]: https://github.com/swaywm/sway/releases
[Opsætning til udvikling]: https://github.com/swaywm/sway/wiki/Development-Setup
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc

View file

@ -1,12 +1,12 @@
# sway
sway es un compositor de [Wayland](http://wayland.freedesktop.org/) compatible con [i3](https://i3wm.org/).
Lea el [FAQ](https://github.com/swaywm/sway/wiki). Únase al [canal de IRC](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway on
irc.freenode.net).
Lea el [FAQ](https://github.com/swaywm/sway/wiki). Únase al [canal de IRC](https://web.libera.chat/gamja/?channels=#sway) (#sway on
irc.libera.chat).
## Firmas de las versiones
Las distintas versiones están firmadas con [B22DA89A](http://pgp.mit.edu/pks/lookup?op=vindex&search=0x52CB6609B22DA89A)
Las distintas versiones están firmadas con [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48)
y publicadas [en GitHub](https://github.com/swaywm/sway/releases).
## Instalación
@ -25,10 +25,10 @@ escriba un email a sir@cmpwn.com
Instale las dependencias:
* meson \*
* [wlroots](https://github.com/swaywm/wlroots)
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
@ -44,12 +44,6 @@ Desde su consola, ejecute las órdenes:
ninja -C build
sudo ninja -C build install
En sistemas sin `logind`, necesitará cambiar los permisos del archivo compilado de sway:
sudo chmod a+s /usr/local/bin/sway
Sway abandonará los permisos de super-usuario al poco de arrancar.
## Configuración
Si ya utiliza i3, copie su archivo de configuración de i3 a `~/.config/sway/config` y

View file

@ -1,7 +1,7 @@
# sway
Sway est un compositeur [Wayland] compatible avec [i3]. Lisez la
[FAQ]. Rejoignez le [canal IRC] (#sway sur irc.freenode.net).
[FAQ]. Rejoignez le [canal IRC] (#sway sur irc.libera.chat).
## Aide en français
@ -35,7 +35,7 @@ Installez les dépendances :
* [wlroots]
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
@ -51,12 +51,6 @@ Exécutez ces commandes :
ninja -C build
sudo ninja -C build install
Sur les systèmes sans logind, vous devez suid le binaire de sway :
sudo chmod a+s /usr/local/bin/sway
Sway se débarassera des permissions *root* peu de temps après le démarrage.
## Configuration
Si vous utilisez déjà i3, copiez votre configuration i3 vers
@ -74,10 +68,10 @@ bien fonctionner).
[Wayland]: http://wayland.freedesktop.org/
[i3]: https://i3wm.org/
[FAQ]: https://github.com/swaywm/sway/wiki
[canal IRC]: http://webchat.freenode.net/?channels=sway&uio=d4
[canal IRC]: https://web.libera.chat/gamja/?channels=#sway
[abdelq]: https://github.com/abdelq
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
[versions GitHub]: https://github.com/swaywm/sway/releases
[Configuration de développement]: https://github.com/swaywm/sway/wiki/Development-Setup
[wlroots]: https://github.com/swaywm/wlroots
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc

61
README.ge.md Normal file
View file

@ -0,0 +1,61 @@
# sway
sway არის [i3]-თავსებადი [Wayland]-ის კომპოზიტორი. მეტი ინფორმაციისთვის იხილეთ
[FAQ]. დაუკავშირდით [IRC არხს][IRC channel] \(#sway irc.libera.chat-ზე).
## გამოშვების ხელმოწერები
გამოშვებები ხელმოწერილია [E88F5E48]-ით და გამოქვეყნებულია [GitHub-ზე][GitHub releases].
## ინსტალაცია
### რეპოზიტორიიდან
Sway არის ხელმისაწვდომი ბევრი დისტრიბუტაციისთვის. ცადეთ "sway" პაკეტის ინსტალაცია თქვენთვის.
### კოდის კომპილაცია
იხილეთ [ეს ვიკი გვერდი][Development setup] თუ გინდათ რომ ააწყოთ sway და wlroots სატესტოდ ან დეველოპმენტისთვის.
დააინსტალირეთ დამოკიდებულებები:
* meson \*
* [wlroots]
* wayland
* wayland-protocols \*
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (ასევე არჩევითია: system tray)
* [scdoc] (ასევე არჩევითია: man pages) \*
* git (ასევე არჩევითია: version info) \*
_\* Compile-time dep_
გაუშვით ეს ბრძანებები:
meson build/
ninja -C build/
sudo ninja -C build/ install
## კონფიგურაცია
თუ უკვე იყენებთ i3-ს, მაშინ დააკოპირე i3 კონფიგურაცია და ჩასვი `~/.config/sway/config`
და უპრობლემოდ იმუშავებს პირდაპირ. წინააღმდეგ შემთხვევაში კონფიგურაციის ნიმუში ჩააკოპირეთ აქ: `~/.config/sway/config`. კომპიგურაციის ნიმუში ხშირ შემთხვევაში არის `/etc/sway/config`.
გაუშვი `man 5 sway` კონპიგურაციაზე ინფორმაციის მისაღებად.
## გაშვება
გაუშვი `sway` TTY-ისთვის. ზოგიერთმა ლოგინ მენეჯერმა შეიძლება იმუშავოს, მაგრამ არ
არის მხარდაჭერილი sway-სგან (როგორც წესი კარგად მუშაობს gdm).
[i3]: https://i3wm.org/
[Wayland]: http://wayland.freedesktop.org/
[FAQ]: https://github.com/swaywm/sway/wiki
[IRC channel]: https://web.libera.chat/gamja/?channels=#sway
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
[GitHub releases]: https://github.com/swaywm/sway/releases
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc

67
README.gr.md Normal file
View file

@ -0,0 +1,67 @@
# Sway
Το sway ένα [i3]-συμβατό [Wayland] compositor. Διαβάστε το [FAQ]. Μπείτε στο
[IRC channel] \(#sway on irc.libera.chat).
## Υπογραφές δημοσιεύσεων
Οι εκδόσεις είναι υπογεραμμένες με [E88F5E48] και δημοσιευμένες [στο GitHub][GitHub releases].
## Εγκατάσταση
### Από πακέτα
Το Sway είναι διαθέσιμο σε πολλά distributions. Δοκιμάστε εγκαταστώντας το "sway" package για
το δικό σας.
Εάν ενδιαφέρεστε για packaging του sway για το distribution σας, να πάτε στο IRC
channel ή στείλτε ένα email στο sir@cmpwn.com για συμβουλές.
### Compiling από πηγή
Τσεκάρετε [αυτό το wiki page][Development setup] εάμα θέλετε να κάνετε build το HEAD του
sway και wlroots γιά τεστάρισμα ή development.
Εγκατάσταση των dependencies:
* meson \*
* [wlroots]
* wayland
* wayland-protocols \*
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (προαιρετικό: system tray)
* [scdoc] (προαιρετικό: man pages) \*
* git (προαιρετικό: πληροφορίες εκδώσεων) \*
_\*Compile-time dep_
Τρέξτε αυτά τα commands:
meson build/
ninja -C build/
sudo ninja -C build/ install
## Configuration
Εάν ήδη χρησιμοποιήτε το i3, αντιγράψτε το i3 config σας στο `~/.config/sway/config` και
θα δουλέψει out of the box. Αλλιώς, αντιγράψτε το sample configuration αρχείο στο
`~/.config/sway/config`. Το οποίο συνήθως βρίσκεται στο `/etc/sway/config`.
Κάντε run `man 5 sway` για πληροφορίες τού configuration.
## Τρέχοντας
Τρέξτε `sway` από ένα TTY. Μερίκα display managers μπορεί να δουλέψουν αλλά δέν είναι συμβατά με
το sway (το gdm γνωρίζεται να δουλέβει σχετικά καλά).
[i3]: https://i3wm.org/
[Wayland]: http://wayland.freedesktop.org/
[FAQ]: https://github.com/swaywm/sway/wiki
[IRC channel]: https://web.libera.chat/gamja/?channels=#sway
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
[GitHub releases]: https://github.com/swaywm/sway/releases
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc

63
README.hi.md Normal file
View file

@ -0,0 +1,63 @@
# sway
sway एक [i3](https://i3wm.org/)-अनुकूल
[Wayland](https://wayland.freedesktop.org/) Compositor है।
[FAQ](https://github.com/swaywm/sway/wiki) पढिये। [IRC
Channel](https://web.libera.chat/gamja/?channels=#sway)
(irc.libera.chat पर #sway) में भी जुडिये।
## रिलीज हस्ताक्षर
रिलीजें
[E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48)
से साइन होतें हैं और [Github पर](https://github.com/swaywm/sway/releases) प्रकाशित होते हैं।
## इंस्टौलेशन
### पैकेजों के द्वारा
Sway कई distributions में उप्लब्ध है। आप अपने में "sway" नामक पैकेज इंस्टौल करके देख
सकते हैं।
### Source से compile करके
यदि आप परीक्षण और विकास के लिए sway और wlroots के नवीनतम संस्करण बनाना
चाहते हैं, तो [यह विकी
पृष्ठ](https://github.com/swaywm/sway/wiki/Development-Setup) देखें।
निर्भरताएं:
* meson \*
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
* wayland
* wayland-protocols \*
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf (वैकल्पिक: system tray के लिये)
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (वैकल्पिक: man पृष्ठों के लिये)
\*
* git (वैकल्पिक: संस्करण जानने के लिये)
_\* Compilation के समय आवश्यक_
ये commands चलाएं:
meson build/
ninja -C build/
sudo ninja -C build/ install
## Configuration
अगर आप पहले से ही i3 का उपयोग करते हैं तो अपने i3 config को
`~/.config/sway/config` में copy कर लीजिये और वह बिना किसी परिवर्तन के काम
करेगा। अन्यथा, नमूने configuration file को `~/.config/sway/config` में copy
कर लीजिये। यह सामान्यतः `/etc/sway/config` में पाया जाता है। `man 5
sway` से आप configuration के बारे में जानकारी प्राप्त कर सकते हैं।
## चलाना
आप एक tty से `sway` को चला सकते हैं। कुछ display managers काम करते हैं परन्तु ये
sway के द्वारा समर्थित नहीं है (gdm के बारे में जाना गया है कि वह सही काम करता
है)।

70
README.hu.md Normal file
View file

@ -0,0 +1,70 @@
# sway
A Sway egy [i3]-kompatibilis [Wayland] kompozitor. Olvasd el a [Gyarkan Ismételt Kérdéseket][FAQ]. Csatlakozz az [IRC csatornához][IRC channel] \(`#sway` az `irc.libera.chat`-en).
## Csomag aláírások
A kiadott csomagok az [E88F5E48] kulccsal vannak aláírva és [GitHub-on][GitHub releases] publikálva.
## Telepítés
### Csomagból
A Sway sok disztribúció csomagkezelőjéből elérhető, próbáld meg a "sway"
csomagot telepíteni az általad használt eszközzel.
Ha szeretnél csomagot készíteni a saját disztribúciódhoz, ugorj be az IRC
csatornára, vagy küldj levelet a sir@cmpwn.com címre tanácsokért.
### Fordítás forráskódból
Olvasd el [ezt a wiki oldalt][Development setup], ha szeretnéd tesztelési vagy
fejlesztési célokból lefordítani az aktuális (HEAD) állapotát a `sway`-nek és a
`wlroots`-nak.
Telepítsd a függőségeket:
* meson \*
* [wlroots]
* wayland
* wayland-protocols \*
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (opcionális: system tray)
* [scdoc] (opcionális: man pages) \*
* git (opcionális: version info) \*
_\*Fordításidejű függőség_
Futtasd ezeket a parancsokat:
meson build
ninja -C build
sudo ninja -C build install
## Konfiguráció
Ha előzőleg i3-mat használtál, akkor átmásolhatod az i3 beállításaidat a
`~/.config/sway/config` file-ba és ugyanúgy működni fognak. Egyéb esetben másold
le kiindulási alapnak a mintát, ami általában az `etc/sway/config` elérési
útvonalon található.
Futtasd a `man 5 sway` parancsot további információért a konfigurációval
kapcsolatban.
## Futtatás
Futtasd a `sway` parancsot egy TTY felületről. Néhány bejelentkezéskezelő
(display manager) működhet, de alapvetően nem támogatottak a sway által. (A
gdm-ről ismeretes, hogy egész jól működik.)
[i3]: https://i3wm.org/
[Wayland]: http://wayland.freedesktop.org/
[FAQ]: https://github.com/swaywm/sway/wiki
[IRC channel]: https://web.libera.chat/gamja/?channels=#sway
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
[GitHub releases]: https://github.com/swaywm/sway/releases
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc

54
README.ir.md Normal file
View file

@ -0,0 +1,54 @@
# sway
&rlm;sway یک کامپوزیتور الهام گرفته از [i3](https://i3wm.org/) بر روی [Wayland](http://wayland.freedesktop.org/) است. [سوال‌های متداول](https://github.com/swaywm/sway/wiki) را بخوانید. در [کانال
IRC](http://web.libera.chat/gamja/?channels=sway&uio=d4) عضو شوید (&lrm;#sway&rlm; در
irc.libera.chat).
برای حمایت از تیم توسعه sway به [صفحه
Patreon با نام کاربری SirCmpwn](https://patreon.com/sircmpwn) مراجعه کنید.
## امضای نسخه‌ها
امضای نسخه‌ها با [B22DA89A](http://pgp.mit.edu/pks/lookup?op=vindex&search=0x52CB6609B22DA89A) در [GitHub](https://github.com/swaywm/sway/releases) منتشر می‌شود.
## شیوه نصب
### از بسته‌های رسمی
&rlm;sway در بسته‌های رسمی توزیع‌های مختلف وجود دارد. بسته «sway» را نصب کنید. در صورتی که بسته رسمی وجود نداشت، برای آگاهی بیشتر درباره نصب روی توزیعتان به این [صفحه راهنما](https://github.com/swaywm/sway/wiki/Unsupported-packages) مراجعه کنید.
اگر به ایجاد بسته sway برای توزیعتان علاقه‌مند هستید، از کانال IRC استفاده کنید یا به sir@cmpwn.com ایمیل بزنید.
### کامپایل کردن کد
چنانچه می‌خواهید آخرین نسخه کد sway و wlroots را برای آزمایش یا توسعه بسازید به این [صفحه راهنما](https://github.com/swaywm/sway/wiki/Development-Setup) مراجعه کنید.
بسته‌های مورد نیاز:
* meson \*
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
* wayland
* wayland-protocols \*
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (انتخابی: برای system tray)
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (انتخابی: برای صفحه‌های راهنما) \*
* git (انتخابی: برای اطلاع در خصوص نسخه‌ها) \*
_\*نیازمندی‌های زمان کامپایل برنامه_
این فرمان‌ها را اجرا کنید:
meson build
ninja -C build
sudo ninja -C build install
### شخصی سازی و تنظیمات
اگر در حال حاضر از i3 استفاده می‌کنید، تنظیمات i3 خودتان را در فایل `~/.config/sway/config` کپی کنید و بدون نیاز به تغییر کار خواهد کرد. در غیر این‌صورت، فایل نمونه تنظیمات را استفاده کنید. این فایل عموما در `/etc/sway/config` قرار دارد. برای آگاهی بیشتر `man 5 sway` را اجرا کنید.
## اجرا
در محیط TTY کافیست `sway` را اجرا کنید. ممکن است ابزارهای مدیریت نمایشگری نیز برای این کار وجود داشته باشند اما از طرف sway پشتیبانی نمی‌شوند (gdm عملکرد خوبی در این زمینه دارد).

66
README.it.md Normal file
View file

@ -0,0 +1,66 @@
# sway
sway è un compositore di [Wayland] compatibile con [i3]. Leggi le [FAQ].
Unisciti al [canale di IRC] \(#sway su irc.libera.chat).
## Firma delle versioni
Le versioni sono firmate con la chiave [E88F5E48] e sono pubblicate
[su GitHub][GitHub releases].
## Installazione
### Da un pacchetto
Sway è disponibile in molte distribuzioni, prova a installare il pacchetto
"sway" per la tua.
### Compilazione dei sorgenti
Consulta [questa pagina del wiki][Development setup] se vuoi compilare l'HEAD
di sway e wlroots per testarli o contribuire allo sviluppo.
Installa le dipendenze:
* meson \*
* [wlroots]
* wayland
* wayland-protocols \*
* pcre
* json-c
* pango
* cairo
* gdk-pixbuf2 (opzionale: area di notifica)
* [scdoc] (opzionale: pagine del manuale) \*
* git (opzionale: informazioni sulla versione) \*
_\* Dipendenza necessaria per la compilazione_
Esegui questi comandi:
meson build/
ninja -C build/
sudo ninja -C build/ install
## Configurazione
Se hai già usato i3, copia il tuo file di configurazione in
`~/.config/sway/config` e sway funzionerà immediatamente. Altrimenti, copia il
file d'esempio in `~/.config/sway/config`, generalmente è situato in
`/etc/sway/config`. Consulta `man 5 sway` per ulteriori informazioni sulla
configurazione.
## Esecuzione
Lancia `sway` da un TTY. Alcuni gestori d'accesso potrebbero funzionare ma non
sono supportati da sway (gdm funziona abbastanza bene).
[i3]: https://i3wm.org/
[Wayland]: http://wayland.freedesktop.org/
[FAQ]: https://github.com/swaywm/sway/wiki
[canale di IRC]: https://web.libera.chat/gamja/?channels=#sway
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
[GitHub releases]: https://github.com/swaywm/sway/releases
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc

View file

@ -2,7 +2,7 @@
Swayは[i3](https://i3wm.org/)互換な[Wayland](http://wayland.freedesktop.org/)コンポジタです。
[FAQ](https://github.com/swaywm/sway/wiki)も合わせてご覧ください。
[IRC チャンネル](http://webchat.freenode.net/?channels=sway&uio=d4) (irc.freenode.netの#sway)もあります。
[IRC チャンネル](https://web.libera.chat/gamja/?channels=#sway) (irc.libera.chatの#sway)もあります。
[![](https://sr.ht/ICd5.png)](https://sr.ht/ICd5.png)
@ -12,7 +12,7 @@ SirCmpwnは、日本語でのサポートをIRCとGitHubで行います。タイ
## リリースの署名
Swayのリリースは[B22DA89A](http://pgp.mit.edu/pks/lookup?op=vindex&search=0x52CB6609B22DA89A)で署名され、[GitHub](https://github.com/swaywm/sway/releases)で公開されています。
Swayのリリースは[E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48)で署名され、[GitHub](https://github.com/swaywm/sway/releases)で公開されています。
## インストール
@ -27,18 +27,18 @@ Swayは沢山のディストリビューションで提供されています。"
次の依存パッケージをインストールしてください:
* meson \*
* [wlroots](https://github.com/swaywm/wlroots)
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (システムイコンで必要です)
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (manで必要です) \*
* git \*
* gdk-pixbuf2 (任意: システムイコンで必要です)
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (任意: manで必要です) \*
* git (任意: バージョン情報で必要です) \*
_\*コンパイル時_
_\*コンパイル時の依存_
次のコマンドを実行してください:
@ -46,12 +46,6 @@ _\*コンパイルの時_
ninja -C build
sudo ninja -C build install
logindを使用していないシステムでは、バイナリにsuidを設定する必要があります:
sudo chmod a+s /usr/local/bin/sway
swayは起動後、すぐにroot許可を落とします。
## 設定
既にi3を使用している場合は、i3の設定ファイルを`~/.config/sway/config`にコピーすれば動きます。そうでない場合は、サンプルの設定ファイルを`~/.config/sway/config`にコピーしてください。サンプルの設定ファイルは、通常`/etc/sway/config`にあります。`man 5 sway`を実行することで、設定に関する情報を見ることができます。

View file

@ -1,11 +1,11 @@
# sway
sway는 [i3](https://i3wm.org/)-호환 [Wayland](http://wayland.freedesktop.org/) 컴포지터입니다.
[FAQ](https://github.com/swaywm/sway/wiki)를 읽어보세요. [IRC 채널](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway on irc.freenode.net)도 있습니다.
[FAQ](https://github.com/swaywm/sway/wiki)를 읽어보세요. [IRC 채널](https://web.libera.chat/gamja/?channels=#sway) (#sway on irc.libera.chat)도 있습니다.
## 릴리즈 서명
릴리즈는 [B22DA89A](http://pgp.mit.edu/pks/lookup?op=vindex&search=0x52CB6609B22DA89A)에서 서명되고,
릴리즈는 [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48)에서 서명되고,
[GitHub에서](https://github.com/swaywm/sway/releases) 공개되고 있습니다.
## 설치
@ -24,10 +24,10 @@ IRC 채널을 방문하거나 sir@cmpwn.com으로 이메일을 보내 상담 받
다음 의존 패키지들을 설치해 주세요:
* meson \*
* [wlroots](https://github.com/swaywm/wlroots)
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
@ -43,12 +43,6 @@ _\*컴파일 떄 필요_
ninja -C build
sudo ninja -C build install
logind를 사용하고 있지 않는 시스템에서는, 바이너리에 suid를 설정할 필요가 있습니다:
sudo chmod a+s /usr/local/bin/sway
Sway는 시작 후에 root 권한을 drop할 것 입니다.
## 설정
i3를 이미 사용 중이라면, i3 config을 `~/.config/sway/config`로 복사하세요.

View file

@ -1,9 +1,9 @@
# sway
**[English][en]** - [日本語][ja] - [Français][fr] - [Українська][uk] - [Español][es] - [Polski][pl] - [中文-简体][zh-CN] - [Deutsch][de] - [Nederlands][nl] - [Русский][ru] - [中文-繁體][zh-TW] - [Português][pt] - [Danish][dk] - [한국어][ko] - [Română][ro]
**[English][en]** - [عربي][ar] - [Česky][cs] - [Deutsch][de] - [Dansk][dk] - [Español][es] - [Français][fr] - [ქართული][ge] - [Ελληνικά][gr] - [हिन्दी][hi] - [Magyar][hu] - [فارسی][ir] - [Italiano][it] - [日本語][ja] - [한국어][ko] - [Nederlands][nl] - [Norsk][no] - [Polski][pl] - [Português][pt] - [Română][ro] - [Русский][ru] - [Svenska][sv] - [Türkçe][tr] - [Українська][uk] - [中文-简体][zh-CN] - [中文-繁體][zh-TW]
sway is an [i3]-compatible [Wayland] compositor. Read the [FAQ]. Join the
[IRC channel] \(#sway on irc.freenode.net).
[IRC channel] \(#sway on irc.libera.chat).
## Release Signatures
@ -16,9 +16,6 @@ Releases are signed with [E88F5E48] and published [on GitHub][GitHub releases].
Sway is available in many distributions. Try installing the "sway" package for
yours.
If you're interested in packaging sway for your distribution, stop by the IRC
channel or shoot an email to sir@cmpwn.com for advice.
### Compiling from Source
Check out [this wiki page][Development setup] if you want to build the HEAD of
@ -30,27 +27,22 @@ Install dependencies:
* [wlroots]
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (optional: system tray)
* gdk-pixbuf2 (optional: additional image formats for system tray)
* [swaybg] (optional: wallpaper)
* [scdoc] (optional: man pages) \*
* git (optional: version info) \*
_\*Compile-time dep_
_\* Compile-time dep_
Run these commands:
meson build
ninja -C build
sudo ninja -C build install
On systems without logind, you need to suid the sway binary:
sudo chmod a+s /usr/local/bin/sway
Sway will drop root permissions shortly after startup.
meson build/
ninja -C build/
sudo ninja -C build/ install
## Configuration
@ -65,26 +57,38 @@ Run `sway` from a TTY. Some display managers may work but are not supported by
sway (gdm is known to work fairly well).
[en]: https://github.com/swaywm/sway#readme
[ja]: https://github.com/swaywm/sway/blob/master/README.ja.md
[fr]: https://github.com/swaywm/sway/blob/master/README.fr.md
[uk]: https://github.com/swaywm/sway/blob/master/README.uk.md
[es]: https://github.com/swaywm/sway/blob/master/README.es.md
[pl]: https://github.com/swaywm/sway/blob/master/README.pl.md
[zh-CN]: https://github.com/swaywm/sway/blob/master/README.zh-CN.md
[de]: https://github.com/swaywm/sway/blob/master/README.de.md
[nl]: https://github.com/swaywm/sway/blob/master/README.nl.md
[ru]: https://github.com/swaywm/sway/blob/master/README.ru.md
[zh-TW]: https://github.com/swaywm/sway/blob/master/README.zh-TW.md
[pt]: https://github.com/swaywm/sway/blob/master/README.pt.md
[dk]: https://github.com/swaywm/sway/blob/master/README.dk.md
[ko]: https://github.com/swaywm/sway/blob/master/README.ko.md
[ro]: https://github.com/swaywm/sway/blob/master/README.ro.md
[ar]: README.ar.md
[cs]: README.cs.md
[de]: README.de.md
[dk]: README.dk.md
[es]: README.es.md
[fr]: README.fr.md
[ge]: README.ge.md
[gr]: README.gr.md
[hi]: README.hi.md
[hu]: README.hu.md
[ir]: README.ir.md
[it]: README.it.md
[ja]: README.ja.md
[ko]: README.ko.md
[nl]: README.nl.md
[no]: README.no.md
[pl]: README.pl.md
[pt]: README.pt.md
[ro]: README.ro.md
[ru]: README.ru.md
[sv]: README.sv.md
[tr]: README.tr.md
[uk]: README.uk.md
[zh-CN]: README.zh-CN.md
[zh-TW]: README.zh-TW.md
[i3]: https://i3wm.org/
[Wayland]: http://wayland.freedesktop.org/
[FAQ]: https://github.com/swaywm/sway/wiki
[IRC channel]: http://webchat.freenode.net/?channels=sway&uio=d4
[IRC channel]: https://web.libera.chat/gamja/?channels=#sway
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
[GitHub releases]: https://github.com/swaywm/sway/releases
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
[wlroots]: https://github.com/swaywm/wlroots
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
[swaybg]: https://github.com/swaywm/swaybg/
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc

View file

@ -2,12 +2,12 @@
Sway is een [i3](https://i3wm.org/)-compatibele [Wayland](http://wayland.freedesktop.org/) compositor.
Lees de [FAQ](https://github.com/swaywm/sway/wiki). Word lid van het [IRC
kanaal](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway op
irc.freenode.net).
kanaal](https://web.libera.chat/gamja/?channels=#sway) (#sway op
irc.libera.chat).
## Releasehandtekeningen
Releases worden ondertekend met [B22DA89A](http://pgp.mit.edu/pks/lookup?op=vindex&search=0x52CB6609B22DA89A)
Releases worden ondertekend met [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48)
en gepubliceerd [op GitHub](https://github.com/swaywm/sway/releases).
## Installatie
@ -25,10 +25,10 @@ kanaal of stuur een e-mail naar sir@cmpwn.com voor advies.
Afhankelijkheden installeren:
* meson \*
* [wlroots](https://github.com/swaywm/wlroots)
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
@ -44,12 +44,6 @@ Voer deze opdrachten uit:
ninja -C build
sudo ninja -C build install
Op systemen zonder logind, moet je bij het binaire bestand het suid bit instellen:
sudo chmod a+s /usr/local/bin/sway
Sway zal root-rechten kort na het opstarten loslaten.
## Configuratie
Als je al i3 gebruikt, kopieer dan je i3-configuratie naar `~/.config/sway/config` en

68
README.no.md Normal file
View file

@ -0,0 +1,68 @@
# Sway
Sway er en [i3]-kompatibel [Wayland] compositor. Les [Ofte stilte spørsmål].
Delta på [IRC kanalen][IRC kanal] \(#sway på irc.libera.chat).
## Utgivelses Signaturer
Utgivelser er signert med [E88F5E48] og publisert [på GitHub][GitHub
releases].
## Installasjon
### Fra system pakker
Sway er tilgjengelig i mange distribusjoner. Prøv å installere "sway" pakken
fra din distro sine repoer.
Er du interessert i å pakke Sway for din distribusjon kan du ta turen innom
IRC-kanalen eller send en e-post til sir@cmpwn.com for råd.
### Kompilering fra kildekode
Se [denne wiki-siden][Oppsetting for utvikling] hvis du vil bygge fra HEAD grenen av sway og
wlroots for testing eller utvikling.
Installasjonsavhengigheter:
* meson \*
* [wlroots]
* wayland
* wayland-protocols \*
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (valgfritt: system tray)
* [scdoc] (valgfritt: man pages) \*
* git \*
_\*Kompileringsavhengigheter_
Kjør følgende kommandoer:
meson build
ninja -C build
sudo ninja -C build install
## Konfigurasjon
Hvis du allerede bruker i3 kan du bare kopiere din i3 konfigurasjon til
`~/.config/sway/config`. Ellers skal du kopiere eksempel konfigurasjonsfilen til
`~/.config/sway/config`. Eksempel filen er normalt plasert i `/etc/sway/config`. Kjør
`man 5 sway` for å få oplysninger om konfigurasjonen.
## Utførelse
Kjør `sway` fra en TTY. Noen display managers kan fungere, men Sway har ikke
støtte for dem (gdm er kjent for å fungere ganske bra).
[i3]: https://i3wm.org/
[Wayland]: http://wayland.freedesktop.org/
[Ofte stilte spørsmål]: https://github.com/swaywm/sway/wiki
[IRC kanal]: https://web.libera.chat/gamja/?channels=#sway
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
[GitHub releases]: https://github.com/swaywm/sway/releases
[Oppsetting for utvikling]: https://github.com/swaywm/sway/wiki/Development-Setup
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc

View file

@ -1,12 +1,12 @@
# sway
sway jest kompozytorem [Wayland](http://wayland.freedesktop.org/) kompatybilnym z [i3](https://i3wm.org/).
Przeczytaj [FAQ](https://github.com/swaywm/sway/wiki). Dołącz do [kanału IRC](http://webchat.freenode.net/?channels=sway&uio=d4)
(#sway na irc.freenode.net).
Przeczytaj [FAQ](https://github.com/swaywm/sway/wiki). Dołącz do [kanału IRC](https://web.libera.chat/gamja/?channels=#sway)
(#sway na irc.libera.chat).
## Podpisy cyfrowe wydań
Wydania są podpisywane przy pomocy klucza [B22DA89A](http://pgp.mit.edu/pks/lookup?op=vindex&search=0x52CB6609B22DA89A)
Wydania są podpisywane przy pomocy klucza [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48)
i publikowane [na GitHubie](https://github.com/swaywm/sway/releases).
## Instalacja
@ -25,10 +25,10 @@ adres sir@cmpwn.com w celu uzyskania wskazówek.
Zainstaluj zależności:
* meson \*
* [wlroots](https://github.com/swaywm/wlroots)
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
@ -44,12 +44,6 @@ Wykonaj następujące polecenia:
ninja -C build
sudo ninja -C build install
Na systemach bez logind należy wykonać polecenie suid na pliku wykonywalnym sway:
sudo chmod a+s /usr/local/bin/sway
Sway pozbędzie się uprawnień roota tuż po wystartowaniu.
## Konfiguracja
Jeśli już korzystasz z i3, skopiuj swoją konfigurację i3 do katalogu `~/.config/sway/config` i

View file

@ -2,12 +2,12 @@
O sway é um compositor do [Wayland](http://wayland.freedesktop.org/) compatível com o [i3](https://i3wm.org/).
Leia o [FAQ](https://github.com/swaywm/sway/wiki). Junte-se ao [canal do
IRC](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway em
irc.freenode.net).
IRC](https://web.libera.chat/gamja/?channels=#sway) (#sway em
irc.libera.chat).
## Assinatura das versões
As versões são assinadas com [B22DA89A](http://pgp.mit.edu/pks/lookup?op=vindex&search=0x52CB6609B22DA89A)
As versões são assinadas com [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48)
e publicadas [no GitHub](https://github.com/swaywm/sway/releases).
## Instalação
@ -27,10 +27,10 @@ Verifique [essa página da wiki](https://github.com/swaywm/sway/wiki/Development
Instale as dependências:
* meson \*
* [wlroots](https://github.com/swaywm/wlroots)
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
@ -46,12 +46,6 @@ Execute esses comandos:
ninja -C build
sudo ninja -C build install
Em sistemas sem logind, você precisa preparar o binário do sway:
sudo chmod a+s /usr/local/bin/sway
O sway perderá as privilégios de de root logo após o início do sistema.
## Configuração
Se você já utiliza o i3, então copie os seus arquivos de configuração para `~/.config/sway/config` e

View file

@ -1,11 +1,11 @@
# sway
sway este un compositor pentru [Wayland](http://wayland.freedesktop.org/) compatibil cu [i3](https://i3wm.org/).
Citiți [FAQ](https://github.com/swaywm/sway/wiki)-ul. Connectați-vă la canalul nostru [IRC](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway pe irc.freenode.net).
Citiți [FAQ](https://github.com/swaywm/sway/wiki)-ul. Connectați-vă la canalul nostru [IRC](https://web.libera.chat/gamja/?channels=#sway) (#sway pe irc.libera.chat).
## Semnarea digitală
Noile versiuni sunt semnate cu [B22DA89A](http://pgp.mit.edu/pks/lookup?op=vindex&search=0x52CB6609B22DA89A)
Noile versiuni sunt semnate cu [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48)
și postate [pe GitHub](https://github.com/swaywm/sway/releases).
## Instalare
@ -22,10 +22,10 @@ Dacă sunteți interesați in a crea pachete pentru distribuția voastră, infor
Dependențe pentru instalare:
* meson \*
* [wlroots](https://github.com/swaywm/wlroots)
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
@ -43,14 +43,6 @@ Rulați aceste comenzi:
sudo ninja -C build install
```
Pe sisteme fără logind, trebuie să folosiți următoarea comandă pentru a marca binarul de Sway ca suid:
```
sudo chmod a+s /usr/local/bin/sway
```
Imediat după pornire, Sway va renunța la permisiunile de root.
## Configurare
Dacă folosiți deja i3, copiați fișierul de configurare din i3 în `~/.config/sway/config`, și va funcționa fără a necesita nici o modificare. In caz contrar, copiați exemplul de configurare (disponibil de obicei în `/etc/sway/config`) în `~/.config/sway/config`.

View file

@ -3,7 +3,7 @@
sway - это [i3]-совместимый композитор [Wayland].
Больше информации в [FAQ]. Присоединяйтесь к
[IRC-каналу][IRC channel] (#sway на
irc.freenode.net).
irc.libera.chat).
## Подписи релизов
@ -29,7 +29,7 @@ sway и wlroots для тестирования или разработки.
* [wlroots]
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
@ -45,12 +45,6 @@ _\*Зависимости для сборки_
ninja -C build
sudo ninja -C build install
На системах без logind вам понадобится добавить suid к файлу программы sway:
sudo chmod a+s /usr/local/bin/sway
sway сбросит root-права при запуске.
## Настройка
Если вы уже используете i3, скопируйте ваш конфигурационный файл i3 в `~/.config/sway/config`, и
@ -66,9 +60,9 @@ sway (gdm работает довольно неплохо).
[i3]: https://i3wm.org/
[Wayland]: http://wayland.freedesktop.org/
[FAQ]: https://github.com/swaywm/sway/wiki
[IRC channel]: http://webchat.freenode.net/?channels=sway&uio=d4
[IRC channel]: https://web.libera.chat/gamja/?channels=#sway
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
[GitHub releases]: https://github.com/swaywm/sway/releases
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
[wlroots]: https://github.com/swaywm/wlroots
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc

81
README.sv.md Normal file
View file

@ -0,0 +1,81 @@
# sway
sway är en [i3]-kompatibel [Wayland] compositor. Läs våran [FAQ]-sida. Gå med i vår
[IRC-kanal] \(#sway på irc.libera.chat).
## Utgåvosignaturer
Utgåvor är signerade med [E88F5E48] och publicerade på [GitHub][GitHub releases].
## Installering
### Med pakethanterare
Sway är tillgänglig i många distributioner. Prova att installera "sway" med din distributions pakethanterare.
### Genom att kompilera från källkod
Kolla in [denna wiki-sida][Development setup] om du vill bygga sway och wlroots HEAD för testning eller utveckling.
Installera paket som sway behöver:
* meson \*
* [wlroots]
* wayland
* wayland-protocols \*
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (valbar: systembricka)
* [scdoc] (valbar: manualer) \*
* git (valbar: versioninfo) \*
_\* Krav för kompilering_
Kör dessa kommandon:
meson build/
ninja -C build/
sudo ninja -C build/ install
## Konfiguration
Ifall du redan använder i3 så kan du kopiera din konfigurationsfil till `~/.config/sway/config` och det kommer då att fungera som det ska.
Kopiera annars exemplarkonfigurationsfilen till `~/.config/sway/config`. Den ligger oftast i `/etc/sway/config`.
Kör `man 5 sway` för mer information kring konfigurationen.
## Att köra sway
Kör `sway` från en TTY. Vissa inloggningahanterare kan fungera men inte vara stödda av sway (gdm ska fungera hyfsat bra).
[en]: https://github.com/swaywm/sway#readme
[de]: README.de.md
[dk]: README.dk.md
[es]: README.es.md
[fr]: README.fr.md
[sv]: README.sv.md
[gr]: README.gr.md
[hu]: README.hu.md
[ir]: README.ir.md
[it]: README.it.md
[ja]: README.ja.md
[ko]: README.ko.md
[nl]: README.nl.md
[pl]: README.pl.md
[pt]: README.pt.md
[ro]: README.ro.md
[ru]: README.ru.md
[tr]: README.tr.md
[uk]: README.uk.md
[zh-CN]: README.zh-CN.md
[zh-TW]: README.zh-TW.md
[i3]: https://i3wm.org/
[Wayland]: http://wayland.freedesktop.org/
[FAQ]: https://github.com/swaywm/sway/wiki
[IRC-kanal]: https://web.libera.chat/gamja/?channels=#sway
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
[GitHub releases]: https://github.com/swaywm/sway/releases
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc

62
README.tr.md Normal file
View file

@ -0,0 +1,62 @@
# sway
Sway, [i3]-uyumlu bir [Wayland] dizgicisidir. [SSS][FAQ]'yi okuyun.
[IRC kanalı][IRC channel]na katılın \(irc.libera.chat'te #sway (İngilizce)).
## Sürüm imzaları
Sürümler [E88F5E48] ile imzalandı ve [GitHub][GitHub releases]'da yayınlandı.
## Kurulum
### Paketler ile
Sway birçok dağıtımda mevcuttur. Sizinki için "sway" paketini yüklemeyi deneyin.
Dağıtımınız için sway'i paketlemekle ilgileniyorsanız, IRC kanalına uğrayın veya tavsiye için sir@cmpwn.com adresine bir e-posta gönderin.
### Kaynak koddan derleme
Test veya geliştirme için sway ve wlroots'un HEAD'ini oluşturmak istiyorsanız [bu wiki sayfası][Development setup]na göz atın.
Aşağıdaki bağımlılıkları yükleyin:
* meson \*
* [wlroots]
* wayland
* wayland-protocols \*
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (isteğe bağlı: system tray)
* [scdoc] (isteğe bağlı: man pages) \*
* git (isteğe bağlı: version info) \*
_\*Derleme-anı bağımlılıkları_
Şu komutları çalıştırın:
meson build
ninja -C build
sudo ninja -C build install
## Yapılandırma
Zaten i3 kullanıyorsanız, i3 yapılandırmanızı `~/.config/sway/config` konumuna kopyalayın ve kutudan çıktığı gibi çalışacaktır. Aksi takdirde, örnek yapılandırma dosyasını `~/.config/sway/config` konumuna kopyalayın. Genellikle `/etc/sway/config` konumunda bulunur.
Yapılandırma hakkında bilgi almak için `man 5 sway` komutunu çalıştırın.
## Çalıştırma
TTY'den `sway` çalıştırın. Bazı görüntü yöneticileriyle(display manager) çalışabilir ama Sway tarafından desteklenmez. (gdm'nin oldukça iyi çalıştığı bilinmektedir.)
[i3]: https://i3wm.org/
[Wayland]: http://wayland.freedesktop.org/
[FAQ]: https://github.com/swaywm/sway/wiki
[IRC channel]: https://web.libera.chat/gamja/?channels=#sway
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
[GitHub releases]: https://github.com/swaywm/sway/releases
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc

View file

@ -2,8 +2,8 @@
Sway це сумісний з [i3](https://i3wm.org/) композитор [Wayland](http://wayland.freedesktop.org/).
Ознайомтесь з [ЧаПами](https://github.com/swaywm/sway/wiki). Приєднуйтесь до [спільноти в
IRC](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway на
irc.freenode.net).
IRC](https://web.libera.chat/gamja/?channels=#sway) (#sway на
irc.libera.chat).
## Підтримка українською мовою
@ -15,7 +15,7 @@ Hummer12007 у IRC-спільноті. Будьте терплячі, вам о
## Підписи випусків
Випуски підписані ключем [B22DA89A](http://pgp.mit.edu/pks/lookup?op=vindex&search=0x52CB6609B22DA89A)
Випуски підписані ключем [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48)
та публікуються на сторінці [GitHub](https://github.com/swaywm/sway/releases).
## Встановлення
@ -36,10 +36,10 @@ Sway доступний у багатьох дистрибутивах Linux (а
Встановіть залежності:
* meson \*
* [wlroots](https://github.com/swaywm/wlroots)
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
@ -55,12 +55,6 @@ _\*Лише для компіляції_
ninja -C build
sudo ninja -C build install
На системах без logind, необхідно встановити біт SUID на виконуваний файл sway:
sudo chmod a+s /usr/local/bin/sway
Sway втратить права доступу root незабаром після запуску.
## Налаштування
Якщо ви вже використовуєте i3, скопіюйте свій файл налаштувань

View file

@ -1,63 +1,50 @@
# sway
sway 是和 [i3](https://i3wm.org/) 兼容的 [Wayland](http://wayland.freedesktop.org/) compositor.
阅读 [FAQ](https://github.com/swaywm/sway/wiki). 加入 [IRC
频道](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway on
irc.freenode.net).
sway 是和 [i3](https://i3wm.org/) 兼容的 [Wayland](http://wayland.freedesktop.org/) compositor。
[查看FAQ](https://github.com/swaywm/sway/wiki)/ [加入IRC频道](https://web.libera.chat/gamja/?channels=#sway) (#sway on irc.libera.chat)
## 发签名
## 发行签名
发布是以 [B22DA89A](http://pgp.mit.edu/pks/lookup?op=vindex&search=0x52CB6609B22DA89A) 签名
并发布在 [GitHub](https://github.com/swaywm/sway/releases).
每个发行版都以 [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48) 的密钥签名并发布在 [GitHub](https://github.com/swaywm/sway/releases)上。
## 安装
### 从软件包中
### 从包管理器安装
Sway 在很多发行版中可用. 尝试在你的发行版中安装 "sway" 包.
如果这不可用, 请到 [此 wiki 页](https://github.com/swaywm/sway/wiki/Unsupported-packages)
检查针对你的发行版关于安装的信息.
Sway 在很多发行版中可用。请尝试在你的发行版中安装 `sway`
如果你有兴趣给你的发行版打包 sway, 停下来到 IRC 频道或者发邮件至 sir@cmpwn.com 获取建议.
### 从源码编译
### 从源代码编译
如果想要构建最新版sway和wlroots用以测试和开发请查看 [此wiki页面](https://github.com/swaywm/sway/wiki/Development-Setup)
安装依赖:
安装如下依赖:
* meson \*
* [wlroots](https://github.com/swaywm/wlroots)
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (可选的: system tray)
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (可选: man pages) \*
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (可选: man pages) \*
* git \*
_\*编译时依赖_
运行这些命令:
运行如下命令:
meson build
ninja -C build
sudo ninja -C build install
在没有 logind 的系统上, 你需要给 sway 二进制设置 suid:
sudo chmod a+s /usr/local/bin/sway
Sway 将会在启动后尽快丢掉 root 权限.
meson build/
ninja -C build/
sudo ninja -C build/ install
## 配置
如果你已经在使用 i3, 接下来复制你的 i3 配置到 `~/.config/sway/config`
它可以直接工作. 或者, 复制样本配置文件到
`~/.config/sway/config`. 它通常位于 `/etc/sway/config`.
运行 `man 5 sway` 获取关于配置的信息.
如果你已经在使用i3直接复制i3配置文件到 `~/.config/sway/config`,这是开箱即用的。或者,你可以复制配置样例到`~/.config/sway/config`。它通常位于 `/etc/sway/config`
运行 `man 5 sway` 获取关于配置的更多信息。
## 运行
从 TTY 中运行 `sway` . 某些显示管理器可能会工作但并不被 sway 支持
(已知的 gdm 工作得非常好).
从 TTY 中运行 `sway`。 某些显示管理器Display Manager也许可以工作但不被 sway 支持。
(已知 gdm 工作得非常好)。

View file

@ -2,12 +2,12 @@
sway 是一個與 [i3](https://i3wm.org/) 相容的 [Wayland](http://wayland.freedesktop.org/) compositor。
閱讀 [FAQ](https://github.com/swaywm/sway/wiki)。 加入 [IRC
頻道](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway on
irc.freenode.net)
頻道](https://web.libera.chat/gamja/?channels=#sway) (#sway on
irc.libera.chat)
## 發行簽章
所有發行的版本都會以 [B22DA89A](http://pgp.mit.edu/pks/lookup?op=vindex&search=0x52CB6609B22DA89A) 簽署
所有發行的版本都會以 [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48) 簽署
並發佈於 [GitHub](https://github.com/swaywm/sway/releases)
## 安裝
@ -25,10 +25,10 @@ Sway 在許多發行版都有提供。請自己嘗試於你的發行版安裝
相依套件:
* meson \*
* [wlroots](https://github.com/swaywm/wlroots)
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
@ -44,12 +44,6 @@ _\*編譯時相依_
ninja -C build
sudo ninja -C build install
在沒有 logind 的系統上,你需要為 sway 的執行檔加上 suid。
sudo chmod a+s /usr/local/bin/sway
Sway 在啟動不久後就會放棄 root 權限。
## 設定檔
如果你已經在使用 i3你可以直接將你的 i3 設定檔複製到 `~/.config/sway/config` 然後就能直接使用。

View file

@ -1,50 +1,42 @@
#define _POSIX_C_SOURCE 200809
#include <assert.h>
#include <cairo/cairo.h>
#include <cairo.h>
#include <errno.h>
#include <fcntl.h>
#include <pango/pangocairo.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <time.h>
#include <unistd.h>
#include <wayland-client.h>
#include "config.h"
#include "pool-buffer.h"
#include "util.h"
static int create_pool_file(size_t size, char **name) {
static const char template[] = "sway-client-XXXXXX";
const char *path = getenv("XDG_RUNTIME_DIR");
if (path == NULL) {
fprintf(stderr, "XDG_RUNTIME_DIR is not set\n");
return -1;
}
static int anonymous_shm_open(void) {
int retries = 100;
size_t name_size = strlen(template) + 1 + strlen(path) + 1;
*name = malloc(name_size);
if (*name == NULL) {
fprintf(stderr, "allocation failed\n");
return -1;
}
snprintf(*name, name_size, "%s/%s", path, template);
do {
// try a probably-unique name
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
pid_t pid = getpid();
char name[50];
snprintf(name, sizeof(name), "/sway-%x-%x",
(unsigned int)pid, (unsigned int)ts.tv_nsec);
int fd = mkstemp(*name);
if (fd < 0) {
return -1;
}
// shm_open guarantees that O_CLOEXEC is set
int fd = shm_open(name, O_RDWR | O_CREAT | O_EXCL, 0600);
if (fd >= 0) {
shm_unlink(name);
return fd;
}
if (!sway_set_cloexec(fd, true)) {
close(fd);
return -1;
}
--retries;
} while (retries > 0 && errno == EEXIST);
if (ftruncate(fd, size) < 0) {
close(fd);
return -1;
}
return fd;
return -1;
}
static void buffer_release(void *data, struct wl_buffer *wl_buffer) {
@ -62,17 +54,20 @@ static struct pool_buffer *create_buffer(struct wl_shm *shm,
uint32_t stride = width * 4;
size_t size = stride * height;
char *name;
int fd = create_pool_file(size, &name);
assert(fd != -1);
int fd = anonymous_shm_open();
if (fd == -1) {
return NULL;
}
if (ftruncate(fd, size) < 0) {
close(fd);
return NULL;
}
void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
struct wl_shm_pool *pool = wl_shm_create_pool(shm, fd, size);
buf->buffer = wl_shm_pool_create_buffer(pool, 0,
width, height, stride, format);
wl_shm_pool_destroy(pool);
close(fd);
unlink(name);
free(name);
buf->size = size;
buf->width = width;

View file

@ -1,6 +1,6 @@
#include <stdint.h>
#include <cairo/cairo.h>
#include "cairo.h"
#include <cairo.h>
#include "cairo_util.h"
void cairo_set_source_u32(cairo_t *cairo, uint32_t color) {
cairo_set_source_rgba(cairo,

332
common/gesture.c Normal file
View file

@ -0,0 +1,332 @@
#include "gesture.h"
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "list.h"
#include "log.h"
#include "stringop.h"
const uint8_t GESTURE_FINGERS_ANY = 0;
char *gesture_parse(const char *input, struct gesture *output) {
// Clear output in case of failure
output->type = GESTURE_TYPE_NONE;
output->fingers = GESTURE_FINGERS_ANY;
output->directions = GESTURE_DIRECTION_NONE;
// Split input type, fingers and directions
list_t *split = split_string(input, ":");
if (split->length < 1 || split->length > 3) {
return format_str(
"expected <gesture>[:<fingers>][:direction], got %s",
input);
}
// Parse gesture type
if (strcmp(split->items[0], "hold") == 0) {
output->type = GESTURE_TYPE_HOLD;
} else if (strcmp(split->items[0], "pinch") == 0) {
output->type = GESTURE_TYPE_PINCH;
} else if (strcmp(split->items[0], "swipe") == 0) {
output->type = GESTURE_TYPE_SWIPE;
} else {
return format_str("expected hold|pinch|swipe, got %s",
(const char *)split->items[0]);
}
// Parse optional arguments
if (split->length > 1) {
char *next = split->items[1];
// Try to parse as finger count (1-9)
if (strlen(next) == 1 && '1' <= next[0] && next[0] <= '9') {
output->fingers = atoi(next);
// Move to next if available
next = split->length == 3 ? split->items[2] : NULL;
} else if (split->length == 3) {
// Fail here if argument can only be finger count
return format_str("expected 1-9, got %s", next);
}
// If there is an argument left, try to parse as direction
if (next) {
list_t *directions = split_string(next, "+");
for (int i = 0; i < directions->length; ++i) {
const char *item = directions->items[i];
if (strcmp(item, "any") == 0) {
continue;
} else if (strcmp(item, "up") == 0) {
output->directions |= GESTURE_DIRECTION_UP;
} else if (strcmp(item, "down") == 0) {
output->directions |= GESTURE_DIRECTION_DOWN;
} else if (strcmp(item, "left") == 0) {
output->directions |= GESTURE_DIRECTION_LEFT;
} else if (strcmp(item, "right") == 0) {
output->directions |= GESTURE_DIRECTION_RIGHT;
} else if (strcmp(item, "inward") == 0) {
output->directions |= GESTURE_DIRECTION_INWARD;
} else if (strcmp(item, "outward") == 0) {
output->directions |= GESTURE_DIRECTION_OUTWARD;
} else if (strcmp(item, "clockwise") == 0) {
output->directions |= GESTURE_DIRECTION_CLOCKWISE;
} else if (strcmp(item, "counterclockwise") == 0) {
output->directions |= GESTURE_DIRECTION_COUNTERCLOCKWISE;
} else {
return format_str("expected direction, got %s", item);
}
}
list_free_items_and_destroy(directions);
}
} // if optional args
list_free_items_and_destroy(split);
return NULL;
}
const char *gesture_type_string(enum gesture_type type) {
switch (type) {
case GESTURE_TYPE_NONE:
return "none";
case GESTURE_TYPE_HOLD:
return "hold";
case GESTURE_TYPE_PINCH:
return "pinch";
case GESTURE_TYPE_SWIPE:
return "swipe";
}
return NULL;
}
const char *gesture_direction_string(enum gesture_direction direction) {
switch (direction) {
case GESTURE_DIRECTION_NONE:
return "none";
case GESTURE_DIRECTION_UP:
return "up";
case GESTURE_DIRECTION_DOWN:
return "down";
case GESTURE_DIRECTION_LEFT:
return "left";
case GESTURE_DIRECTION_RIGHT:
return "right";
case GESTURE_DIRECTION_INWARD:
return "inward";
case GESTURE_DIRECTION_OUTWARD:
return "outward";
case GESTURE_DIRECTION_CLOCKWISE:
return "clockwise";
case GESTURE_DIRECTION_COUNTERCLOCKWISE:
return "counterclockwise";
}
return NULL;
}
// Helper to turn combination of directions flags into string representation.
static char *gesture_directions_to_string(uint32_t directions) {
char *result = NULL;
for (uint8_t bit = 0; bit < 32; bit++) {
uint32_t masked = directions & (1 << bit);
if (masked) {
const char *name = gesture_direction_string(masked);
if (!name) {
name = "unknown";
}
if (!result) {
result = strdup(name);
} else {
char *new = format_str("%s+%s", result, name);
free(result);
result = new;
}
}
}
if(!result) {
return strdup("any");
}
return result;
}
char *gesture_to_string(struct gesture *gesture) {
char *directions = gesture_directions_to_string(gesture->directions);
char *result = format_str("%s:%u:%s",
gesture_type_string(gesture->type),
gesture->fingers, directions);
free(directions);
return result;
}
bool gesture_check(struct gesture *target, enum gesture_type type, uint8_t fingers) {
// Check that gesture type matches
if (target->type != type) {
return false;
}
// Check that finger count matches
if (target->fingers != GESTURE_FINGERS_ANY && target->fingers != fingers) {
return false;
}
return true;
}
bool gesture_match(struct gesture *target, struct gesture *to_match, bool exact) {
// Check type and fingers
if (!gesture_check(target, to_match->type, to_match->fingers)) {
return false;
}
// Enforce exact matches ...
if (exact && target->directions != to_match->directions) {
return false;
}
// ... or ensure all target directions are matched
return (target->directions & to_match->directions) == target->directions;
}
bool gesture_equal(struct gesture *a, struct gesture *b) {
return a->type == b->type
&& a->fingers == b->fingers
&& a->directions == b->directions;
}
// Return count of set bits in directions bit field.
static uint8_t gesture_directions_count(uint32_t directions) {
uint8_t count = 0;
for (; directions; directions >>= 1) {
count += directions & 1;
}
return count;
}
// Compare direction bit count of two direction.
static int8_t gesture_directions_compare(uint32_t a, uint32_t b) {
return gesture_directions_count(a) - gesture_directions_count(b);
}
// Compare two direction based on their direction bit count
int8_t gesture_compare(struct gesture *a, struct gesture *b) {
return gesture_directions_compare(a->directions, b->directions);
}
void gesture_tracker_begin(struct gesture_tracker *tracker,
enum gesture_type type, uint8_t fingers) {
tracker->type = type;
tracker->fingers = fingers;
tracker->dx = 0.0;
tracker->dy = 0.0;
tracker->scale = 1.0;
tracker->rotation = 0.0;
sway_log(SWAY_DEBUG, "begin tracking %s:%u:? gesture",
gesture_type_string(type), fingers);
}
bool gesture_tracker_check(struct gesture_tracker *tracker, enum gesture_type type) {
return tracker->type == type;
}
void gesture_tracker_update(struct gesture_tracker *tracker,
double dx, double dy, double scale, double rotation) {
if (tracker->type == GESTURE_TYPE_HOLD) {
sway_assert(false, "hold does not update.");
return;
}
tracker->dx += dx;
tracker->dy += dy;
if (tracker->type == GESTURE_TYPE_PINCH) {
tracker->scale = scale;
tracker->rotation += rotation;
}
sway_log(SWAY_DEBUG, "update tracking %s:%u:? gesture: %f %f %f %f",
gesture_type_string(tracker->type),
tracker->fingers,
tracker->dx, tracker->dy,
tracker->scale, tracker->rotation);
}
void gesture_tracker_cancel(struct gesture_tracker *tracker) {
sway_log(SWAY_DEBUG, "cancel tracking %s:%u:? gesture",
gesture_type_string(tracker->type), tracker->fingers);
tracker->type = GESTURE_TYPE_NONE;
}
struct gesture *gesture_tracker_end(struct gesture_tracker *tracker) {
struct gesture *result = calloc(1, sizeof(struct gesture));
// Ignore gesture under some threshold
// TODO: Make configurable
const double min_rotation = 5;
const double min_scale_delta = 0.1;
// Determine direction
switch(tracker->type) {
// Gestures with scale and rotation
case GESTURE_TYPE_PINCH:
if (tracker->rotation > min_rotation) {
result->directions |= GESTURE_DIRECTION_CLOCKWISE;
}
if (tracker->rotation < -min_rotation) {
result->directions |= GESTURE_DIRECTION_COUNTERCLOCKWISE;
}
if (tracker->scale > (1.0 + min_scale_delta)) {
result->directions |= GESTURE_DIRECTION_OUTWARD;
}
if (tracker->scale < (1.0 - min_scale_delta)) {
result->directions |= GESTURE_DIRECTION_INWARD;
}
__attribute__ ((fallthrough));
// Gestures with dx and dy
case GESTURE_TYPE_SWIPE:
if (fabs(tracker->dx) > fabs(tracker->dy)) {
if (tracker->dx > 0) {
result->directions |= GESTURE_DIRECTION_RIGHT;
} else {
result->directions |= GESTURE_DIRECTION_LEFT;
}
} else {
if (tracker->dy > 0) {
result->directions |= GESTURE_DIRECTION_DOWN;
} else {
result->directions |= GESTURE_DIRECTION_UP;
}
}
// Gesture without any direction
case GESTURE_TYPE_HOLD:
break;
// Not tracking any gesture
case GESTURE_TYPE_NONE:
sway_assert(false, "Not tracking any gesture.");
return result;
}
result->type = tracker->type;
result->fingers = tracker->fingers;
char *description = gesture_to_string(result);
sway_log(SWAY_DEBUG, "end tracking gesture: %s", description);
free(description);
tracker->type = GESTURE_TYPE_NONE;
return result;
}

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200112L
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200112L
#include <limits.h>
#include <string.h>
#include <stdbool.h>

View file

@ -1,8 +1,8 @@
lib_sway_common = static_library(
'sway-common',
files(
'background-image.c',
'cairo.c',
'gesture.c',
'ipc-client.c',
'log.c',
'loop.c',
@ -13,7 +13,6 @@ lib_sway_common = static_library(
),
dependencies: [
cairo,
gdk_pixbuf,
pango,
pangocairo,
wayland_client.partial_dependency(compile_args: true)

View file

@ -1,4 +1,4 @@
#include <cairo/cairo.h>
#include <cairo.h>
#include <pango/pangocairo.h>
#include <stdarg.h>
#include <stdbool.h>
@ -6,7 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cairo.h"
#include "cairo_util.h"
#include "log.h"
#include "stringop.h"
@ -50,9 +50,11 @@ size_t escape_markup_text(const char *src, char *dest) {
return length;
}
PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc,
const char *text, double scale, bool markup) {
PangoLayout *layout = pango_cairo_create_layout(cairo);
pango_context_set_round_glyph_positions(pango_layout_get_context(layout), false);
PangoAttrList *attrs;
if (markup) {
char *buf;
@ -73,60 +75,60 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
}
pango_attr_list_insert(attrs, pango_attr_scale_new(scale));
PangoFontDescription *desc = pango_font_description_from_string(font);
pango_layout_set_font_description(layout, desc);
pango_layout_set_single_paragraph_mode(layout, 1);
pango_layout_set_attributes(layout, attrs);
pango_attr_list_unref(attrs);
pango_font_description_free(desc);
return layout;
}
void get_text_size(cairo_t *cairo, const char *font, int *width, int *height,
void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height,
int *baseline, double scale, bool markup, const char *fmt, ...) {
va_list args;
va_start(args, fmt);
// Add one since vsnprintf excludes null terminator.
int length = vsnprintf(NULL, 0, fmt, args) + 1;
char *buf = vformat_str(fmt, args);
va_end(args);
char *buf = malloc(length);
if (buf == NULL) {
sway_log(SWAY_ERROR, "Failed to allocate memory");
return;
}
va_start(args, fmt);
vsnprintf(buf, length, fmt, args);
va_end(args);
PangoLayout *layout = get_pango_layout(cairo, font, buf, scale, markup);
PangoLayout *layout = get_pango_layout(cairo, desc, buf, scale, markup);
pango_cairo_update_layout(cairo, layout);
pango_layout_get_pixel_size(layout, width, height);
if (baseline) {
*baseline = pango_layout_get_baseline(layout) / PANGO_SCALE;
}
g_object_unref(layout);
free(buf);
}
void pango_printf(cairo_t *cairo, const char *font,
void get_text_metrics(const PangoFontDescription *description, int *height, int *baseline) {
cairo_t *cairo = cairo_create(NULL);
PangoContext *pango = pango_cairo_create_context(cairo);
pango_context_set_round_glyph_positions(pango, false);
// When passing NULL as a language, pango uses the current locale.
PangoFontMetrics *metrics = pango_context_get_metrics(pango, description, NULL);
*baseline = pango_font_metrics_get_ascent(metrics) / PANGO_SCALE;
*height = *baseline + pango_font_metrics_get_descent(metrics) / PANGO_SCALE;
pango_font_metrics_unref(metrics);
g_object_unref(pango);
cairo_destroy(cairo);
}
void render_text(cairo_t *cairo, const PangoFontDescription *desc,
double scale, bool markup, const char *fmt, ...) {
va_list args;
va_start(args, fmt);
// Add one since vsnprintf excludes null terminator.
int length = vsnprintf(NULL, 0, fmt, args) + 1;
char *buf = vformat_str(fmt, args);
va_end(args);
char *buf = malloc(length);
if (buf == NULL) {
sway_log(SWAY_ERROR, "Failed to allocate memory");
return;
}
va_start(args, fmt);
vsnprintf(buf, length, fmt, args);
va_end(args);
PangoLayout *layout = get_pango_layout(cairo, font, buf, scale, markup);
PangoLayout *layout = get_pango_layout(cairo, desc, buf, scale, markup);
cairo_font_options_t *fo = cairo_font_options_create();
cairo_get_font_options(cairo, fo);
pango_cairo_context_set_font_options(pango_layout_get_context(layout), fo);
@ -134,5 +136,6 @@ void pango_printf(cairo_t *cairo, const char *font,
pango_cairo_update_layout(cairo, layout);
pango_cairo_show_layout(cairo, layout);
g_object_unref(layout);
free(buf);
}

View file

@ -1,5 +1,5 @@
#define _POSIX_C_SOURCE 200809L
#include <ctype.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@ -328,3 +328,35 @@ bool expand_path(char **path) {
wordfree(&p);
return true;
}
char *vformat_str(const char *fmt, va_list args) {
char *str = NULL;
va_list args_copy;
va_copy(args_copy, args);
int len = vsnprintf(NULL, 0, fmt, args);
if (len < 0) {
sway_log_errno(SWAY_ERROR, "vsnprintf(\"%s\") failed", fmt);
goto out;
}
str = malloc(len + 1);
if (str == NULL) {
sway_log_errno(SWAY_ERROR, "malloc() failed");
goto out;
}
vsnprintf(str, len + 1, fmt, args_copy);
out:
va_end(args_copy);
return str;
}
char *format_str(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
char *str = vformat_str(fmt, args);
va_end(args);
return str;
}

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <ctype.h>
#include <fcntl.h>
#include <math.h>
@ -10,12 +9,6 @@
#include "log.h"
#include "util.h"
uint32_t get_current_time_msec(void) {
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
return now.tv_sec * 1000 + now.tv_nsec / 1000000;
}
int wrap(int i, int max) {
return ((i % max) + max) % max;
}
@ -86,6 +79,12 @@ enum movement_unit parse_movement_unit(const char *unit) {
int parse_movement_amount(int argc, char **argv,
struct movement_amount *amount) {
if (!sway_assert(argc > 0, "Expected args in parse_movement_amount")) {
amount->amount = 0;
amount->unit = MOVEMENT_UNIT_INVALID;
return 0;
}
char *err;
amount->amount = (int)strtol(argv[0], &err, 10);
if (*err) {

View file

@ -2,7 +2,7 @@
_sway()
{
local cur prev
local cur prev short long
_get_comp_words_by_ref cur prev
short=(

View file

@ -2,7 +2,7 @@
_swaybar()
{
local cur prev
local cur prev short long
_get_comp_words_by_ref cur prev
short=(

View file

@ -2,7 +2,7 @@
_swaymsg()
{
local cur prev
local cur prev types short long
_get_comp_words_by_ref cur prev
types=(

57
completions/meson.build Normal file
View file

@ -0,0 +1,57 @@
if get_option('zsh-completions')
zsh_files = files(
'zsh/_sway',
'zsh/_swaymsg',
)
zsh_install_dir = join_paths(datadir, 'zsh', 'site-functions')
install_data(zsh_files, install_dir: zsh_install_dir)
endif
if get_option('bash-completions')
bash_comp = dependency('bash-completion', required: false)
bash_files = files(
'bash/sway',
'bash/swaymsg',
)
if get_option('swaybar')
bash_files += files('bash/swaybar')
endif
if bash_comp.found()
bash_install_dir = bash_comp.get_variable(
pkgconfig: 'completionsdir',
pkgconfig_define: ['datadir', datadir]
)
else
bash_install_dir = join_paths(datadir, 'bash-completion', 'completions')
endif
install_data(bash_files, install_dir: bash_install_dir)
endif
if get_option('fish-completions')
fish_comp = dependency('fish', required: false)
fish_files = files(
'fish/sway.fish',
'fish/swaymsg.fish',
)
if get_option('swaynag')
fish_files += files('fish/swaynag.fish')
endif
if fish_comp.found()
fish_install_dir = fish_comp.get_variable(
pkgconfig: 'completionsdir',
pkgconfig_define: ['datadir', datadir]
)
else
fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d')
endif
install_data(fish_files, install_dir: fish_install_dir)
endif

View file

@ -14,11 +14,9 @@ set $down j
set $up k
set $right l
# Your preferred terminal emulator
set $term alacritty
set $term foot
# Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
set $menu dmenu_path | dmenu | xargs swaymsg exec --
set $menu wmenu-run
### Output configuration
#
@ -37,7 +35,7 @@ output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
#
# exec swayidle -w \
# timeout 300 'swaylock -f -c 000000' \
# timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
# timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
# before-sleep 'swaylock -f -c 000000'
#
# This will lock your screen after 300 seconds of inactivity, then turn off
@ -82,7 +80,7 @@ output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
bindsym $mod+Shift+c reload
# Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
#
# Moving around:
#
@ -195,6 +193,19 @@ mode "resize" {
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
#
# Utilities:
#
# Special keys to adjust volume via PulseAudio
bindsym --locked XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5%
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5%
bindsym --locked XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle
# Special keys to adjust brightness via brightnessctl
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
# Special key to take a screenshot with grim
bindsym Print exec grim
#
# Status Bar:
@ -205,7 +216,7 @@ bar {
# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
status_command while date +'%Y-%m-%d %l:%M:%S %p'; do sleep 1; done
status_command while date +'%Y-%m-%d %X'; do sleep 1; done
colors {
statusline #ffffff

View file

@ -1,21 +0,0 @@
#!/bin/sh -eu
old_version="$1"
new_version="$2"
if [ "$new_version" != "${new_version#v}" ]
then
echo "Error: The new version shouldn't be prefixed with a \"v\"." >&2
exit 1
fi
sed -i meson.build -e "s/^ version: .*#release_version/ version: '$new_version', #release_version/g"
printf "Minimum wlroots version? "
read wlr_version_min
printf "Maximum wlroots version? "
read wlr_version_max
sed -i meson.build -e "s/wlroots_version =.*/wlroots_version = ['>=$wlr_version_min', '<$wlr_version_max']/"
git add meson.build
git commit -m "Update version to $new_version"

View file

@ -1,130 +0,0 @@
#!/usr/bin/python
# This script requires i3ipc-python package (install it from a system package manager
# or pip).
# It adds icons to the workspace name for each open window.
# Set your keybindings like this: set $workspace1 workspace number 1
# Add your icons to WINDOW_ICONS.
# Based on https://github.com/maximbaz/dotfiles/blob/master/bin/i3-autoname-workspaces
import argparse
import i3ipc
import logging
import re
import signal
import sys
WINDOW_ICONS = {
"firefox": "",
}
DEFAULT_ICON = "󰀏"
def icon_for_window(window):
app_id = window.app_id
if app_id is not None and len(app_id) > 0:
app_id = app_id.lower()
if app_id in WINDOW_ICONS:
return WINDOW_ICONS[app_id]
logging.info("No icon available for window with app_id: %s" % str(app_id))
else:
# xwayland support
class_name = window.window_class
if len(class_name) > 0:
class_name = class_name.lower()
if class_name in WINDOW_ICONS:
return WINDOW_ICONS[class_name]
logging.info(
"No icon available for window with class_name: %s" % str(class_name)
)
return DEFAULT_ICON
def rename_workspaces(ipc):
for workspace in ipc.get_tree().workspaces():
name_parts = parse_workspace_name(workspace.name)
icon_tuple = ()
for w in workspace:
if w.app_id is not None or w.window_class is not None:
icon = icon_for_window(w)
if not ARGUMENTS.duplicates and icon in icon_tuple:
continue
icon_tuple += (icon,)
name_parts["icons"] = " ".join(icon_tuple) + " "
new_name = construct_workspace_name(name_parts)
ipc.command('rename workspace "%s" to "%s"' % (workspace.name, new_name))
def undo_window_renaming(ipc):
for workspace in ipc.get_tree().workspaces():
name_parts = parse_workspace_name(workspace.name)
name_parts["icons"] = None
new_name = construct_workspace_name(name_parts)
ipc.command('rename workspace "%s" to "%s"' % (workspace.name, new_name))
ipc.main_quit()
sys.exit(0)
def parse_workspace_name(name):
return re.match(
"(?P<num>[0-9]+):?(?P<shortname>\w+)? ?(?P<icons>.+)?", name
).groupdict()
def construct_workspace_name(parts):
new_name = str(parts["num"])
if parts["shortname"] or parts["icons"]:
new_name += ":"
if parts["shortname"]:
new_name += parts["shortname"]
if parts["icons"]:
new_name += " " + parts["icons"]
return new_name
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="This script automatically changes the workspace name in sway depending on your open applications."
)
parser.add_argument(
"--duplicates",
"-d",
action="store_true",
help="Set it when you want an icon for each instance of the same application per workspace.",
)
parser.add_argument(
"--logfile",
"-l",
type=str,
default="/tmp/sway-autoname-workspaces.log",
help="Path for the logfile.",
)
args = parser.parse_args()
global ARGUMENTS
ARGUMENTS = args
logging.basicConfig(
level=logging.INFO,
filename=ARGUMENTS.logfile,
filemode="w",
format="%(message)s",
)
ipc = i3ipc.Connection()
for sig in [signal.SIGINT, signal.SIGTERM]:
signal.signal(sig, lambda signal, frame: undo_window_renaming(ipc))
def window_event_handler(ipc, e):
if e.change in ["new", "close", "move"]:
rename_workspaces(ipc)
ipc.on("window", window_event_handler)
rename_workspaces(ipc)
ipc.main()

View file

@ -1,154 +0,0 @@
#!/bin/sh
## Grimshot: a helper for screenshots within sway
## Requirements:
## - `grim`: screenshot utility for wayland
## - `slurp`: to select an area
## - `swaymsg`: to read properties of current window
## - `wl-copy`: clipboard utility
## - `jq`: json utility to parse swaymsg output
## - `notify-send`: to show notifications
## Those are needed to be installed, if unsure, run `grimshot check`
##
## See `man 1 grimshot` or `grimshot usage` for further details.
getTargetDirectory() {
test -f ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs && \
. ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs
echo ${XDG_SCREENSHOTS_DIR:-${XDG_PICTURES_DIR:-$HOME}}
}
if [ "$1" = "--notify" ]; then
NOTIFY=yes
shift 1
else
NOTIFY=no
fi
ACTION=${1:-usage}
SUBJECT=${2:-screen}
FILE=${3:-$(getTargetDirectory)/$(date -Ins).png}
if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then
echo "Usage:"
echo " grimshot [--notify] (copy|save) [active|screen|output|area|window] [FILE|-]"
echo " grimshot check"
echo " grimshot usage"
echo ""
echo "Commands:"
echo " copy: Copy the screenshot data into the clipboard."
echo " save: Save the screenshot to a regular file or '-' to pipe to STDOUT."
echo " check: Verify if required tools are installed and exit."
echo " usage: Show this message and exit."
echo ""
echo "Targets:"
echo " active: Currently active window."
echo " screen: All visible outputs."
echo " output: Currently active output."
echo " area: Manually select a region."
echo " window: Manually select a window."
exit
fi
notify() {
notify-send -t 3000 -a grimshot "$@"
}
notifyOk() {
[ "$NOTIFY" = "no" ] && return
TITLE=${2:-"Screenshot"}
MESSAGE=${1:-"OK"}
notify "$TITLE" "$MESSAGE"
}
notifyError() {
if [ $NOTIFY = "yes" ]; then
TITLE=${2:-"Screenshot"}
MESSAGE=${1:-"Error taking screenshot with grim"}
notify -u critical "$TITLE" "$MESSAGE"
else
echo $1
fi
}
die() {
MSG=${1:-Bye}
notifyError "Error: $MSG"
exit 2
}
check() {
COMMAND=$1
if command -v "$COMMAND" > /dev/null 2>&1; then
RESULT="OK"
else
RESULT="NOT FOUND"
fi
echo " $COMMAND: $RESULT"
}
takeScreenshot() {
FILE=$1
GEOM=$2
OUTPUT=$3
if [ ! -z "$OUTPUT" ]; then
grim -o "$OUTPUT" "$FILE" || die "Unable to invoke grim"
elif [ -z "$GEOM" ]; then
grim "$FILE" || die "Unable to invoke grim"
else
grim -g "$GEOM" "$FILE" || die "Unable to invoke grim"
fi
}
if [ "$ACTION" = "check" ] ; then
echo "Checking if required tools are installed. If something is missing, install it to your system and make it available in PATH..."
check grim
check slurp
check swaymsg
check wl-copy
check jq
check notify-send
exit
elif [ "$SUBJECT" = "area" ] ; then
GEOM=$(slurp -d)
# Check if user exited slurp without selecting the area
if [ -z "$GEOM" ]; then
exit
fi
WHAT="Area"
elif [ "$SUBJECT" = "active" ] ; then
FOCUSED=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused)')
GEOM=$(echo "$FOCUSED" | jq -r '.rect | "\(.x),\(.y) \(.width)x\(.height)"')
APP_ID=$(echo "$FOCUSED" | jq -r '.app_id')
WHAT="$APP_ID window"
elif [ "$SUBJECT" = "screen" ] ; then
GEOM=""
WHAT="Screen"
elif [ "$SUBJECT" = "output" ] ; then
GEOM=""
OUTPUT=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name')
WHAT="$OUTPUT"
elif [ "$SUBJECT" = "window" ] ; then
GEOM=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp)
# Check if user exited slurp without selecting the area
if [ -z "$GEOM" ]; then
exit
fi
WHAT="Window"
else
die "Unknown subject to take a screen shot from" "$SUBJECT"
fi
if [ "$ACTION" = "copy" ] ; then
takeScreenshot - "$GEOM" "$OUTPUT" | wl-copy --type image/png || die "Clipboard error"
notifyOk "$WHAT copied to buffer"
else
if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then
TITLE="Screenshot of $SUBJECT"
MESSAGE=$(basename "$FILE")
notifyOk "$MESSAGE" "$TITLE"
echo $FILE
else
notifyError "Error taking screenshot with grim"
fi
fi

View file

@ -1,104 +0,0 @@
.\" Generated by scdoc 1.11.1
.\" Complete documentation for this program is not available as a GNU info page
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.nh
.ad l
.\" Begin generated content:
.TH "grimshot" "1" "2021-02-23"
.P
.SH NAME
.P
grimshot - a helper for screenshots within sway
.P
.SH SYNOPSIS
.P
\fBgrimshot\fR [--notify] (copy|save) [TARGET] [FILE]
.br
\fBgrimshot\fR check
.br
\fBgrimshot\fR usage
.P
.SH OPTIONS
.P
\fB--notify\fR
.RS 4
Show notifications to the user that a screenshot has been taken.\&
.P
.RE
\fBsave\fR
.RS 4
Save the screenshot into a regular file.\& Grimshot will write images
files to \fBXDG_SCREENSHOTS_DIR\fR if this is set (or defined
in \fBuser-dirs.\&dir\fR), or otherwise fall back to \fBXDG_PICTURES_DIR\fR.\&
Set FILE to '-' to pipe the output to STDOUT.\&
.P
.RE
\fBcopy\fR
.RS 4
Copy the screenshot data (as image/png) into the clipboard.\&
.P
.RE
.SH DESCRIPTION
.P
Grimshot is an easy-to-use screenshot utility for sway.\& It provides a
convenient interface over grim, slurp and jq, and supports storing the
screenshot either directly to the clipboard using wl-copy or to a file.\&
.P
.SH EXAMPLES
.P
An example usage pattern is to add these bindings to your sway config:
.P
.nf
.RS 4
# Screenshots:
# Super+P: Current window
# Super+Shift+p: Select area
# Super+Alt+p Current output
# Super+Ctrl+p Select a window
bindsym Mod4+p exec grimshot save active
bindsym Mod4+Shift+p exec grimshot save area
bindsym Mod4+Mod1+p exec grimshot save output
bindsym Mod4+Ctrl+p exec grimshot save window
.fi
.RE
.P
.SH TARGETS
.P
grimshot can capture the following named targets:
.P
\fIactive\fR
.RS 4
Captures the currently active window.\&
.P
.RE
\fIscreen\fR
.RS 4
Captures the entire screen.\& This includes all visible outputs.\&
.P
.RE
\fIarea\fR
.RS 4
Allows manually selecting a rectangular region, and captures that.\&
.P
.RE
\fIwindow\fR
.RS 4
Allows manually selecting a single window (by clicking on it), and
captures it.\&
.P
.RE
\fIoutput\fR
.RS 4
Captures the currently active output.\&
.P
.RE
.SH OUTPUT
.P
Grimshot will print the filename of the captured screenshot to stdout if called
with the \fIsave\fR subcommand.\&
.P
.SH SEE ALSO
.P
\fBgrim\fR(1)

View file

@ -1,77 +0,0 @@
grimshot(1)
# NAME
grimshot - a helper for screenshots within sway
# SYNOPSIS
*grimshot* [--notify] (copy|save) [TARGET] [FILE]++
*grimshot* check++
*grimshot* usage
# OPTIONS
*--notify*
Show notifications to the user that a screenshot has been taken.
*save*
Save the screenshot into a regular file. Grimshot will write images
files to *XDG_SCREENSHOTS_DIR* if this is set (or defined
in *user-dirs.dir*), or otherwise fall back to *XDG_PICTURES_DIR*.
Set FILE to '-' to pipe the output to STDOUT.
*copy*
Copy the screenshot data (as image/png) into the clipboard.
# DESCRIPTION
Grimshot is an easy-to-use screenshot utility for sway. It provides a
convenient interface over grim, slurp and jq, and supports storing the
screenshot either directly to the clipboard using wl-copy or to a file.
# EXAMPLES
An example usage pattern is to add these bindings to your sway config:
```
# Screenshots:
# Super+P: Current window
# Super+Shift+p: Select area
# Super+Alt+p Current output
# Super+Ctrl+p Select a window
bindsym Mod4+p exec grimshot save active
bindsym Mod4+Shift+p exec grimshot save area
bindsym Mod4+Mod1+p exec grimshot save output
bindsym Mod4+Ctrl+p exec grimshot save window
```
# TARGETS
grimshot can capture the following named targets:
_active_
Captures the currently active window.
_screen_
Captures the entire screen. This includes all visible outputs.
_area_
Allows manually selecting a rectangular region, and captures that.
_window_
Allows manually selecting a single window (by clicking on it), and
captures it.
_output_
Captures the currently active output.
# OUTPUT
Grimshot will print the filename of the captured screenshot to stdout if called
with the _save_ subcommand.
# SEE ALSO
*grim*(1)

View file

@ -1,69 +0,0 @@
#!/usr/bin/python
# This script requires i3ipc-python package (install it from a system package manager
# or pip).
# It makes inactive windows transparent. Use `transparency_val` variable to control
# transparency strength in range of 0…1 or use the command line argument -o.
import argparse
import i3ipc
import signal
import sys
from functools import partial
def on_window_focus(inactive_opacity, ipc, event):
global prev_focused
global prev_workspace
focused_workspace = ipc.get_tree().find_focused()
if focused_workspace == None:
return
focused = event.container
workspace = focused_workspace.workspace().num
if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859
focused.command("opacity 1")
if workspace == prev_workspace:
prev_focused.command("opacity " + inactive_opacity)
prev_focused = focused
prev_workspace = workspace
def remove_opacity(ipc):
for workspace in ipc.get_tree().workspaces():
for w in workspace:
w.command("opacity 1")
ipc.main_quit()
sys.exit(0)
if __name__ == "__main__":
transparency_val = "0.80"
parser = argparse.ArgumentParser(
description="This script allows you to set the transparency of unfocused windows in sway."
)
parser.add_argument(
"--opacity",
"-o",
type=str,
default=transparency_val,
help="set opacity value in range 0...1",
)
args = parser.parse_args()
ipc = i3ipc.Connection()
prev_focused = None
prev_workspace = ipc.get_tree().find_focused().workspace().num
for window in ipc.get_tree():
if window.focused:
prev_focused = window
else:
window.command("opacity " + args.opacity)
for sig in [signal.SIGINT, signal.SIGTERM]:
signal.signal(sig, lambda signal, frame: remove_opacity(ipc))
ipc.on("window::focus", partial(on_window_focus, args.opacity))
ipc.main()

View file

@ -1,20 +0,0 @@
#ifndef _SWAY_BACKGROUND_IMAGE_H
#define _SWAY_BACKGROUND_IMAGE_H
#include "cairo.h"
enum background_mode {
BACKGROUND_MODE_STRETCH,
BACKGROUND_MODE_FILL,
BACKGROUND_MODE_FIT,
BACKGROUND_MODE_CENTER,
BACKGROUND_MODE_TILE,
BACKGROUND_MODE_SOLID_COLOR,
BACKGROUND_MODE_INVALID,
};
enum background_mode parse_background_mode(const char *mode);
cairo_surface_t *load_background_image(const char *path);
void render_background_image(cairo_t *cairo, cairo_surface_t *image,
enum background_mode mode, int buffer_width, int buffer_height);
#endif

View file

@ -1,8 +1,8 @@
#ifndef _SWAY_CAIRO_H
#define _SWAY_CAIRO_H
#ifndef _SWAY_CAIRO_UTIL_H
#define _SWAY_CAIRO_UTIL_H
#include "config.h"
#include <stdint.h>
#include <cairo/cairo.h>
#include <cairo.h>
#include <wayland-client-protocol.h>
void cairo_set_source_u32(cairo_t *cairo, uint32_t color);

104
include/gesture.h Normal file
View file

@ -0,0 +1,104 @@
#ifndef _SWAY_GESTURE_H
#define _SWAY_GESTURE_H
#include <stdbool.h>
#include <stdint.h>
/**
* A gesture type used in binding.
*/
enum gesture_type {
GESTURE_TYPE_NONE = 0,
GESTURE_TYPE_HOLD,
GESTURE_TYPE_PINCH,
GESTURE_TYPE_SWIPE,
};
// Turns single type enum value to constant string representation.
const char *gesture_type_string(enum gesture_type direction);
// Value to use to accept any finger count
extern const uint8_t GESTURE_FINGERS_ANY;
/**
* A gesture direction used in binding.
*/
enum gesture_direction {
GESTURE_DIRECTION_NONE = 0,
// Directions based on delta x and y
GESTURE_DIRECTION_UP = 1 << 0,
GESTURE_DIRECTION_DOWN = 1 << 1,
GESTURE_DIRECTION_LEFT = 1 << 2,
GESTURE_DIRECTION_RIGHT = 1 << 3,
// Directions based on scale
GESTURE_DIRECTION_INWARD = 1 << 4,
GESTURE_DIRECTION_OUTWARD = 1 << 5,
// Directions based on rotation
GESTURE_DIRECTION_CLOCKWISE = 1 << 6,
GESTURE_DIRECTION_COUNTERCLOCKWISE = 1 << 7,
};
// Turns single direction enum value to constant string representation.
const char *gesture_direction_string(enum gesture_direction direction);
/**
* Struct representing a pointer gesture
*/
struct gesture {
enum gesture_type type;
uint8_t fingers;
uint32_t directions;
};
/**
* Parses gesture from <gesture>[:<fingers>][:<directions>] string.
*
* Return NULL on success, otherwise error message string
*/
char *gesture_parse(const char *input, struct gesture *output);
// Turns gesture into string representation
char *gesture_to_string(struct gesture *gesture);
// Check if gesture is of certain type and finger count.
bool gesture_check(struct gesture *target,
enum gesture_type type, uint8_t fingers);
// Check if a gesture target/binding is match by other gesture/input
bool gesture_match(struct gesture *target,
struct gesture *to_match, bool exact);
// Returns true if gesture are exactly the same
bool gesture_equal(struct gesture *a, struct gesture *b);
// Compare distance between two matched target gestures.
int8_t gesture_compare(struct gesture *a, struct gesture *b);
// Small helper struct to track gestures over time
struct gesture_tracker {
enum gesture_type type;
uint8_t fingers;
double dx, dy;
double scale;
double rotation;
};
// Begin gesture tracking
void gesture_tracker_begin(struct gesture_tracker *tracker,
enum gesture_type type, uint8_t fingers);
// Check if the provides type is currently being tracked
bool gesture_tracker_check(struct gesture_tracker *tracker,
enum gesture_type type);
// Update gesture track with new data point
void gesture_tracker_update(struct gesture_tracker *tracker, double dx,
double dy, double scale, double rotation);
// Reset tracker
void gesture_tracker_cancel(struct gesture_tracker *tracker);
// Reset tracker and return gesture tracked
struct gesture *gesture_tracker_end(struct gesture_tracker *tracker);
#endif

View file

@ -1,6 +1,9 @@
#ifndef _SWAY_IPC_CLIENT_H
#define _SWAY_IPC_CLIENT_H
// arbitrary number, it's probably sufficient, higher number = more memory usage
#define JSON_MAX_DEPTH 512
#include <stdbool.h>
#include <stdint.h>
#include <sys/time.h>

View file

@ -3,8 +3,9 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <cairo/cairo.h>
#include <cairo.h>
#include <pango/pangocairo.h>
#include "stringop.h"
/**
* Utility function which escape characters a & < > ' ".
@ -13,11 +14,12 @@
* escaped string to dest if provided.
*/
size_t escape_markup_text(const char *src, char *dest);
PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc,
const char *text, double scale, bool markup);
void get_text_size(cairo_t *cairo, const char *font, int *width, int *height,
int *baseline, double scale, bool markup, const char *fmt, ...);
void pango_printf(cairo_t *cairo, const char *font,
double scale, bool markup, const char *fmt, ...);
void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height,
int *baseline, double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(8, 9);
void get_text_metrics(const PangoFontDescription *desc, int *height, int *baseline);
void render_text(cairo_t *cairo, PangoFontDescription *desc,
double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(5, 6);
#endif

View file

@ -1,6 +1,6 @@
#ifndef _SWAY_BUFFERS_H
#define _SWAY_BUFFERS_H
#include <cairo/cairo.h>
#include <cairo.h>
#include <pango/pangocairo.h>
#include <stdbool.h>
#include <stdint.h>

View file

@ -2,8 +2,15 @@
#define _SWAY_STRINGOP_H
#include <stdbool.h>
#include <stddef.h>
#include "list.h"
#ifdef __GNUC__
#define _SWAY_ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end)))
#else
#define _SWAY_ATTRIB_PRINTF(start, end)
#endif
void strip_whitespace(char *str);
void strip_quotes(char *str);
@ -30,4 +37,7 @@ char *argsep(char **stringp, const char *delim, char *matched_delim);
// Expand a path using shell replacements such as $HOME and ~
bool expand_path(char **path);
char *vformat_str(const char *fmt, va_list args) _SWAY_ATTRIB_PRINTF(1, 0);
char *format_str(const char *fmt, ...) _SWAY_ATTRIB_PRINTF(1, 2);
#endif

View file

@ -3,13 +3,14 @@
#include <wlr/util/edges.h>
#include "config.h"
#include "stringop.h"
struct sway_container;
typedef struct cmd_results *sway_cmd(int argc, char **argv);
struct cmd_handler {
char *command;
const char *command;
sway_cmd *handle;
};
@ -46,7 +47,7 @@ enum expected_args {
struct cmd_results *checkarg(int argc, const char *name,
enum expected_args type, int val);
const struct cmd_handler *find_handler(char *line,
const struct cmd_handler *find_handler(const char *line,
const struct cmd_handler *cmd_handlers, size_t handlers_size);
/**
@ -76,7 +77,7 @@ struct cmd_results *config_commands_command(char *exec);
/**
* Allocates a cmd_results object.
*/
struct cmd_results *cmd_results_new(enum cmd_status status, const char *error, ...);
struct cmd_results *cmd_results_new(enum cmd_status status, const char *error, ...) _SWAY_ATTRIB_PRINTF(2, 3);
/**
* Frees a cmd_results object.
*/
@ -103,15 +104,18 @@ struct sway_container *container_find_resize_parent(struct sway_container *con,
sway_cmd cmd_exec_validate;
sway_cmd cmd_exec_process;
sway_cmd cmd_allow_tearing;
sway_cmd cmd_assign;
sway_cmd cmd_bar;
sway_cmd cmd_bindcode;
sway_cmd cmd_bindgesture;
sway_cmd cmd_bindswitch;
sway_cmd cmd_bindsym;
sway_cmd cmd_border;
sway_cmd cmd_client_noop;
sway_cmd cmd_client_focused;
sway_cmd cmd_client_focused_inactive;
sway_cmd cmd_client_focused_tab_title;
sway_cmd cmd_client_unfocused;
sway_cmd cmd_client_urgent;
sway_cmd cmd_client_placeholder;
@ -157,12 +161,11 @@ sway_cmd cmd_new_float;
sway_cmd cmd_new_window;
sway_cmd cmd_nop;
sway_cmd cmd_opacity;
sway_cmd cmd_new_float;
sway_cmd cmd_new_window;
sway_cmd cmd_no_focus;
sway_cmd cmd_output;
sway_cmd cmd_permit;
sway_cmd cmd_popup_during_fullscreen;
sway_cmd cmd_primary_selection;
sway_cmd cmd_reject;
sway_cmd cmd_reload;
sway_cmd cmd_rename;
@ -190,6 +193,7 @@ sway_cmd cmd_titlebar_border_thickness;
sway_cmd cmd_titlebar_padding;
sway_cmd cmd_unbindcode;
sway_cmd cmd_unbindswitch;
sway_cmd cmd_unbindgesture;
sway_cmd cmd_unbindsym;
sway_cmd cmd_unmark;
sway_cmd cmd_urgent;
@ -246,9 +250,11 @@ sway_cmd input_cmd_seat;
sway_cmd input_cmd_accel_profile;
sway_cmd input_cmd_calibration_matrix;
sway_cmd input_cmd_click_method;
sway_cmd input_cmd_clickfinger_button_map;
sway_cmd input_cmd_drag;
sway_cmd input_cmd_drag_lock;
sway_cmd input_cmd_dwt;
sway_cmd input_cmd_dwtp;
sway_cmd input_cmd_events;
sway_cmd input_cmd_left_handed;
sway_cmd input_cmd_map_from_region;
@ -257,10 +263,12 @@ sway_cmd input_cmd_map_to_region;
sway_cmd input_cmd_middle_emulation;
sway_cmd input_cmd_natural_scroll;
sway_cmd input_cmd_pointer_accel;
sway_cmd input_cmd_rotation_angle;
sway_cmd input_cmd_scroll_factor;
sway_cmd input_cmd_repeat_delay;
sway_cmd input_cmd_repeat_rate;
sway_cmd input_cmd_scroll_button;
sway_cmd input_cmd_scroll_button_lock;
sway_cmd input_cmd_scroll_method;
sway_cmd input_cmd_tap;
sway_cmd input_cmd_tap_button_map;
@ -276,18 +284,24 @@ sway_cmd input_cmd_xkb_switch_layout;
sway_cmd input_cmd_xkb_variant;
sway_cmd output_cmd_adaptive_sync;
sway_cmd output_cmd_allow_tearing;
sway_cmd output_cmd_background;
sway_cmd output_cmd_color_profile;
sway_cmd output_cmd_disable;
sway_cmd output_cmd_dpms;
sway_cmd output_cmd_enable;
sway_cmd output_cmd_max_render_time;
sway_cmd output_cmd_mode;
sway_cmd output_cmd_modeline;
sway_cmd output_cmd_position;
sway_cmd output_cmd_power;
sway_cmd output_cmd_render_bit_depth;
sway_cmd output_cmd_scale;
sway_cmd output_cmd_scale_filter;
sway_cmd output_cmd_subpixel;
sway_cmd output_cmd_toggle;
sway_cmd output_cmd_transform;
sway_cmd output_cmd_unplug;
sway_cmd seat_cmd_attach;
sway_cmd seat_cmd_cursor;

View file

@ -5,16 +5,21 @@
#include <string.h>
#include <time.h>
#include <wlr/interfaces/wlr_switch.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_tablet_tool.h>
#include <wlr/util/box.h>
#include <wlr/render/color.h>
#include <xkbcommon/xkbcommon.h>
#include <xf86drmMode.h>
#include "../include/config.h"
#include "gesture.h"
#include "list.h"
#include "stringop.h"
#include "swaynag.h"
#include "tree/container.h"
#include "sway/input/tablet.h"
#include "sway/tree/root.h"
#include "wlr-layer-shell-unstable-v1-protocol.h"
#include <pango/pangocairo.h>
// TODO: Refactor this shit
@ -31,7 +36,8 @@ enum binding_input_type {
BINDING_KEYSYM,
BINDING_MOUSECODE,
BINDING_MOUSESYM,
BINDING_SWITCH
BINDING_SWITCH, // dummy, only used to call seat_execute_command
BINDING_GESTURE // dummy, only used to call seat_execute_command
};
enum binding_flags {
@ -44,10 +50,11 @@ enum binding_flags {
BINDING_RELOAD = 1 << 6, // switch only; (re)trigger binding on reload
BINDING_INHIBITED = 1 << 7, // keyboard only: ignore shortcut inhibitor
BINDING_NOREPEAT = 1 << 8, // keyboard only; do not trigger when repeating a held key
BINDING_EXACT = 1 << 9, // gesture only; only trigger on exact match
};
/**
* A key binding and an associated command.
* A key (or mouse) binding and an associated command.
*/
struct sway_binding {
enum binding_input_type type;
@ -61,12 +68,10 @@ struct sway_binding {
char *command;
};
/**
* A mouse binding and an associated command.
*/
struct sway_mouse_binding {
uint32_t button;
char *command;
enum sway_switch_trigger {
SWAY_SWITCH_TRIGGER_OFF,
SWAY_SWITCH_TRIGGER_ON,
SWAY_SWITCH_TRIGGER_TOGGLE,
};
/**
@ -74,11 +79,21 @@ struct sway_mouse_binding {
*/
struct sway_switch_binding {
enum wlr_switch_type type;
enum wlr_switch_state state;
enum sway_switch_trigger trigger;
uint32_t flags;
char *command;
};
/**
* A gesture binding and an associated command.
*/
struct sway_gesture_binding {
char *input;
uint32_t flags;
struct gesture gesture;
char *command;
};
/**
* Focus on window activation.
*/
@ -98,6 +113,7 @@ struct sway_mode {
list_t *keycode_bindings;
list_t *mouse_bindings;
list_t *switch_bindings;
list_t *gesture_bindings;
bool pango;
};
@ -133,17 +149,21 @@ struct input_config {
int accel_profile;
struct calibration_matrix calibration_matrix;
int click_method;
int clickfinger_button_map;
int drag;
int drag_lock;
int dwt;
int dwtp;
int left_handed;
int middle_emulation;
int natural_scroll;
float pointer_accel;
float rotation_angle;
float scroll_factor;
int repeat_delay;
int repeat_rate;
int scroll_button;
int scroll_button_lock;
int scroll_method;
int send_events;
int tap;
@ -233,12 +253,6 @@ struct seat_config {
} xcursor_theme;
};
enum config_dpms {
DPMS_IGNORE,
DPMS_ON,
DPMS_OFF,
};
enum scale_filter_mode {
SCALE_FILTER_DEFAULT, // the default is currently smart
SCALE_FILTER_LINEAR,
@ -246,6 +260,13 @@ enum scale_filter_mode {
SCALE_FILTER_SMART,
};
enum render_bit_depth {
RENDER_BIT_DEPTH_DEFAULT, // the default is currently 8
RENDER_BIT_DEPTH_6,
RENDER_BIT_DEPTH_8,
RENDER_BIT_DEPTH_10,
};
/**
* Size and position configuration for a particular output.
*
@ -254,9 +275,11 @@ enum scale_filter_mode {
struct output_config {
char *name;
int enabled;
int power;
int width, height;
float refresh_rate;
int custom_mode;
drmModeModeInfo drm_mode;
int x, y;
float scale;
enum scale_filter_mode scale_filter;
@ -264,11 +287,14 @@ struct output_config {
enum wl_output_subpixel subpixel;
int max_render_time; // In milliseconds
int adaptive_sync;
enum render_bit_depth render_bit_depth;
bool set_color_transform;
struct wlr_color_transform *color_transform;
int allow_tearing;
char *background;
char *background_option;
char *background_fallback;
enum config_dpms dpms_state;
};
/**
@ -281,6 +307,12 @@ struct side_gaps {
int left;
};
enum smart_gaps_mode {
SMART_GAPS_OFF,
SMART_GAPS_ON,
SMART_GAPS_INVERSE_OUTER,
};
/**
* Stores configuration for a workspace, regardless of whether the workspace
* exists.
@ -292,6 +324,12 @@ struct workspace_config {
struct side_gaps gaps_outer;
};
enum pango_markup_config {
PANGO_MARKUP_DISABLED = false,
PANGO_MARKUP_ENABLED = true,
PANGO_MARKUP_DEFAULT // The default is font dependent ("pango:" prefix)
};
struct bar_config {
char *swaybar_command;
struct wl_client *client;
@ -323,7 +361,7 @@ struct bar_config {
char *position;
list_t *bindings;
char *status_command;
bool pango_markup;
enum pango_markup_config pango_markup;
char *font;
int height; // -1 not defined
bool workspace_buttons;
@ -410,14 +448,6 @@ enum sway_popup_during_fullscreen {
POPUP_LEAVE,
};
enum command_context {
CONTEXT_CONFIG = 1 << 0,
CONTEXT_BINDING = 1 << 1,
CONTEXT_IPC = 1 << 2,
CONTEXT_CRITERIA = 1 << 3,
CONTEXT_ALL = 0xFFFFFFFF,
};
enum focus_follows_mouse_mode {
FOLLOWS_NO,
FOLLOWS_YES,
@ -479,9 +509,10 @@ struct sway_config {
char *floating_scroll_right_cmd;
enum sway_container_layout default_orientation;
enum sway_container_layout default_layout;
char *font;
size_t font_height;
size_t font_baseline;
char *font; // Used for IPC.
PangoFontDescription *font_description; // Used internally for rendering and validating.
int font_height;
int font_baseline;
bool pango_markup;
int titlebar_border_thickness;
int titlebar_h_padding;
@ -508,11 +539,12 @@ struct sway_config {
bool auto_back_and_forth;
bool show_marks;
enum alignment title_align;
bool primary_selection;
bool tiling_drag;
int tiling_drag_threshold;
bool smart_gaps;
enum smart_gaps_mode smart_gaps;
int gaps_inner;
struct side_gaps gaps_outer;
@ -535,12 +567,15 @@ struct sway_config {
struct {
struct border_colors focused;
struct border_colors focused_inactive;
struct border_colors focused_tab_title;
struct border_colors unfocused;
struct border_colors urgent;
struct border_colors placeholder;
float background[4];
} border_colors;
bool has_focused_tab_title;
// floating view
int32_t floating_maximum_width;
int32_t floating_maximum_height;
@ -598,7 +633,7 @@ void run_deferred_bindings(void);
/**
* Adds a warning entry to the swaynag instance used for errors.
*/
void config_add_swaynag_warning(char *fmt, ...);
void config_add_swaynag_warning(char *fmt, ...) _SWAY_ATTRIB_PRINTF(1, 2);
/**
* Free config struct
@ -651,22 +686,26 @@ const char *sway_output_scale_filter_to_string(enum scale_filter_mode scale_filt
struct output_config *new_output_config(const char *name);
void merge_output_config(struct output_config *dst, struct output_config *src);
bool apply_output_configs(struct output_config **ocs, size_t ocs_len,
bool test_only, bool degrade_to_off);
bool apply_output_config(struct output_config *oc, struct sway_output *output);
void apply_stored_output_configs(void);
bool test_output_config(struct output_config *oc, struct sway_output *output);
struct output_config *store_output_config(struct output_config *oc);
/**
* store_output_config stores a new output config. An output may be matched by
* three different config types, in order of precedence: Identifier, name and
* wildcard. When storing a config type of lower precedence, assume that the
* user wants the config to take immediate effect by superseding (clearing) the
* same values from higher presedence configuration.
*/
void store_output_config(struct output_config *oc);
struct output_config *find_output_config(struct sway_output *output);
void apply_output_config_to_outputs(struct output_config *oc);
void reset_outputs(void);
void free_output_config(struct output_config *oc);
void request_modeset(void);
bool spawn_swaybg(void);
int workspace_output_cmp_workspace(const void *a, const void *b);
@ -675,6 +714,8 @@ void free_sway_binding(struct sway_binding *sb);
void free_switch_binding(struct sway_switch_binding *binding);
void free_gesture_binding(struct sway_gesture_binding *binding);
void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding);
void load_swaybar(struct bar_config *bar);
@ -690,14 +731,13 @@ void free_bar_binding(struct bar_binding *binding);
void free_workspace_config(struct workspace_config *wsc);
/**
* Updates the value of config->font_height based on the max title height
* reported by each container. If recalculate is true, the containers will
* recalculate their heights before reporting.
* Updates the value of config->font_height based on the metrics for title's
* font as reported by pango.
*
* If the height has changed, all containers will be rearranged to take on the
* new size.
*/
void config_update_font_height(bool recalculate);
void config_update_font_height(void);
/**
* Convert bindsym into bindcode using the first configured layout.

View file

@ -1,11 +1,16 @@
#ifndef _SWAY_CRITERIA_H
#define _SWAY_CRITERIA_H
#include <pcre.h>
#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>
#include "config.h"
#include "list.h"
#include "tree/view.h"
#if WLR_HAS_XWAYLAND
#include "sway/xwayland.h"
#endif
enum criteria_type {
CT_COMMAND = 1 << 0,
CT_ASSIGN_OUTPUT = 1 << 1,
@ -15,13 +20,13 @@ enum criteria_type {
};
enum pattern_type {
PATTERN_PCRE,
PATTERN_PCRE2,
PATTERN_FOCUSED,
};
struct pattern {
enum pattern_type match_type;
pcre *regex;
pcre2_code *regex;
};
struct criteria {
@ -35,13 +40,14 @@ struct criteria {
struct pattern *app_id;
struct pattern *con_mark;
uint32_t con_id; // internal ID
#if HAVE_XWAYLAND
#if WLR_HAS_XWAYLAND
struct pattern *class;
uint32_t id; // X11 window ID
struct pattern *instance;
struct pattern *window_role;
enum atom_name window_type;
#endif
bool all;
bool floating;
bool tiling;
char urgent; // 'l' for latest or 'o' for oldest

View file

@ -1,13 +0,0 @@
#include <wlr/types/wlr_surface.h>
struct sway_container;
struct sway_view;
void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly,
bool whole);
void desktop_damage_whole_container(struct sway_container *con);
void desktop_damage_box(struct wlr_box *box);
void desktop_damage_view(struct sway_view *view);

View file

@ -1,8 +1,6 @@
#ifndef _SWAY_DESKTOP_IDLE_INHIBIT_V1_H
#define _SWAY_DESKTOP_IDLE_INHIBIT_V1_H
#include <wlr/types/wlr_idle_inhibit_v1.h>
#include <wlr/types/wlr_idle.h>
#include "sway/server.h"
enum sway_idle_inhibit_mode {
INHIBIT_IDLE_APPLICATION, // Application set inhibitor (when visible)
@ -16,12 +14,9 @@ struct sway_idle_inhibit_manager_v1 {
struct wlr_idle_inhibit_manager_v1 *wlr_manager;
struct wl_listener new_idle_inhibitor_v1;
struct wl_list inhibitors;
struct wlr_idle *idle;
};
struct sway_idle_inhibitor_v1 {
struct sway_idle_inhibit_manager_v1 *manager;
struct wlr_idle_inhibitor_v1 *wlr_inhibitor;
struct sway_view *view;
enum sway_idle_inhibit_mode mode;
@ -33,8 +28,7 @@ struct sway_idle_inhibitor_v1 {
bool sway_idle_inhibit_v1_is_active(
struct sway_idle_inhibitor_v1 *inhibitor);
void sway_idle_inhibit_v1_check_active(
struct sway_idle_inhibit_manager_v1 *manager);
void sway_idle_inhibit_v1_check_active(void);
void sway_idle_inhibit_v1_user_inhibitor_register(struct sway_view *view,
enum sway_idle_inhibit_mode mode);
@ -48,6 +42,6 @@ struct sway_idle_inhibitor_v1 *sway_idle_inhibit_v1_application_inhibitor_for_vi
void sway_idle_inhibit_v1_user_inhibitor_destroy(
struct sway_idle_inhibitor_v1 *inhibitor);
struct sway_idle_inhibit_manager_v1 *sway_idle_inhibit_manager_v1_create(
struct wl_display *wl_display, struct wlr_idle *idle);
bool sway_idle_inhibit_manager_v1_init(void);
#endif

View file

@ -0,0 +1,40 @@
#ifndef _SWAY_LAUNCHER_H
#define _SWAY_LAUNCHER_H
#include <stdlib.h>
#include <wayland-server-core.h>
#include "sway/input/seat.h"
struct launcher_ctx {
pid_t pid;
char *fallback_name;
struct wlr_xdg_activation_token_v1 *token;
struct wl_listener token_destroy;
struct sway_seat *seat;
struct wl_listener seat_destroy;
bool activated;
bool had_focused_surface;
struct sway_node *node;
struct wl_listener node_destroy;
struct wl_list link; // sway_server::pending_launcher_ctxs
};
struct launcher_ctx *launcher_ctx_find_pid(pid_t pid);
struct sway_workspace *launcher_ctx_get_workspace(struct launcher_ctx *ctx);
void launcher_ctx_consume(struct launcher_ctx *ctx);
void launcher_ctx_destroy(struct launcher_ctx *ctx);
struct launcher_ctx *launcher_ctx_create_internal(void);
struct launcher_ctx *launcher_ctx_create(
struct wlr_xdg_activation_token_v1 *token, struct sway_node *node);
const char *launcher_ctx_get_token_name(struct launcher_ctx *ctx);
#endif

View file

@ -1,6 +1,8 @@
#ifndef _SWAY_TRANSACTION_H
#define _SWAY_TRANSACTION_H
#include <stdint.h>
#include <stdbool.h>
#include <wlr/types/wlr_scene.h>
/**
* Transactions enable us to perform atomic layout updates.
@ -38,8 +40,11 @@ void transaction_commit_dirty_client(void);
* Notify the transaction system that a view is ready for the new layout.
*
* When all views in the transaction are ready, the layout will be applied.
*
* A success boolean is returned denoting that this part of the transaction is
* ready.
*/
void transaction_notify_view_ready_by_serial(struct sway_view *view,
bool transaction_notify_view_ready_by_serial(struct sway_view *view,
uint32_t serial);
/**
@ -47,8 +52,13 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view,
* identifying the instruction by geometry rather than by serial.
*
* This is used by xwayland views, as they don't have serials.
*
* A success boolean is returned denoting that this part of the transaction is
* ready.
*/
void transaction_notify_view_ready_by_geometry(struct sway_view *view,
bool transaction_notify_view_ready_by_geometry(struct sway_view *view,
double x, double y, int width, int height);
void arrange_popups(struct wlr_scene_tree *popups);
#endif

View file

@ -4,7 +4,7 @@
#include <stdint.h>
#include <wlr/types/wlr_pointer_constraints_v1.h>
#include <wlr/types/wlr_pointer_gestures_v1.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_compositor.h>
#include "sway/input/seat.h"
#include "config.h"
@ -35,7 +35,8 @@ struct sway_cursor {
pixman_region32_t confine; // invalid if active_constraint == NULL
bool active_confine_requires_warp;
struct wlr_pointer_gestures_v1 *pointer_gestures;
struct wl_listener hold_begin;
struct wl_listener hold_end;
struct wl_listener pinch_begin;
struct wl_listener pinch_update;
struct wl_listener pinch_end;
@ -51,8 +52,11 @@ struct sway_cursor {
struct wl_listener touch_down;
struct wl_listener touch_up;
struct wl_listener touch_cancel;
struct wl_listener touch_motion;
struct wl_listener touch_frame;
bool simulating_pointer_from_touch;
bool pointer_touch_up;
int32_t pointer_touch_id;
struct wl_listener tool_axis;
@ -60,6 +64,7 @@ struct sway_cursor {
struct wl_listener tool_proximity;
struct wl_listener tool_button;
bool simulating_pointer_from_tool_tip;
bool simulating_pointer_from_tool_button;
uint32_t tool_buttons;
struct wl_listener request_set_cursor;
@ -103,12 +108,16 @@ void cursor_unhide(struct sway_cursor *cursor);
int cursor_get_timeout(struct sway_cursor *cursor);
void cursor_notify_key_press(struct sway_cursor *cursor);
void pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
struct wlr_input_device *device, double dx, double dy,
double dx_unaccel, double dy_unaccel);
void dispatch_cursor_button(struct sway_cursor *cursor,
struct wlr_input_device *device, uint32_t time_msec, uint32_t button,
enum wlr_button_state state);
enum wl_pointer_button_state state);
void dispatch_cursor_axis(struct sway_cursor *cursor,
struct wlr_event_pointer_axis *event);
struct wlr_pointer_axis_event *event);
void cursor_set_image(struct sway_cursor *cursor, const char *image,
struct wl_client *client);
@ -136,4 +145,6 @@ uint32_t get_mouse_button(const char *name, char **error);
const char *get_mouse_button_name(uint32_t button);
void handle_request_set_cursor_shape(struct wl_listener *listener, void *data);
#endif

View file

@ -1,14 +1,15 @@
#ifndef _SWAY_INPUT_INPUT_MANAGER_H
#define _SWAY_INPUT_INPUT_MANAGER_H
#include <libinput.h>
#include <wlr/types/wlr_input_inhibitor.h>
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
#include <wlr/types/wlr_virtual_keyboard_v1.h>
#include <wlr/types/wlr_virtual_pointer_v1.h>
#include "sway/server.h"
#include <wlr/types/wlr_transient_seat_v1.h>
#include "sway/config.h"
#include "list.h"
struct sway_server;
struct sway_input_device {
char *identifier;
struct wlr_input_device *wlr_device;
@ -21,10 +22,11 @@ struct sway_input_manager {
struct wl_list devices;
struct wl_list seats;
struct wlr_input_inhibit_manager *inhibit;
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
struct wlr_pointer_gestures_v1 *pointer_gestures;
struct wlr_transient_seat_manager_v1 *transient_seat_manager;
struct wl_listener new_input;
struct wl_listener inhibit_activate;
@ -32,6 +34,7 @@ struct sway_input_manager {
struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor;
struct wl_listener virtual_keyboard_new;
struct wl_listener virtual_pointer_new;
struct wl_listener transient_seat_create;
};
struct sway_input_manager *input_manager_create(struct sway_server *server);
@ -44,7 +47,7 @@ void input_manager_configure_xcursor(void);
void input_manager_apply_input_config(struct input_config *input_config);
void input_manager_configure_all_inputs(void);
void input_manager_configure_all_input_mappings(void);
void input_manager_reset_input(struct sway_input_device *input_device);

View file

@ -50,6 +50,7 @@ struct sway_shortcut_state {
struct sway_keyboard {
struct sway_seat_device *seat_device;
struct wlr_keyboard *wlr;
struct xkb_keymap *keymap;
xkb_layout_index_t effective_layout;

View file

@ -2,7 +2,10 @@
#define _SWAY_INPUT_LIBINPUT_H
#include "sway/input/input-manager.h"
void sway_input_configure_libinput_device(struct sway_input_device *device);
bool sway_input_configure_libinput_device(struct sway_input_device *device);
void sway_input_configure_libinput_device_send_events(
struct sway_input_device *device);
void sway_input_reset_libinput_device(struct sway_input_device *device);

View file

@ -3,7 +3,9 @@
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
#include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_seat.h>
#include <wlr/types/wlr_touch.h>
#include <wlr/util/edges.h>
#include "sway/config.h"
#include "sway/input/input-manager.h"
@ -15,19 +17,41 @@ struct sway_seat;
struct sway_seatop_impl {
void (*button)(struct sway_seat *seat, uint32_t time_msec,
struct wlr_input_device *device, uint32_t button,
enum wlr_button_state state);
enum wl_pointer_button_state state);
void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec);
void (*pointer_axis)(struct sway_seat *seat,
struct wlr_event_pointer_axis *event);
struct wlr_pointer_axis_event *event);
void (*hold_begin)(struct sway_seat *seat,
struct wlr_pointer_hold_begin_event *event);
void (*hold_end)(struct sway_seat *seat,
struct wlr_pointer_hold_end_event *event);
void (*pinch_begin)(struct sway_seat *seat,
struct wlr_pointer_pinch_begin_event *event);
void (*pinch_update)(struct sway_seat *seat,
struct wlr_pointer_pinch_update_event *event);
void (*pinch_end)(struct sway_seat *seat,
struct wlr_pointer_pinch_end_event *event);
void (*swipe_begin)(struct sway_seat *seat,
struct wlr_pointer_swipe_begin_event *event);
void (*swipe_update)(struct sway_seat *seat,
struct wlr_pointer_swipe_update_event *event);
void (*swipe_end)(struct sway_seat *seat,
struct wlr_pointer_swipe_end_event *event);
void (*rebase)(struct sway_seat *seat, uint32_t time_msec);
void (*touch_motion)(struct sway_seat *seat,
struct wlr_touch_motion_event *event, double lx, double ly);
void (*touch_up)(struct sway_seat *seat,
struct wlr_touch_up_event *event);
void (*touch_down)(struct sway_seat *seat,
struct wlr_touch_down_event *event, double lx, double ly);
void (*touch_cancel)(struct sway_seat *seat,
struct wlr_touch_cancel_event *event);
void (*tablet_tool_motion)(struct sway_seat *seat,
struct sway_tablet_tool *tool, uint32_t time_msec);
void (*tablet_tool_tip)(struct sway_seat *seat, struct sway_tablet_tool *tool,
uint32_t time_msec, enum wlr_tablet_tool_tip_state state);
void (*end)(struct sway_seat *seat);
void (*unref)(struct sway_seat *seat, struct sway_container *con);
void (*render)(struct sway_seat *seat, struct sway_output *output,
pixman_region32_t *damage);
bool allow_set_cursor;
};
@ -50,19 +74,6 @@ struct sway_seat_node {
struct wl_listener destroy;
};
struct sway_drag_icon {
struct sway_seat *seat;
struct wlr_drag_icon *wlr_drag_icon;
struct wl_list link; // sway_root::drag_icons
double x, y; // in layout-local coordinates
struct wl_listener surface_commit;
struct wl_listener map;
struct wl_listener unmap;
struct wl_listener destroy;
};
struct sway_drag {
struct sway_seat *seat;
struct wlr_drag *wlr_drag;
@ -73,16 +84,23 @@ struct sway_seat {
struct wlr_seat *wlr_seat;
struct sway_cursor *cursor;
// Seat scene tree structure
// - scene_tree
// - drag icons
// - drag icon 1
// - drag icon 2
// - seatop specific stuff
struct wlr_scene_tree *scene_tree;
struct wlr_scene_tree *drag_icons;
bool has_focus;
struct wl_list focus_stack; // list of containers in focus order
struct sway_workspace *workspace;
char *prev_workspace_name; // for workspace back_and_forth
// If the focused layer is set, views cannot receive keyboard focus
struct wlr_layer_surface_v1 *focused_layer;
// If exclusive_client is set, no other clients will receive input events
struct wl_client *exclusive_client;
// If the exclusive layer is set, views cannot receive keyboard focus
bool has_exclusive_layer;
// Last touch point
int32_t touch_id;
@ -106,6 +124,7 @@ struct sway_seat {
struct wl_listener start_drag;
struct wl_listener request_set_selection;
struct wl_listener request_set_primary_selection;
struct wl_listener destroy;
struct wl_list devices; // sway_seat_device::link
struct wl_list keyboard_groups; // sway_keyboard_group::link
@ -141,6 +160,9 @@ void seat_add_device(struct sway_seat *seat,
void seat_configure_device(struct sway_seat *seat,
struct sway_input_device *device);
void seat_configure_device_mapping(struct sway_seat *seat,
struct sway_input_device *input_device);
void seat_reset_device(struct sway_seat *seat,
struct sway_input_device *input_device);
@ -171,8 +193,7 @@ void seat_set_focus_surface(struct sway_seat *seat,
void seat_set_focus_layer(struct sway_seat *seat,
struct wlr_layer_surface_v1 *layer);
void seat_set_exclusive_client(struct sway_seat *seat,
struct wl_client *client);
void seat_unfocus_unless_client(struct sway_seat *seat, struct wl_client *client);
struct sway_node *seat_get_focus(struct sway_seat *seat);
@ -231,7 +252,7 @@ void seat_idle_notify_activity(struct sway_seat *seat,
bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface);
void drag_icon_update_position(struct sway_drag_icon *icon);
void drag_icons_update_position(struct sway_seat *seat);
enum wlr_edges find_resize_edge(struct sway_container *cont,
struct wlr_surface *surface, struct sway_cursor *cursor);
@ -239,7 +260,13 @@ enum wlr_edges find_resize_edge(struct sway_container *cont,
void seatop_begin_default(struct sway_seat *seat);
void seatop_begin_down(struct sway_seat *seat, struct sway_container *con,
uint32_t time_msec, int sx, int sy);
double sx, double sy);
void seatop_begin_down_on_surface(struct sway_seat *seat,
struct wlr_surface *surface, double sx, double sy);
void seatop_begin_touch_down(struct sway_seat *seat, struct wlr_surface *surface,
struct wlr_touch_down_event *event, double sx, double sy, double lx, double ly);
void seatop_begin_move_floating(struct sway_seat *seat,
struct sway_container *con);
@ -260,18 +287,18 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat,
struct sway_workspace *workspace);
void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec,
uint32_t button, enum wlr_button_state state);
uint32_t button, enum wl_pointer_button_state state);
void seat_consider_warp_to_focus(struct sway_seat *seat);
void seatop_button(struct sway_seat *seat, uint32_t time_msec,
struct wlr_input_device *device, uint32_t button,
enum wlr_button_state state);
enum wl_pointer_button_state state);
void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec);
void seatop_pointer_axis(struct sway_seat *seat,
struct wlr_event_pointer_axis *event);
struct wlr_pointer_axis_event *event);
void seatop_tablet_tool_tip(struct sway_seat *seat,
struct sway_tablet_tool *tool, uint32_t time_msec,
@ -280,6 +307,37 @@ void seatop_tablet_tool_tip(struct sway_seat *seat,
void seatop_tablet_tool_motion(struct sway_seat *seat,
struct sway_tablet_tool *tool, uint32_t time_msec);
void seatop_hold_begin(struct sway_seat *seat,
struct wlr_pointer_hold_begin_event *event);
void seatop_hold_end(struct sway_seat *seat,
struct wlr_pointer_hold_end_event *event);
void seatop_pinch_begin(struct sway_seat *seat,
struct wlr_pointer_pinch_begin_event *event);
void seatop_pinch_update(struct sway_seat *seat,
struct wlr_pointer_pinch_update_event *event);
void seatop_pinch_end(struct sway_seat *seat,
struct wlr_pointer_pinch_end_event *event);
void seatop_swipe_begin(struct sway_seat *seat,
struct wlr_pointer_swipe_begin_event *event);
void seatop_swipe_update(struct sway_seat *seat,
struct wlr_pointer_swipe_update_event *event);
void seatop_swipe_end(struct sway_seat *seat,
struct wlr_pointer_swipe_end_event *event);
void seatop_touch_motion(struct sway_seat *seat,
struct wlr_touch_motion_event *event, double lx, double ly);
void seatop_touch_up(struct sway_seat *seat,
struct wlr_touch_up_event *event);
void seatop_touch_down(struct sway_seat *seat,
struct wlr_touch_down_event *event, double lx, double ly);
void seatop_touch_cancel(struct sway_seat *seat,
struct wlr_touch_cancel_event *event);
void seatop_rebase(struct sway_seat *seat, uint32_t time_msec);
/**
@ -294,13 +352,6 @@ void seatop_end(struct sway_seat *seat);
*/
void seatop_unref(struct sway_seat *seat, struct sway_container *con);
/**
* Instructs a seatop to render anything that it needs to render
* (eg. dropzone for move-tiling)
*/
void seatop_render(struct sway_seat *seat, struct sway_output *output,
pixman_region32_t *damage);
bool seatop_allows_set_cursor(struct sway_seat *seat);
/**

View file

@ -5,6 +5,7 @@
struct sway_switch {
struct sway_seat_device *seat_device;
struct wlr_switch *wlr;
enum wlr_switch_state state;
enum wlr_switch_type type;

View file

@ -32,6 +32,7 @@ struct sway_tablet_pad {
struct wl_list link;
struct sway_seat_device *seat_device;
struct sway_tablet *tablet;
struct wlr_tablet_pad *wlr;
struct wlr_tablet_v2_tablet_pad *tablet_v2_pad;
struct wl_listener attach;
@ -62,7 +63,7 @@ void sway_configure_tablet_pad(struct sway_tablet_pad *tablet_pad);
void sway_tablet_pad_destroy(struct sway_tablet_pad *tablet_pad);
void sway_tablet_pad_notify_enter(struct sway_tablet_pad *tablet_pad,
void sway_tablet_pad_set_focus(struct sway_tablet_pad *tablet_pad,
struct wlr_surface *surface);
#endif

View file

@ -3,13 +3,12 @@
#include <wlr/types/wlr_text_input_v3.h>
#include <wlr/types/wlr_input_method_v2.h>
#include <wlr/types/wlr_surface.h>
#include "sway/input/seat.h"
#include <wlr/types/wlr_compositor.h>
/**
* The relay structure manages the relationship between text-input and
* input_method interfaces on a given seat. Multiple text-input interfaces may
* be bound to a relay, but at most one will be focused (reveiving events) at
* be bound to a relay, but at most one will be focused (receiving events) at
* a time. At most one input-method interface may be bound to the seat. The
* relay manages life cycle of both sides. When both sides are present and
* focused, the relay passes messages between them.
@ -22,18 +21,21 @@ struct sway_input_method_relay {
struct sway_seat *seat;
struct wl_list text_inputs; // sway_text_input::link
struct wl_list input_popups; // sway_input_popup::link
struct wlr_input_method_v2 *input_method; // doesn't have to be present
struct wl_listener text_input_new;
struct wl_listener input_method_new;
struct wl_listener input_method_commit;
struct wl_listener input_method_new_popup_surface;
struct wl_listener input_method_grab_keyboard;
struct wl_listener input_method_destroy;
struct wl_listener input_method_keyboard_grab_destroy;
};
struct sway_text_input {
struct sway_input_method_relay *relay;

View file

@ -0,0 +1,23 @@
#ifndef _SWAY_INPUT_TEXT_INPUT_POPUP_H
#define _SWAY_INPUT_TEXT_INPUT_POPUP_H
#include "sway/tree/view.h"
struct sway_input_popup {
struct sway_input_method_relay *relay;
struct wlr_scene_tree *scene_tree;
struct sway_popup_desc desc;
struct wlr_input_popup_surface_v2 *popup_surface;
struct wlr_output *fixed_output;
struct wl_list link;
struct wl_listener popup_destroy;
struct wl_listener popup_surface_commit;
struct wl_listener popup_surface_map;
struct wl_listener popup_surface_unmap;
struct wl_listener focused_surface_unmap;
};
#endif

View file

@ -1,6 +1,7 @@
#ifndef _SWAY_IPC_JSON_H
#define _SWAY_IPC_JSON_H
#include <json.h>
#include "sway/output.h"
#include "sway/tree/container.h"
#include "sway/input/input-manager.h"
@ -9,6 +10,7 @@ json_object *ipc_json_get_version(void);
json_object *ipc_json_get_binding_mode(void);
json_object *ipc_json_describe_disabled_output(struct sway_output *o);
json_object *ipc_json_describe_non_desktop_output(struct sway_output_non_desktop *o);
json_object *ipc_json_describe_node(struct sway_node *node);
json_object *ipc_json_describe_node_recursive(struct sway_node *node);
json_object *ipc_json_describe_input(struct sway_input_device *device);

View file

@ -21,5 +21,6 @@ void ipc_event_mode(const char *mode, bool pango);
void ipc_event_shutdown(const char *reason);
void ipc_event_binding(struct sway_binding *binding);
void ipc_event_input(const char *change, struct sway_input_device *device);
void ipc_event_output(void);
#endif

View file

@ -1,59 +1,44 @@
#ifndef _SWAY_LAYERS_H
#define _SWAY_LAYERS_H
#include <stdbool.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_layer_shell_v1.h>
enum layer_parent {
LAYER_PARENT_LAYER,
LAYER_PARENT_POPUP,
};
#include "sway/tree/view.h"
struct sway_layer_surface {
struct wlr_layer_surface_v1 *layer_surface;
struct wl_list link;
struct wl_listener destroy;
struct wl_listener map;
struct wl_listener unmap;
struct wl_listener surface_commit;
struct wl_listener output_destroy;
struct wl_listener node_destroy;
struct wl_listener new_popup;
struct wl_listener new_subsurface;
struct wlr_box geo;
enum zwlr_layer_shell_v1_layer layer;
bool mapped;
struct wlr_scene_tree *popups;
struct sway_popup_desc desc;
struct sway_output *output;
struct wlr_scene_layer_surface_v1 *scene;
struct wlr_scene_tree *tree;
struct wlr_layer_surface_v1 *layer_surface;
};
struct sway_layer_popup {
struct wlr_xdg_popup *wlr_popup;
enum layer_parent parent_type;
union {
struct sway_layer_surface *parent_layer;
struct sway_layer_popup *parent_popup;
};
struct wl_listener map;
struct wl_listener unmap;
struct wlr_scene_tree *scene;
struct sway_layer_surface *toplevel;
struct wl_listener destroy;
struct wl_listener commit;
struct wl_listener new_popup;
};
struct sway_layer_subsurface {
struct wlr_subsurface *wlr_subsurface;
struct sway_layer_surface *layer_surface;
struct wl_listener map;
struct wl_listener unmap;
struct wl_listener destroy;
struct wl_listener commit;
};
struct sway_output;
struct wlr_layer_surface_v1 *toplevel_layer_surface_from_surface(
struct wlr_surface *surface);
void arrange_layers(struct sway_output *output);
struct sway_layer_surface *layer_from_wlr_layer_surface_v1(
struct wlr_layer_surface_v1 *layer_surface);
#endif

6
include/sway/lock.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef _SWAY_LOCK_H
#define _SWAY_LOCK_H
void arrange_locks(void);
#endif

View file

@ -3,8 +3,9 @@
#include <time.h>
#include <unistd.h>
#include <wayland-server-core.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_damage_ring.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_scene.h>
#include "config.h"
#include "sway/tree/node.h"
#include "sway/tree/view.h"
@ -19,43 +20,64 @@ struct sway_output_state {
struct sway_output {
struct sway_node node;
struct {
struct wlr_scene_tree *shell_background;
struct wlr_scene_tree *shell_bottom;
struct wlr_scene_tree *tiling;
struct wlr_scene_tree *fullscreen;
struct wlr_scene_tree *shell_top;
struct wlr_scene_tree *shell_overlay;
struct wlr_scene_tree *session_lock;
} layers;
// when a container is fullscreen, in case the fullscreen surface is
// translucent (can see behind) we must make sure that the background is a
// solid color in order to conform to the wayland protocol. This rect
// ensures that when looking through a surface, all that will be seen
// is black.
struct wlr_scene_rect *fullscreen_background;
struct wlr_output *wlr_output;
struct wlr_scene_output *scene_output;
struct sway_server *server;
struct wl_list link;
struct wl_list layers[4]; // sway_layer_surface::link
struct wlr_box usable_area;
struct timespec last_frame;
struct wlr_output_damage *damage;
int lx, ly; // layout coords
int width, height; // transformed buffer size
enum wl_output_subpixel detected_subpixel;
enum scale_filter_mode scale_filter;
// last applied mode when the output is DPMS'ed
struct wlr_output_mode *current_mode;
bool enabling, enabled;
bool enabled;
list_t *workspaces;
struct sway_output_state current;
struct wl_listener layout_destroy;
struct wl_listener destroy;
struct wl_listener commit;
struct wl_listener mode;
struct wl_listener present;
struct wl_listener damage_destroy;
struct wl_listener damage_frame;
struct wl_listener frame;
struct wl_listener request_state;
struct {
struct wl_signal destroy;
struct wl_signal disable;
} events;
struct wlr_color_transform *color_transform;
struct timespec last_presentation;
uint32_t refresh_nsec;
int max_render_time; // In milliseconds
struct wl_event_source *repaint_timer;
bool allow_tearing;
};
struct sway_output_non_desktop {
struct wlr_output *wlr_output;
struct wl_listener destroy;
};
struct sway_output *output_create(struct wlr_output *wlr_output);
@ -72,22 +94,12 @@ struct sway_output *output_get_in_direction(struct sway_output *reference,
void output_add_workspace(struct sway_output *output,
struct sway_workspace *workspace);
typedef void (*sway_surface_iterator_func_t)(struct sway_output *output, struct sway_view *view,
struct wlr_surface *surface, struct wlr_box *box, float rotation,
typedef void (*sway_surface_iterator_func_t)(struct sway_output *output,
struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box,
void *user_data);
void output_damage_whole(struct sway_output *output);
void output_damage_surface(struct sway_output *output, double ox, double oy,
struct wlr_surface *surface, bool whole);
void output_damage_from_view(struct sway_output *output,
struct sway_view *view);
void output_damage_box(struct sway_output *output, struct wlr_box *box);
void output_damage_whole_container(struct sway_output *output,
struct sway_container *con);
bool output_match_name_or_id(struct sway_output *output,
const char *name_or_id);
// this ONLY includes the enabled outputs
struct sway_output *output_by_name_or_id(const char *name_or_id);
@ -101,47 +113,8 @@ void output_enable(struct sway_output *output);
void output_disable(struct sway_output *output);
bool output_has_opaque_overlay_layer_surface(struct sway_output *output);
struct sway_workspace *output_get_active_workspace(struct sway_output *output);
void output_render(struct sway_output *output, struct timespec *when,
pixman_region32_t *damage);
void output_surface_for_each_surface(struct sway_output *output,
struct wlr_surface *surface, double ox, double oy,
sway_surface_iterator_func_t iterator, void *user_data);
void output_view_for_each_surface(struct sway_output *output,
struct sway_view *view, sway_surface_iterator_func_t iterator,
void *user_data);
void output_view_for_each_popup_surface(struct sway_output *output,
struct sway_view *view, sway_surface_iterator_func_t iterator,
void *user_data);
void output_layer_for_each_surface(struct sway_output *output,
struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
void *user_data);
void output_layer_for_each_toplevel_surface(struct sway_output *output,
struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
void *user_data);
void output_layer_for_each_popup_surface(struct sway_output *output,
struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
void *user_data);
#if HAVE_XWAYLAND
void output_unmanaged_for_each_surface(struct sway_output *output,
struct wl_list *unmanaged, sway_surface_iterator_func_t iterator,
void *user_data);
#endif
void output_drag_icons_for_each_surface(struct sway_output *output,
struct wl_list *drag_icons, sway_surface_iterator_func_t iterator,
void *user_data);
void output_for_each_workspace(struct sway_output *output,
void (*f)(struct sway_workspace *ws, void *data), void *data);
@ -159,18 +132,8 @@ void output_get_box(struct sway_output *output, struct wlr_box *box);
enum sway_container_layout output_get_default_layout(
struct sway_output *output);
void render_rect(struct sway_output *output,
pixman_region32_t *output_damage, const struct wlr_box *_box,
float color[static 4]);
void premultiply_alpha(float color[4], float opacity);
void scale_box(struct wlr_box *box, float scale);
enum wlr_direction opposite_direction(enum wlr_direction d);
void handle_output_layout_change(struct wl_listener *listener, void *data);
void handle_output_manager_apply(struct wl_listener *listener, void *data);
void handle_output_manager_test(struct wl_listener *listener, void *data);
@ -178,4 +141,8 @@ void handle_output_manager_test(struct wl_listener *listener, void *data);
void handle_output_power_manager_set_mode(struct wl_listener *listener,
void *data);
struct sway_output_non_desktop *output_non_desktop_create(struct wlr_output *wlr_output);
void update_output_manager_config(struct sway_server *server);
#endif

View file

@ -0,0 +1,33 @@
/**
* Across a wayland compositor, there are multiple shells: It can be
* a toplevel, or a layer_shell, or even something more meta like a drag
* icon or highlight indicators when dragging windows around.
*
* This object lets us store values that represent these modes of operation
* and keep track of what object is being represented.
*/
#ifndef _SWAY_SCENE_DESCRIPTOR_H
#define _SWAY_SCENE_DESCRIPTOR_H
#include <wlr/types/wlr_scene.h>
enum sway_scene_descriptor_type {
SWAY_SCENE_DESC_BUFFER_TIMER,
SWAY_SCENE_DESC_NON_INTERACTIVE,
SWAY_SCENE_DESC_CONTAINER,
SWAY_SCENE_DESC_VIEW,
SWAY_SCENE_DESC_LAYER_SHELL,
SWAY_SCENE_DESC_XWAYLAND_UNMANAGED,
SWAY_SCENE_DESC_POPUP,
SWAY_SCENE_DESC_DRAG_ICON,
};
bool scene_descriptor_assign(struct wlr_scene_node *node,
enum sway_scene_descriptor_type type, void *data);
void *scene_descriptor_try_get(struct wlr_scene_node *node,
enum sway_scene_descriptor_type type);
void scene_descriptor_destroy(struct wlr_scene_node *node,
enum sway_scene_descriptor_type type);
#endif

View file

@ -2,61 +2,63 @@
#define _SWAY_SERVER_H
#include <stdbool.h>
#include <wayland-server-core.h>
#include <wlr/backend.h>
#include <wlr/backend/session.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_input_method_v2.h>
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
#include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_output_management_v1.h>
#include <wlr/types/wlr_output_power_management_v1.h>
#include <wlr/types/wlr_presentation_time.h>
#include <wlr/types/wlr_relative_pointer_v1.h>
#include <wlr/types/wlr_server_decoration.h>
#include <wlr/types/wlr_text_input_v3.h>
#include <wlr/types/wlr_xdg_shell.h>
#include "config.h"
#include "list.h"
#if HAVE_XWAYLAND
#include "sway/desktop/idle_inhibit_v1.h"
#if WLR_HAS_XWAYLAND
#include "sway/xwayland.h"
#endif
struct sway_transaction;
struct sway_session_lock {
struct wlr_session_lock_v1 *lock;
struct wlr_surface *focused;
bool abandoned;
struct wl_list outputs; // struct sway_session_lock_output
// invalid if the session is abandoned
struct wl_listener new_surface;
struct wl_listener unlock;
struct wl_listener destroy;
};
struct sway_server {
struct wl_display *wl_display;
struct wl_event_loop *wl_event_loop;
const char *socket;
struct wlr_backend *backend;
struct wlr_backend *noop_backend;
struct wlr_session *session;
// secondary headless backend used for creating virtual outputs on-the-fly
struct wlr_backend *headless_backend;
struct wlr_renderer *renderer;
struct wlr_allocator *allocator;
struct wlr_compositor *compositor;
struct wl_listener compositor_new_surface;
struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1;
struct wlr_data_device_manager *data_device_manager;
struct sway_input_manager *input;
struct wl_listener new_output;
struct wl_listener output_layout_change;
struct wl_listener renderer_lost;
struct wlr_idle *idle;
struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1;
struct wlr_idle_notifier_v1 *idle_notifier_v1;
struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1;
struct wlr_layer_shell_v1 *layer_shell;
struct wl_listener layer_shell_surface;
struct wlr_xdg_shell *xdg_shell;
struct wl_listener xdg_shell_surface;
struct wl_listener xdg_shell_toplevel;
struct wlr_tablet_manager_v2 *tablet_v2;
#if HAVE_XWAYLAND
#if WLR_HAS_XWAYLAND
struct sway_xwayland xwayland;
struct wl_listener xwayland_surface;
struct wl_listener xwayland_ready;
@ -72,20 +74,52 @@ struct sway_server {
struct wl_listener xdg_decoration;
struct wl_list xdg_decorations; // sway_xdg_decoration::link
struct wlr_presentation *presentation;
struct wlr_drm_lease_v1_manager *drm_lease_manager;
struct wl_listener drm_lease_request;
struct wlr_pointer_constraints_v1 *pointer_constraints;
struct wl_listener pointer_constraint;
struct wlr_xdg_output_manager_v1 *xdg_output_manager_v1;
struct wlr_output_manager_v1 *output_manager_v1;
struct wl_listener output_manager_apply;
struct wl_listener output_manager_test;
struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1;
struct wl_listener gamma_control_set_gamma;
struct {
struct sway_session_lock *lock;
struct wlr_session_lock_manager_v1 *manager;
struct wl_listener new_lock;
struct wl_listener manager_destroy;
} session_lock;
struct wlr_output_power_manager_v1 *output_power_manager_v1;
struct wl_listener output_power_manager_set_mode;
struct wlr_input_method_manager_v2 *input_method;
struct wlr_text_input_manager_v3 *text_input;
struct wlr_ext_foreign_toplevel_list_v1 *foreign_toplevel_list;
struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager;
struct wlr_content_type_manager_v1 *content_type_manager_v1;
struct wlr_data_control_manager_v1 *data_control_manager_v1;
struct wlr_screencopy_manager_v1 *screencopy_manager_v1;
struct wlr_export_dmabuf_manager_v1 *export_dmabuf_manager_v1;
struct wlr_security_context_manager_v1 *security_context_manager_v1;
struct wlr_xdg_activation_v1 *xdg_activation_v1;
struct wl_listener xdg_activation_v1_request_activate;
struct wl_listener xdg_activation_v1_new_token;
struct wl_listener request_set_cursor_shape;
struct wlr_tearing_control_manager_v1 *tearing_control_v1;
struct wl_listener tearing_control_new_object;
struct wl_list tearing_controllers; // sway_tearing_controller::link
struct wl_list pending_launcher_ctxs; // launcher_ctx::link
// The timeout for transactions, after which a transaction is applied
// regardless of readiness.
@ -104,6 +138,8 @@ struct sway_server {
// Stores the nodes that have been marked as "dirty" and will be put into
// the pending transaction.
list_t *dirty_nodes;
struct wl_event_source *delayed_modeset;
};
extern struct sway_server server;
@ -112,34 +148,43 @@ struct sway_debug {
bool noatomic; // Ignore atomic layout updates
bool txn_timings; // Log verbose messages about transactions
bool txn_wait; // Always wait for the timeout before applying
enum {
DAMAGE_DEFAULT, // Default behaviour
DAMAGE_HIGHLIGHT, // Highlight regions of the screen being damaged
DAMAGE_RERENDER, // Render the full output when any damage occurs
} damage;
bool legacy_wl_drm; // Enable the legacy wl_drm interface
};
extern struct sway_debug debug;
/* Prepares an unprivileged server_init by performing all privileged operations in advance */
bool server_privileged_prepare(struct sway_server *server);
extern bool allow_unsupported_gpu;
bool server_init(struct sway_server *server);
void server_fini(struct sway_server *server);
bool server_start(struct sway_server *server);
void server_run(struct sway_server *server);
void handle_compositor_new_surface(struct wl_listener *listener, void *data);
void restore_nofile_limit(void);
void handle_new_output(struct wl_listener *listener, void *data);
void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data);
void handle_layer_shell_surface(struct wl_listener *listener, void *data);
void handle_xdg_shell_surface(struct wl_listener *listener, void *data);
#if HAVE_XWAYLAND
void sway_session_lock_init(void);
void sway_session_lock_add_output(struct sway_session_lock *lock,
struct sway_output *output);
bool sway_session_lock_has_surface(struct sway_session_lock *lock,
struct wlr_surface *surface);
void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data);
#if WLR_HAS_XWAYLAND
void handle_xwayland_surface(struct wl_listener *listener, void *data);
#endif
void handle_server_decoration(struct wl_listener *listener, void *data);
void handle_xdg_decoration(struct wl_listener *listener, void *data);
void handle_pointer_constraint(struct wl_listener *listener, void *data);
void xdg_activation_v1_handle_request_activate(struct wl_listener *listener,
void *data);
void xdg_activation_v1_handle_new_token(struct wl_listener *listener,
void *data);
void set_rr_scheduling(void);
void handle_new_tearing_hint(struct wl_listener *listener, void *data);
#endif

View file

@ -1,18 +0,0 @@
#ifndef _SWAY_SURFACE_H
#define _SWAY_SURFACE_H
#include <wlr/types/wlr_surface.h>
struct sway_surface {
struct wlr_surface *wlr_surface;
struct wl_listener destroy;
/**
* This timer can be used for issuing delayed frame done callbacks (for
* example, to improve presentation latency). Its handler is set to a
* function that issues a frame done callback to this surface.
*/
struct wl_event_source *frame_done_timer;
};
#endif

View file

@ -0,0 +1,28 @@
#ifndef _SWAY_BUFFER_H
#define _SWAY_BUFFER_H
#include <wlr/types/wlr_scene.h>
struct sway_text_node {
int width;
int max_width;
int height;
int baseline;
bool pango_markup;
float color[4];
float background[4];
struct wlr_scene_node *node;
};
struct sway_text_node *sway_text_node_create(struct wlr_scene_tree *parent,
char *text, float color[4], bool pango_markup);
void sway_text_node_set_color(struct sway_text_node *node, float color[4]);
void sway_text_node_set_text(struct sway_text_node *node, char *text);
void sway_text_node_set_max_width(struct sway_text_node *node, int max_width);
void sway_text_node_set_background(struct sway_text_node *node, float background[4]);
#endif

View file

@ -1,6 +1,7 @@
#ifndef _SWAY_SWAYNAG_H
#define _SWAY_SWAYNAG_H
#include <wayland-server-core.h>
#include "stringop.h"
struct swaynag_instance {
struct wl_client *client;
@ -21,7 +22,7 @@ bool swaynag_spawn(const char *swaynag_command,
// Write a log message to swaynag->fd[1]. This will fail when swaynag->detailed
// is false.
void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag,
const char *fmt, ...);
const char *fmt, ...) _SWAY_ATTRIB_PRINTF(3, 4);
// If swaynag->detailed, close swaynag->fd[1] so swaynag displays
void swaynag_show(struct swaynag_instance *swaynag);

View file

@ -2,8 +2,8 @@
#define _SWAY_CONTAINER_H
#include <stdint.h>
#include <sys/types.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_scene.h>
#include "list.h"
#include "sway/tree/node.h"
@ -69,11 +69,41 @@ struct sway_container {
struct sway_node node;
struct sway_view *view;
struct wlr_scene_tree *scene_tree;
struct {
struct wlr_scene_tree *tree;
struct wlr_scene_tree *border;
struct wlr_scene_tree *background;
struct sway_text_node *title_text;
struct sway_text_node *marks_text;
} title_bar;
struct {
struct wlr_scene_tree *tree;
struct wlr_scene_rect *top;
struct wlr_scene_rect *bottom;
struct wlr_scene_rect *left;
struct wlr_scene_rect *right;
} border;
struct wlr_scene_tree *content_tree;
struct wlr_scene_buffer *output_handler;
struct wl_listener output_enter;
struct wl_listener output_leave;
struct sway_container_state current;
struct sway_container_state pending;
char *title; // The view's title (unformatted)
char *formatted_title; // The title displayed in the title bar
int title_width;
char *title_format;
enum sway_container_layout prev_split_layout;
@ -101,33 +131,19 @@ struct sway_container {
double child_total_width;
double child_total_height;
// In most cases this is the same as the content x and y, but if the view
// refuses to resize to the content dimensions then it can be smaller.
// These are in layout coordinates.
double surface_x, surface_y;
// Outputs currently being intersected
list_t *outputs; // struct sway_output
// Indicates that the container is a scratchpad container.
// Both hidden and visible scratchpad containers have scratchpad=true.
// Hidden scratchpad containers have a NULL parent.
bool scratchpad;
// Stores last output size and position for adjusting coordinates of
// scratchpad windows.
// Unused for non-scratchpad windows.
struct wlr_box transform;
float alpha;
struct wlr_texture *title_focused;
struct wlr_texture *title_focused_inactive;
struct wlr_texture *title_unfocused;
struct wlr_texture *title_urgent;
size_t title_height;
size_t title_baseline;
list_t *marks; // char *
struct wlr_texture *marks_focused;
struct wlr_texture *marks_focused_inactive;
struct wlr_texture *marks_unfocused;
struct wlr_texture *marks_urgent;
struct {
struct wl_signal destroy;
@ -147,19 +163,6 @@ void container_begin_destroy(struct sway_container *con);
struct sway_container *container_find_child(struct sway_container *container,
bool (*test)(struct sway_container *view, void *data), void *data);
/**
* Find a container at the given coordinates. Returns the surface and
* surface-local coordinates of the given layout coordinates if the container
* is a view and the view contains a surface at those coordinates.
*/
struct sway_container *container_at(struct sway_workspace *workspace,
double lx, double ly, struct wlr_surface **surface,
double *sx, double *sy);
struct sway_container *tiling_container_at(
struct sway_node *parent, double lx, double ly,
struct wlr_surface **surface, double *sx, double *sy);
void container_for_each_child(struct sway_container *container,
void (*f)(struct sway_container *container, void *data), void *data);
@ -174,20 +177,15 @@ struct sway_container *container_obstructing_fullscreen_container(struct sway_co
bool container_has_ancestor(struct sway_container *container,
struct sway_container *ancestor);
void container_update_textures_recursive(struct sway_container *con);
void container_damage_whole(struct sway_container *container);
void container_reap_empty(struct sway_container *con);
struct sway_container *container_flatten(struct sway_container *container);
void container_update_title_textures(struct sway_container *container);
void container_update_title_bar(struct sway_container *container);
/**
* Calculate the container's title_height property.
*/
void container_calculate_title_height(struct sway_container *container);
void container_update_marks(struct sway_container *container);
size_t parse_title_format(struct sway_container *container, char *buffer);
size_t container_build_representation(enum sway_container_layout layout,
list_t *children, char *buffer);
@ -202,6 +200,9 @@ size_t container_titlebar_height(void);
void floating_calculate_constraints(int *min_width, int *max_width,
int *min_height, int *max_height);
void floating_fix_coordinates(struct sway_container *con,
struct wlr_box *old, struct wlr_box *new);
void container_floating_resize_and_center(struct sway_container *con);
void container_floating_set_default_size(struct sway_container *con);
@ -220,11 +221,6 @@ void container_set_geometry_from_content(struct sway_container *con);
*/
bool container_is_floating(struct sway_container *container);
/**
* Same as above, but for current container state.
*/
bool container_is_current_floating(struct sway_container *container);
/**
* Get a container's box in layout coordinates.
*/
@ -287,26 +283,12 @@ bool container_is_floating_or_child(struct sway_container *container);
*/
bool container_is_fullscreen_or_child(struct sway_container *container);
/**
* Return the output which will be used for scale purposes.
* This is the most recently entered output.
* If the container is not on any output, return NULL.
*/
struct sway_output *container_get_effective_output(struct sway_container *con);
void container_discover_outputs(struct sway_container *con);
enum sway_container_layout container_parent_layout(struct sway_container *con);
enum sway_container_layout container_current_parent_layout(
struct sway_container *con);
list_t *container_get_siblings(struct sway_container *container);
int container_sibling_index(struct sway_container *child);
list_t *container_get_current_siblings(struct sway_container *container);
void container_handle_fullscreen_reparent(struct sway_container *con);
void container_add_child(struct sway_container *parent,
@ -354,8 +336,6 @@ bool container_has_mark(struct sway_container *container, char *mark);
void container_add_mark(struct sway_container *container, char *mark);
void container_update_marks_textures(struct sway_container *container);
void container_raise_floating(struct sway_container *con);
bool container_is_scratchpad_hidden(struct sway_container *con);
@ -370,7 +350,7 @@ bool container_is_sticky_or_child(struct sway_container *con);
* This will destroy pairs of redundant H/V splits
* e.g. H[V[H[app app]] app] -> H[app app app]
* The middle "V[H[" are eliminated by a call to container_squash
* on the V[ con. It's grandchildren are added to it's parent.
* on the V[ con. It's grandchildren are added to its parent.
*
* This function is roughly equivalent to i3's tree_flatten here:
* https://github.com/i3/i3/blob/1f0c628cde40cf87371481041b7197344e0417c6/src/tree.c#L651
@ -379,4 +359,10 @@ bool container_is_sticky_or_child(struct sway_container *con);
*/
int container_squash(struct sway_container *con);
void container_arrange_title_bar(struct sway_container *con);
void container_update(struct sway_container *con);
void container_update_itself_and_parents(struct sway_container *con);
#endif

View file

@ -1,6 +1,8 @@
#ifndef _SWAY_NODE_H
#define _SWAY_NODE_H
#include <wayland-server-core.h>
#include <stdbool.h>
#include <wlr/types/wlr_scene.h>
#include "list.h"
#define MIN_SANE_W 100
@ -74,4 +76,15 @@ list_t *node_get_children(struct sway_node *node);
bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor);
// when destroying a sway tree, it's not known which order the tree will be
// destroyed. To prevent freeing of scene_nodes recursing up the tree,
// let's use this helper function to disown them to the staging node.
void scene_node_disown_children(struct wlr_scene_tree *tree);
// a helper function used to allocate tree nodes. If an allocation failure
// occurs a flag is flipped that can be checked later to destroy a parent
// of this scene node preventing memory leaks.
struct wlr_scene_tree *alloc_scene_tree(struct wlr_scene_tree *parent,
bool *failed);
#endif

View file

@ -2,11 +2,12 @@
#define _SWAY_ROOT_H
#include <wayland-server-core.h>
#include <wayland-util.h>
#include <wlr/config.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/render/wlr_texture.h>
#include "sway/tree/container.h"
#include "sway/tree/node.h"
#include "config.h"
#include "list.h"
extern struct sway_root *root;
@ -15,11 +16,43 @@ struct sway_root {
struct sway_node node;
struct wlr_output_layout *output_layout;
struct wl_listener output_layout_change;
#if HAVE_XWAYLAND
struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
// scene node layout:
// - root
// - staging
// - layer shell stuff
// - tiling
// - floating
// - fullscreen stuff
// - seat stuff
// - ext_session_lock
struct wlr_scene *root_scene;
// since wlr_scene nodes can't be orphaned and must always
// have a parent, use this staging scene_tree so that a
// node always have a valid parent. Nothing in this
// staging node will be visible.
struct wlr_scene_tree *staging;
// tree containing all layers the compositor will render. Cursor handling
// will end up iterating this tree.
struct wlr_scene_tree *layer_tree;
struct {
struct wlr_scene_tree *shell_background;
struct wlr_scene_tree *shell_bottom;
struct wlr_scene_tree *tiling;
struct wlr_scene_tree *floating;
struct wlr_scene_tree *shell_top;
struct wlr_scene_tree *fullscreen;
struct wlr_scene_tree *fullscreen_global;
#if WLR_HAS_XWAYLAND
struct wlr_scene_tree *unmanaged;
#endif
struct wl_list drag_icons; // sway_drag_icon::link
struct wlr_scene_tree *shell_overlay;
struct wlr_scene_tree *popup;
struct wlr_scene_tree *seat;
struct wlr_scene_tree *session_lock;
} layers;
// Includes disabled outputs
struct wl_list all_outputs; // sway_output::link
@ -28,10 +61,11 @@ struct sway_root {
double width, height;
list_t *outputs; // struct sway_output
list_t *non_desktop_outputs; // struct sway_output_non_desktop
list_t *scratchpad; // struct sway_container
// For when there's no connected outputs
struct sway_output *noop_output;
struct sway_output *fallback_output;
struct sway_container *fullscreen_global;
@ -40,7 +74,7 @@ struct sway_root {
} events;
};
struct sway_root *root_create(void);
struct sway_root *root_create(struct wl_display *display);
void root_destroy(struct sway_root *root);
@ -68,12 +102,6 @@ void root_scratchpad_show(struct sway_container *con);
*/
void root_scratchpad_hide(struct sway_container *con);
struct sway_workspace *root_workspace_for_pid(pid_t pid);
void root_record_workspace_pid(pid_t pid);
void root_remove_workspace_pid(pid_t pid);
void root_for_each_workspace(void (*f)(struct sway_workspace *ws, void *data),
void *data);
@ -91,6 +119,4 @@ struct sway_container *root_find_container(
void root_get_box(struct sway_root *root, struct wlr_box *box);
void root_rename_pid_workspaces(const char *old_name, const char *new_name);
#endif

View file

@ -1,9 +1,12 @@
#ifndef _SWAY_VIEW_H
#define _SWAY_VIEW_H
#include <wayland-server-core.h>
#include <wlr/types/wlr_surface.h>
#include "config.h"
#if HAVE_XWAYLAND
#include <wlr/config.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_tearing_control_v1.h>
#include "sway/config.h"
#if WLR_HAS_XWAYLAND
#include <wlr/xwayland.h>
#endif
#include "sway/input/input-manager.h"
@ -14,7 +17,7 @@ struct sway_xdg_decoration;
enum sway_view_type {
SWAY_VIEW_XDG_SHELL,
#if HAVE_XWAYLAND
#if WLR_HAS_XWAYLAND
SWAY_VIEW_XWAYLAND,
#endif
};
@ -26,12 +29,18 @@ enum sway_view_prop {
VIEW_PROP_INSTANCE,
VIEW_PROP_WINDOW_TYPE,
VIEW_PROP_WINDOW_ROLE,
#if HAVE_XWAYLAND
#if WLR_HAS_XWAYLAND
VIEW_PROP_X11_WINDOW_ID,
VIEW_PROP_X11_PARENT_ID,
#endif
};
enum sway_view_tearing_mode {
TEARING_OVERRIDE_FALSE,
TEARING_OVERRIDE_TRUE,
TEARING_WINDOW_HINT,
};
struct sway_view_impl {
void (*get_constraints)(struct sway_view *view, double *min_width,
double *max_width, double *min_height, double *max_height);
@ -45,10 +54,6 @@ struct sway_view_impl {
void (*set_fullscreen)(struct sway_view *view, bool fullscreen);
void (*set_resizing)(struct sway_view *view, bool resizing);
bool (*wants_floating)(struct sway_view *view);
void (*for_each_surface)(struct sway_view *view,
wlr_surface_iterator_func_t iterator, void *user_data);
void (*for_each_popup_surface)(struct sway_view *view,
wlr_surface_iterator_func_t iterator, void *user_data);
bool (*is_transient_for)(struct sway_view *child,
struct sway_view *ancestor);
void (*close)(struct sway_view *view);
@ -56,46 +61,36 @@ struct sway_view_impl {
void (*destroy)(struct sway_view *view);
};
struct sway_saved_buffer {
struct wlr_client_buffer *buffer;
int x, y;
int width, height;
enum wl_output_transform transform;
struct wlr_fbox source_box;
struct wl_list link; // sway_view::saved_buffers
};
struct sway_view {
enum sway_view_type type;
const struct sway_view_impl *impl;
struct wlr_scene_tree *scene_tree;
struct wlr_scene_tree *content_tree;
struct wlr_scene_tree *saved_surface_tree;
struct sway_container *container; // NULL if unmapped and transactions finished
struct wlr_surface *surface; // NULL for unmapped views
struct sway_xdg_decoration *xdg_decoration;
pid_t pid;
struct launcher_ctx *ctx;
// The size the view would want to be if it weren't tiled.
// Used when changing a view from tiled to floating.
int natural_width, natural_height;
char *title_format;
bool using_csd;
struct timespec urgent;
bool allow_request_urgent;
struct wl_event_source *urgent_timer;
struct wl_list saved_buffers; // sway_saved_buffer::link
// The geometry for whatever the client is committing, regardless of
// transaction state. Updated on every commit.
struct wlr_box geometry;
// The "old" geometry during a transaction. Used to damage the old location
// when a transaction is applied.
struct wlr_box saved_geometry;
struct wlr_ext_foreign_toplevel_handle_v1 *ext_foreign_toplevel;
struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel;
struct wl_listener foreign_activate_request;
@ -108,22 +103,22 @@ struct sway_view {
list_t *executed_criteria; // struct criteria *
union {
struct wlr_xdg_surface *wlr_xdg_surface;
#if HAVE_XWAYLAND
struct wlr_xdg_toplevel *wlr_xdg_toplevel;
#if WLR_HAS_XWAYLAND
struct wlr_xwayland_surface *wlr_xwayland_surface;
#endif
struct wlr_wl_shell_surface *wlr_wl_shell_surface;
};
struct {
struct wl_signal unmap;
} events;
struct wl_listener surface_new_subsurface;
int max_render_time; // In milliseconds
enum seat_config_shortcuts_inhibit shortcuts_inhibit;
enum sway_view_tearing_mode tearing_mode;
enum wp_tearing_control_v1_presentation_hint tearing_hint;
};
struct sway_xdg_shell_view {
@ -141,10 +136,12 @@ struct sway_xdg_shell_view {
struct wl_listener unmap;
struct wl_listener destroy;
};
#if HAVE_XWAYLAND
#if WLR_HAS_XWAYLAND
struct sway_xwayland_view {
struct sway_view view;
struct wlr_scene_tree *surface_tree;
struct wl_listener commit;
struct wl_listener request_move;
struct wl_listener request_resize;
@ -156,71 +153,55 @@ struct sway_xwayland_view {
struct wl_listener set_title;
struct wl_listener set_class;
struct wl_listener set_role;
struct wl_listener set_startup_id;
struct wl_listener set_window_type;
struct wl_listener set_hints;
struct wl_listener set_decorations;
struct wl_listener associate;
struct wl_listener dissociate;
struct wl_listener map;
struct wl_listener unmap;
struct wl_listener destroy;
struct wl_listener override_redirect;
struct wl_listener surface_tree_destroy;
};
struct sway_xwayland_unmanaged {
struct wlr_xwayland_surface *wlr_xwayland_surface;
struct wl_list link;
int lx, ly;
struct wlr_scene_surface *surface_scene;
struct wl_listener request_activate;
struct wl_listener request_configure;
struct wl_listener request_fullscreen;
struct wl_listener commit;
struct wl_listener set_geometry;
struct wl_listener associate;
struct wl_listener dissociate;
struct wl_listener map;
struct wl_listener unmap;
struct wl_listener destroy;
struct wl_listener override_redirect;
};
#endif
struct sway_view_child;
struct sway_view_child_impl {
void (*get_root_coords)(struct sway_view_child *child, int *sx, int *sy);
void (*destroy)(struct sway_view_child *child);
};
/**
* A view child is a surface in the view tree, such as a subsurface or a popup.
*/
struct sway_view_child {
const struct sway_view_child_impl *impl;
struct wl_list link;
struct sway_popup_desc {
struct wlr_scene_node *relative;
struct sway_view *view;
struct sway_view_child *parent;
struct wl_list children; // sway_view_child::link
struct wlr_surface *surface;
bool mapped;
struct wl_listener surface_commit;
struct wl_listener surface_new_subsurface;
struct wl_listener surface_map;
struct wl_listener surface_unmap;
struct wl_listener surface_destroy;
struct wl_listener view_unmap;
};
struct sway_subsurface {
struct sway_view_child child;
struct wl_listener destroy;
};
struct sway_xdg_popup {
struct sway_view_child child;
struct sway_view *view;
struct wlr_xdg_surface *wlr_xdg_surface;
struct wlr_scene_tree *scene_tree;
struct wlr_scene_tree *xdg_surface_tree;
struct wlr_xdg_popup *wlr_xdg_popup;
struct sway_popup_desc desc;
struct wl_listener surface_commit;
struct wl_listener new_popup;
struct wl_listener reposition;
struct wl_listener destroy;
};
@ -269,7 +250,12 @@ void view_set_activated(struct sway_view *view, bool activated);
/**
* Called when the view requests to be focused.
*/
void view_request_activate(struct sway_view *view);
void view_request_activate(struct sway_view *view, struct sway_seat *seat);
/*
* Called when the view requests urgent state
*/
void view_request_urgent(struct sway_view *view);
/**
* If possible, instructs the client to change their decoration mode.
@ -288,52 +274,42 @@ void view_close(struct sway_view *view);
void view_close_popups(struct sway_view *view);
void view_damage_from(struct sway_view *view);
/**
* Iterate all surfaces of a view (toplevels + popups).
*/
void view_for_each_surface(struct sway_view *view,
wlr_surface_iterator_func_t iterator, void *user_data);
/**
* Iterate all popup surfaces of a view.
*/
void view_for_each_popup_surface(struct sway_view *view,
wlr_surface_iterator_func_t iterator, void *user_data);
// view implementation
void view_init(struct sway_view *view, enum sway_view_type type,
bool view_init(struct sway_view *view, enum sway_view_type type,
const struct sway_view_impl *impl);
void view_destroy(struct sway_view *view);
void view_begin_destroy(struct sway_view *view);
/**
* Map a view, ie. make it visible in the tree.
*
* `fullscreen` should be set to true (and optionally `fullscreen_output`
* should be populated) if the view should be made fullscreen immediately.
*
* `decoration` should be set to true if the client prefers CSD. The client's
* preference may be ignored.
*/
void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
bool fullscreen, struct wlr_output *fullscreen_output, bool decoration);
void view_unmap(struct sway_view *view);
void view_update_size(struct sway_view *view);
void view_center_surface(struct sway_view *view);
void view_child_init(struct sway_view_child *child,
const struct sway_view_child_impl *impl, struct sway_view *view,
struct wlr_surface *surface);
void view_child_destroy(struct sway_view_child *child);
void view_center_and_clip_surface(struct sway_view *view);
struct sway_view *view_from_wlr_xdg_surface(
struct wlr_xdg_surface *xdg_surface);
#if HAVE_XWAYLAND
#if WLR_HAS_XWAYLAND
struct sway_view *view_from_wlr_xwayland_surface(
struct wlr_xwayland_surface *xsurface);
#endif
struct sway_view *view_from_wlr_surface(struct wlr_surface *surface);
void view_update_app_id(struct sway_view *view);
/**
* Re-read the view's title property and update any relevant title bars.
* The force argument makes it recreate the title bars even if the title hasn't
@ -363,4 +339,10 @@ void view_save_buffer(struct sway_view *view);
bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor);
void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx);
void view_send_frame_done(struct sway_view *view);
bool view_can_tear(struct sway_view *view);
#endif

View file

@ -2,6 +2,8 @@
#define _SWAY_WORKSPACE_H
#include <stdbool.h>
#include <wlr/types/wlr_scene.h>
#include "sway/config.h"
#include "sway/tree/container.h"
#include "sway/tree/node.h"
@ -22,6 +24,12 @@ struct sway_workspace_state {
struct sway_workspace {
struct sway_node node;
struct {
struct wlr_scene_tree *tiling;
struct wlr_scene_tree *fullscreen;
} layers;
struct sway_container *fullscreen;
char *name;
@ -60,20 +68,20 @@ void workspace_consider_destroy(struct sway_workspace *ws);
char *workspace_next_name(const char *output_name);
bool workspace_switch(struct sway_workspace *workspace,
bool no_auto_back_and_forth);
struct sway_workspace *workspace_auto_back_and_forth(
struct sway_workspace *workspace);
bool workspace_switch(struct sway_workspace *workspace);
struct sway_workspace *workspace_by_number(const char* name);
struct sway_workspace *workspace_by_name(const char*);
struct sway_workspace *workspace_output_next(
struct sway_workspace *current, bool create);
struct sway_workspace *workspace_output_next(struct sway_workspace *current);
struct sway_workspace *workspace_next(struct sway_workspace *current);
struct sway_workspace *workspace_output_prev(
struct sway_workspace *current, bool create);
struct sway_workspace *workspace_output_prev(struct sway_workspace *current);
struct sway_workspace *workspace_prev(struct sway_workspace *current);

View file

@ -16,4 +16,6 @@ struct sway_xdg_decoration {
struct sway_xdg_decoration *xdg_decoration_from_surface(
struct wlr_surface *surface);
void set_xdg_decoration_mode(struct sway_xdg_decoration *deco);
#endif

View file

@ -4,6 +4,7 @@
#include "config.h"
#include "input.h"
#include "pool-buffer.h"
#include "cursor-shape-v1-client-protocol.h"
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
#include "xdg-output-unstable-v1-client-protocol.h"
@ -30,6 +31,7 @@ struct swaybar {
struct wl_compositor *compositor;
struct zwlr_layer_shell_v1 *layer_shell;
struct zxdg_output_manager_v1 *xdg_output_manager;
struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
struct wl_shm *shm;
struct swaybar_config *config;
@ -58,7 +60,6 @@ struct swaybar_output {
struct zxdg_output_v1 *xdg_output;
struct wl_surface *surface;
struct zwlr_layer_surface_v1 *layer_surface;
struct wl_region *input_region;
uint32_t wl_name;
struct wl_list workspaces; // swaybar_workspace::link

View file

@ -6,6 +6,7 @@
#include "../include/config.h"
#include "list.h"
#include "util.h"
#include <pango/pangocairo.h>
struct box_colors {
uint32_t border;
@ -28,7 +29,7 @@ struct swaybar_config {
char *status_command;
bool pango_markup;
uint32_t position; // zwlr_layer_surface_v1_anchor
char *font;
PangoFontDescription *font_description;
char *sep_symbol;
char *mode;
char *hidden_state;

View file

@ -19,6 +19,7 @@ struct i3bar_block {
// Airblader features
uint32_t background;
uint32_t border;
bool border_set;
int border_top;
int border_bottom;
int border_left;
@ -29,6 +30,6 @@ void i3bar_block_unref(struct i3bar_block *block);
bool i3bar_handle_readable(struct status_line *status);
enum hotspot_event_handling i3bar_block_send_click(struct status_line *status,
struct i3bar_block *block, double x, double y, double rx, double ry,
double w, double h, int scale, uint32_t button);
double w, double h, int scale, uint32_t button, bool released);
#endif

7
include/swaybar/image.h Normal file
View file

@ -0,0 +1,7 @@
#ifndef _SWAYBAR_IMAGE_H
#define _SWAYBAR_IMAGE_H
#include <cairo.h>
cairo_surface_t *load_image(const char *path);
#endif

View file

@ -49,7 +49,7 @@ struct swaybar_hotspot {
int x, y, width, height;
enum hotspot_event_handling (*callback)(struct swaybar_output *output,
struct swaybar_hotspot *hotspot, double x, double y, uint32_t button,
void *data);
bool released, void *data);
void (*destroy)(void *data);
void *data;
};

Some files were not shown because too many files have changed in this diff Show more