Commit graph

6743 commits

Author SHA1 Message Date
Michael Weiser
d4482400f1 swaybar: Implement pointer gesture swipe support
After previous commits, swaybar bindsym statements would already accept
the new pseudo button names for swipe gestures. Also, sway itself would
not handle swipes when executed while the pointer was above a bar.

Add the necessary handling for three- and four-finger swipe pointer
gestures in swaybar. Cancel ongoing swipes when the pointer leaves the
bar as to not confuse successive swipes with focus changes inbetween
them.  Add the pointer gestures protocol in client and server variants
to the meson build file to make the necessary definitions available.
Bind to the global interface on startup, instantiate a swipe gesture and
add a listener on seat setup as well as destroy it on seat shutdown.

Extend the sway-bar manual page as necessary.

Test-plan:
- add workspace switching to config like so:

bar bar-0 {
        swaybar_command swaybar

        bindsym release SWIPE_3_LEFT workspace prev_on_output
        bindsym release SWIPE_4_RIGHT workspace next_on_output
        bindsym --release SWIPE_3_LEFT exec yad --text foo
        bindsym --release SWIPE_4_UP exec yad --text bar
}

- start sway and open two workspaces
- position pointer above a bar surface
- switch back and forth using horizontal three- and four-finger swipes,
  observing that different finger counts are necessary per direction
- observe that the --release binding for left swipes is ignored because
  there is an on-press binding already
- observe that the --release binding for upward swipes is honoured
  because there is no on-press binding
- move pointer away from bar surface
- observe that switching by swipe no longer works

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2021-08-05 20:10:07 +02:00
Michael Weiser
41488b0fdb sway: Update manpage for pointer gestures
Add description of pointer gesture binding configuration and behaviour
to the sway(5) manual page.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2021-08-05 20:10:07 +02:00
Michael Weiser
abb82c153e input: Extend swipe gesture support to finger count
Swipe pointer gesture bindings added in an earlier commit would catch
swipes indiscriminately, ignoring the number of fingers used.

Add the necessary logic to distinguish three- from four-finger swipes.
Other finger counts cannot be bound to and are passed through to clients.
Continue to trivially map each dimension of a gesture to discrete pseudo
button codes considering that we're unlikely to take this much further
and would otherwise need to extend struct sway_binding to carry some
kind of button-specific internal data.

Test plan:
- add workspace switching to config like so:

bindsym --whole-window SWIPE_3_LEFT workspace prev_on_output
bindsym --whole-window SWIPE_4_RIGHT workspace next_on_output

- start sway and open two workspaces
- switch back and forth using horizontal three- and four-finger swipes,
  observing that different finger counts are necessary per direction

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2021-08-05 20:07:45 +02:00
Michael Weiser
44a2a60dcd input: Add basic pointer gesture support
Passing of gesture events added in #4794 allows to use them in clients
but not in sway itself, for example to switch workspaces using
three-finger swipes.

Add support for binding four basic directional swipes to arbitrary sway
commands. Add the necessary handling to default seatops to execute them
at the beginning or end of a swipe gesture. This for now responds to all
swipes, ignoring the number of fingers used.

The former throws up the intrinsic conundrum that we can not know the
kind of swipe that's going to happen because it can change all through
its lifecylce. Therefore we can only execute bindings on release.

Test plan:
- add workspace switching to config like so:

bindsym --whole-window SWIPE_LEFT workspace prev_on_output
bindsym --whole-window SWIPE_RIGHT workspace next_on_output

- start sway and open two workspaces
- switch back and forth using horizontal three-finger swipes, observing
  that vertical swipes won't

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2021-08-05 20:07:45 +02:00
Michael Weiser
b518870bc1 input: Percolate swipe gestures through seat handlers
Let swipe pointer gestures percolate through seat and default seatop
handlers so sway-internal handling can be added if desired. As a
side-effect this makes swipes count as user activity. There should be no
other functional changes.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2021-08-05 20:07:44 +02:00
Michael Weiser
4e302fb402 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>
2021-08-05 20:07:44 +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