Commit Graph

174 Commits

Author SHA1 Message Date
Brian Ashworth a223030b70 Change mouse buttons to x11 map and libevdev names
This modifies the way mouse bindings are parsed. Instead of adding to
BTN_LEFT, which results in button numbers that may not be expected,
buttons will be parsed in one of the following ways:

1. `button[1-9]` will now map to their x11 equivalents. This is already
the case for bar bindings. This adds support for binding to axis events,
which was not possible in the previous approach.

2. Anything that starts with `BTN_` will be parsed as an event code name
using `libevdev_event_code_from_name`. This allows for any button to be
mapped to instead of limiting usage to the ones near BTN_LEFT. This also
adds a dependency on libevdev, but since libevdev is already a dependency
of libinput, this should be fine. If needed, this option can have dependency
guards added.

Binding changes:
- button1: BTN_LEFT -> BTN_LEFT
- button2: BTN_RIGHT -> BTN_MIDDLE
- button3: BTN_MIDDLE -> BTN_RIGHT
- button4: BTN_SIDE -> SWAY_SCROLL_UP
- button5: BTN_EXTRA -> SWAY_SCROLL_DOWN
- button6: BTN_FORWARD -> SWAY_SCROLL_LEFT
- button7: BTN_BACK -> SWAY_SCROLL_RIGHT
- button8: BTN_TASK -> BTN_SIDE
- button9: BTN_JOYSTICK -> BTN_EXTRA

Since the axis events need to be mapped to an event code, this uses the
following mappings to avoid any conflicts:
- SWAY_SCROLL_UP: KEY_MAX + 1
- SWAY_SCROLL_DOWN: KEY_MAX + 2
- SWAY_SCROLL_LEFT: KEY_MAX + 3
- SWAY_SCROLL_RIGHT: KEY_MAX + 4
2018-12-25 13:27:08 +01:00
Brian Ashworth 1bd8463481 Implement bar gaps
Adds the bar subcommand `gaps <amount>|<horizontal> <vertical>|<top>
<right> <bottom> <left>` to set gaps for swaybar. Due to restrictions on
margins for a layer_surface, only the sides that are anchored to an edge
of the screen can have gaps. Since there is support for per-side outer
gaps for workspaces, those should be able to be used instead for the
last side.
2018-11-28 11:24:14 -05:00
Brian Ashworth e6562c8cd2 Implement title alignment
This adds support for `i3 4.16`'s ability to set the title alignment.
The command is `title_align left|center|right`.

When the title is on the right, marks are moved to the left. Otherwise,
they are on the right.
2018-11-25 22:08:58 -05:00
Florent de Lamotte 7555c7efdc Adding commands for configuring titlebar borders and padding 2018-11-22 10:30:04 +01:00
emersion bf7af9c690
Merge pull request #3083 from c-edw/feature/StripWorkspaceName
Implement strip_workspace_name.
2018-11-19 17:56:18 +01:00
emersion 311c7db7e3
Add xwayland command 2018-11-19 17:38:37 +01:00
Spencer Michaels 70bc4c3ab6 Add scroll factor config option. 2018-11-18 13:49:30 -05:00
Connor E 4bd46fb079 Implement strip_workspace_name. 2018-11-17 16:11:28 +00:00
Ryan Dwyer b9b1b0e566 Remove raise_floating directive
The directive controlled whether floating views should raise to the top
when the cursor is moved over it while using focus_follows_mouse. The
default was enabled, which is undesirable. For example, if you have two
floating views where one completely covers the other, the smaller one
would be inaccessible because moving the mouse over the bigger one would
raise it above the smaller one.

There is no known use case for having raise_floating enabled, so this
patch removes the directive and implements the raise_floating disabled
behaviour instead.
2018-10-20 17:51:32 +10:00
Ryan Dwyer 832ebc8966 Implement popup_during_fullscreen
This introduces a new view_impl function: is_transient_for. Similar to
container_has_ancestor but works using the surface parents rather than
the tree.

This patch modifies view_is_visible, container_at and so on to allow
transient views to function normally when they're in front of a
fullscreen view.
2018-10-08 22:49:59 +10:00
Jonathan Buch 298ccb539c
Add configuration for raising containers on focus
* New configuration option: raise_floating
  (From the discussion on https://github.com/i3/i3/issues/2990)
* By default, it still raises the window on focus, otherwise it
  will raise the window on click.
2018-10-03 16:23:12 +02:00
Drew DeVault 06c214a800
Merge pull request #2703 from RyanDwyer/csd-border
Add CSD to border modes
2018-10-03 13:03:06 +02:00
Brian Ashworth bb25194844 Handle border options for gaps
Fixes `hide_edge_borders smart` when gaps are in use.
Implements `hide_edge_borders smart_no_gaps` and `smart_borders
on|no_gaps|off`.

Since `smart_borders on` is equivalent to `hide_edge_borders smart`
and `smart_borders no_gaps` is equivalent to `hide_edge_borders
smart_no_gaps`, I opted to just save the last value set for
`hide_edge_borders` and restore that on `smart_borders off`. This
simplifies the conditions for setting the border.
2018-10-01 21:19:06 -04:00
Arkadiusz Hiler eed0bc3ebd Add support for installing binaries with DT_RPATH
It's better to use DT_RPATH dynamic section of the elf binary to store
the paths of libraries to load instead of overwriting LD_LIBRARY_PATH
for the whole environment, causing surprises. This solution is much more
transparent and perfectly suitable for running contained installations
of wayland/wlroots/sway.

The code unsetting the LD_LIBRARY_PATH/LD_PRELOAD was also deleted as
it's a placebo security at best - we should trust the execution path
that leads us to running sway, and it's way too late to care about those
variables since we already started executing our compositor, thus we
would be compromised anyway.
2018-09-30 15:37:01 +03:00
Drew DeVault 8f6aca2166
Merge pull request #2725 from PumbaPe/add-tap-and-drag
Add tap and drag to sway-input
2018-09-30 13:44:11 +02:00
Arkadiusz Hiler 00dfb76832 Remove libcap/prctl artifacts
They seem like relics of the pasts, from when we were retaining the
ptrace cap.

Some translations still may need updates.
2018-09-30 13:39:26 +03:00
PP ae2b70f59e add tap-and-drag setting to sway-input 2018-09-29 11:49:41 +02:00
Ryan Dwyer 7b138e5ef0 Add CSD to border modes
This replaces view.using_csd with a new border mode: B_CSD. This also
removes sway_xdg_shell{_v6}_view.deco_mode and
view->has_client_side_decorations as we can now get these from the
border.

You can use `border toggle` to cycle through the modes including CSD, or
use `border csd` to set it directly. The client must support the
xdg-decoration protocol, and the only client I know of that does is the
example in wlroots.

If the client switches from SSD to CSD without us expecting it (via the
server-decoration protocol), we stash the previous border type into
view.saved_border so we can restore it if the client returns to SSD. I
haven't found a way to test this though.
2018-09-27 22:51:37 +10:00
Ryan Dwyer db28459634 Introduce create_output command (for developer use)
Should help with testing hotplugging.
2018-09-19 21:54:27 +10:00
Ryan Dwyer ec9c4de564 Introduce tiling_drag directive 2018-09-11 17:17:19 +10:00
Ryan Dwyer 7586f150c0 Implement type safe arguments and demote sway_container
This commit changes the meaning of sway_container so that it only refers
to layout containers and view containers. Workspaces, outputs and the
root are no longer known as containers. Instead, root, outputs,
workspaces and containers are all a type of node, and containers come in
two types: layout containers and view containers.

In addition to the above, this implements type safe variables. This
means we use specific types such as sway_output and sway_workspace
instead of generic containers or nodes. However, it's worth noting that
in a few places places (eg. seat focus and transactions) referring to
them in a generic way is unavoidable which is why we still use nodes in
some places.

If you want a TL;DR, look at node.h, as well as the struct definitions
for root, output, workspace and container. Note that sway_output now
contains a workspaces list, and workspaces now contain a tiling and
floating list, and containers now contain a pointer back to the
workspace.

There are now functions for seat_get_focused_workspace and
seat_get_focused_container. The latter will return NULL if a workspace
itself is focused. Most other seat functions like seat_get_focus and
seat_set_focus now accept and return nodes.

In the config->handler_context struct, current_container has been
replaced with three pointers: node, container and workspace. node is the
same as what current_container was, while workspace is the workspace
that the node resides on and container is the actual container, which
may be NULL if a workspace itself is focused.

The global root_container variable has been replaced with one simply
called root, which is a pointer to the sway_root instance.

The way outputs are created, enabled, disabled and destroyed has
changed. Previously we'd wrap the sway_output in a container when it is
enabled, but as we don't have containers any more it needs a different
approach. The output_create and output_destroy functions previously
created/destroyed the container, but now they create/destroy the
sway_output. There is a new function output_disable to disable an output
without destroying it.

Containers have a new view property. If this is populated then the
container is a view container, otherwise it's a layout container. Like
before, this property is immutable for the life of the container.

Containers have both a `sway_container *parent` and
`sway_workspace *workspace`. As we use specific types now, parent cannot
point to a workspace so it'll be NULL for containers which are direct
children of the workspace. The workspace property is set for all
containers, except those which are hidden in the scratchpad as they have
no workspace.

In some cases we need to refer to workspaces in a container-like way.
For example, workspaces have layout and children, but when using
specific types this makes it difficult. Likewise, it's difficult for a
container to get its parent's layout when the parent could be another
container or a workspace. To make it easier, some helper functions have
been created: container_parent_layout and container_get_siblings.

container_remove_child has been renamed to container_detach and
container_replace_child has been renamed to container_replace.

`container_handle_fullscreen_reparent(con, old_parent)` has had the
old_parent removed. We now unfullscreen the workspace when detaching the
container, so this function is simplified and only needs one argument
now.

container_notify_subtree_changed has been renamed to
container_update_representation. This is more descriptive of its
purpose. I also wanted to be able to call it with whatever container was
changed rather than the container's parent, which makes bubbling up to
the workspace easier.

There are now state structs per node thing. ie. sway_output_state,
sway_workspace_state and sway_container_state.

The focus, move and layout commands have been completely refactored to
work with the specific types. I considered making these a separate PR,
but I'd be backporting my changes only to replace them again, and it's
easier just to test everything at once.
2018-09-05 18:01:43 +10:00
Ryan Dwyer f057a0195e Implement focus_on_window_activation
Depends on https://github.com/swaywm/wlroots/pull/1223
2018-09-02 18:20:34 +10:00
Ryan Dwyer 5dbbab7bdc Remove layout.c
When we have type safety we'll need to have functions for
workspace_add_tiling and so on. This means the existing container
functions will be just for containers, so they are being moved to
container.c. At this point layout.c doesn't contain much else, so I've
relocated everything and removed the file.

* container_swap and its static functions have been moved to the swap
command and made static.
* container_recursive_resize has been moved to the resize command and
made static.
* The following have been moved to container.c:
    * container_handle_fullscreen_reparent
    * container_insert_child
    * container_add_sibling
    * container_add_child
    * container_remove_child
    * container_replace_child
    * container_split
* enum movement_direction and sway_dir_to_wlr have been moved to util.c.

Side note: Several commands included layout.h which then included
root.h. With layout.h gone, root.h has to be included by those commands.
2018-08-26 12:05:16 +10:00
Ian Fan c1af79532f commands: add nop 2018-08-18 15:50:26 +01:00
emersion 700941dde8 Listen to server-decoration mode changes 2018-08-06 15:20:30 +01:00
Ryan Dwyer 04489ff420 Separate root-related code
This creates a root.c and moves bits and pieces from elsewhere into it.

* layout_init has been renamed to root_create and moved into root.c
* root_destroy has been created and is called on shutdown
* scratchpad code has been moved into root.c, because hidden scratchpad
containers are stored in the root struct
2018-08-04 14:01:20 +10:00
Brian Ashworth a7f7d4a488 Write to swaynag pipe fd directly on config errors 2018-08-03 10:37:35 -04:00
Michel Ganguin d6095588a1 Link xcb dependency to meson options "enable_xwayland" (#2393)
* Link xcb dependency to meson options "enable_xwayland"

* Link xcb dependency to meson options "enable_xwayland"
2018-08-02 08:36:47 +01:00
ProgAndy c7a3a03115 Add xkb_numlock/xkb_capslock commands (#2311) 2018-07-25 17:24:45 +02:00
Pascal Pascher 2bf893248a style fixes, exclude sway/desctop/xwayland.c when enable_xwayland: false 2018-07-24 23:37:41 +02:00
Ryan Dwyer 81e8f31cc6 Implement scratchpad
Implements the following commands:

* move scratchpad
* scratchpad show
* [criteria] scratchpad show

Also fixes these:

* Fix memory leak when executing command with criteria
(use `list_free(views)` instead of `free(views)`)
* Fix crash when running `move to` with no further arguments
2018-07-23 08:24:32 +10:00
Ryan Dwyer 9fbe13b9be Implement floating_modifier and mouse operations for floating views
This implements the following:

* `floating_modifier` configuration directive
* Drag a floating window by its title bar
* Hold mod + drag a floating window from anywhere
* Resize a floating view by dragging the border
* Resize a floating view by holding mod and right clicking anywhere on
the view
* Resize a floating view and keep aspect ratio by holding shift while
resizing using either method
* Mouse cursor turns into resize when hovering floating border or corner
2018-07-22 23:10:19 +10:00
Ryan Dwyer c2ed3d8bd6 Implement force_display_urgency_hint
The directive sets the timeout before an urgent view becomes normal
again after switching to it from another workspace.

Also:

* When an xwayland surface removes the urgent hint while the timer is
active, we now ignore the request. This happens as soon as the view
receives focus, so it was effectively making the timer pointless.
* The timeout is now only applied when switching to it from another
workspace.
2018-07-21 10:28:07 +10:00
Ryan Dwyer 75c699db62 Implement default_floating_border command and adjust CSD behaviour 2018-07-17 10:14:33 +10:00
Drew DeVault d6bd314dff
Merge pull request #2276 from RyanDwyer/urgency
Implement urgency base functionality
2018-07-16 15:39:08 -07:00
Ryan Dwyer fc2484095a Implement no_focus command 2018-07-16 22:18:12 +10:00
Ryan Dwyer 315d5311b2 Implement urgency base functionality
Introduces a command to manually set urgency, as well as rendering of
urgent views, sending the IPC event, removing urgency after focused for
one second, and matching urgent views via criteria.
2018-07-16 08:19:25 +10:00
Brian Ashworth 13c6627ddb Implement tap_button_map for input devices 2018-07-14 01:01:47 -04:00
Robert Kubosz 41b80c28df
add scroll button option
This commit introduces a scroll_button option, which is intended to be
used with scroll_method. Now user can edit his sway config and add an
scroll_button option to device section.
2018-07-11 22:03:06 +02:00
Ryan Dwyer f2d1cf3ceb Implement floating_minimum_size and floating_maximum_size 2018-07-11 22:16:48 +10:00
emersion f9625d1d56
Split renderer 2018-07-07 10:30:52 +01:00
Dominique Martinet e4bfb3bc98 Add idle inhibit unstable v1 support 2018-07-02 09:29:16 +09:00
Ryan Dwyer a2fbb20a61 Merge remote-tracking branch 'upstream/master' into atomic 2018-06-29 20:04:24 +10:00
emersion cda66e9a26
Automatically float xwayland windows 2018-06-18 22:52:10 +01:00
Ryan Dwyer 9e96cfd310 Merge remote-tracking branch 'upstream/master' into atomic 2018-06-11 11:03:43 +10:00
Nate Symer 6a910b9ba5 Implement gaps (PR #2047) 2018-06-09 09:34:56 -04:00
Ryan Dwyer 59c9488701 WIP: Atomic layout updates ground work 2018-06-09 10:08:43 +10:00
Brian Ashworth 5ea4a4d3ee Refactor cmd_output to use config_subcommand 2018-06-03 10:26:06 -04:00
Ryan Dwyer 1f2e399ade Implement floating 2018-06-01 23:14:58 +10:00
Drew DeVault f3ab895916 Implement `floating enable` 2018-06-01 23:14:58 +10:00
Brian Ashworth d76729af22 Implement config parser for workspace_layout 2018-05-28 22:55:06 -04:00
Brian Ashworth c81d0ef1e8 Support i3's legacy force_focus_wrapping command 2018-05-28 11:09:46 -04:00
Brian Ashworth 46da1dc32b Implement focus_wrapping 2018-05-27 23:20:21 -04:00
Brian Ashworth 569f4e0e4c Implement swap command 2018-05-26 11:05:02 -04:00
Ryan Dwyer 0e2cc0af30 Implement show_marks 2018-05-17 08:29:14 +10:00
Ryan Dwyer 22d38600d0 Implement marks 2018-05-15 11:18:27 +10:00
emersion 95a10dd4f3
Kill wl_shell 2018-05-14 13:26:10 +01:00
emersion 88d9d43b36
Add xdg-shell stable support 2018-05-13 16:38:56 +01:00
Brian Ashworth 3db7fc2bb2 Implement hide_edge_borders 2018-05-11 18:44:56 -04:00
Ryan Dwyer 228c478e8d Implement title_format
This implements the title_format command, with a new placeholder %shell
which gets substituted with the view type (xwayland, xdg_shell_v6 or
wl_shell).

Example config:

    for_window [title=".*"] title_format %title (class=%class instance=%instance shell=%shell)
2018-05-05 22:29:37 +10:00
Ryan Dwyer b667298a0a Render titles 2018-05-03 15:12:00 +10:00
Ryan Dwyer e67f354333 Implement borders
Implements rendering of borders. Title text is still to do.

Implements the following configuration directives:

* client.focused
* client.focused_inactive
* client.unfocused
* client.urgent
* border
* default_border
2018-04-30 21:24:13 +10:00
Ryan Dwyer 167c2e1aa9 Refactor arrange_windows()
Replaces arrange_windows() with arrange_root(), arrange_output(),
arrange_workspace() and arrange_children_of().

Also makes fullscreen views save and restore their dimensions, which
allows it to preserve any custom resize and is also a requirement for
floating views once they are implemented.
2018-04-28 11:26:14 +10:00
emersion ff61df17ff
Add map_from_region command 2018-04-26 10:53:47 +01:00
Ryan Dwyer 72767e1cc3 Implement criteria commands
Implements the following commands:

* for_window [...] <cmdlist>
* assign [...] <workspace>
2018-04-24 20:08:32 +10:00
Ryan Dwyer d956286b92 Implement rename workspace command
This implements the following commands:

* rename workspace to new_name
* rename workspace old_name to new_name
* rename workspace number n to new_name
2018-04-23 18:54:45 +10:00
Drew DeVault 21eb63cc9e
Merge branch 'master' into fullscreen 2018-04-19 08:56:03 -04:00
Ryan Dwyer 9d3739a6f7 Split repeat commands into separate files. 2018-04-19 13:47:29 +10:00
Ryan Dwyer 5b30391383 Make key repeat configurable
This creates two input commands for configuring the repeat delay and rate.

Example config:

    input "myidentifier" {
        repeat_delay 250
        repeat_rate 25
    }
2018-04-18 23:19:23 +10:00
Ryan Dwyer 52420cc24d Implement fullscreen. 2018-04-16 20:36:40 +10:00
Danny Bautista 1edb2bd892 Implement cursor event simulation with sway commands. 2018-04-10 12:40:50 -04:00
Drew DeVault 0e3ddf255e Add input "identifier" map_to_output "identifier" 2018-04-08 15:09:12 -04:00
db 042b80b9fa Add workspace_auto_back_and_forth command
This is the only missing piece - other code regarding this functionality has
already been ported from pre-wlroots source.
2018-04-08 16:44:59 +02:00
Drew DeVault 603e0e42c5 Add debug tree view 2018-04-06 11:49:27 -04:00
emersion 1c91d0c10f
Add damage tracking for xwayland unmanaged surfaces 2018-04-05 17:39:17 -04:00
Drew DeVault f77986338f Implement resize command 2018-04-05 00:03:20 -04:00
Tony Crisci fc9398a42e Implement opacity command 2018-04-04 21:57:05 -04:00
Tony Crisci fa004dd0d7 move output create to its own file 2018-04-03 20:00:09 -04:00
Tony Crisci cba258e16a move output code out of the tree 2018-04-03 12:40:11 -04:00
Tony Crisci 2187684bd0 Merge branch 'wlroots' into split-containers 2018-04-02 14:06:04 -04:00
Drew DeVault b2d871cfe2 Partially implement move command
Works:

- move [container|window] to workspace <name>
    - Note, this should be able to move C_CONTAINER but this is untested
- move [workspace] to output [left|right|up|down|<name>]

Not implemented yet:

- move [left|right|up|down]
- move scratchpad
- move position
2018-04-02 11:12:18 -04:00
Tony Crisci 7706d83160 basic split containers 2018-03-31 15:37:16 -04:00
Drew DeVault 9b38ef950f Implement focus_follows_mouse
Also contains two other small changes:

- Clicking any button will focus the container clicked (not just left)
- Remove seamless_mouse (doesn't make sense on wlroots)
2018-03-31 13:05:45 -04:00
Drew DeVault ae6d459000 Implement mouse warping 2018-03-31 13:05:45 -04:00
Drew DeVault 49379dd0fc Fix workspace deletion edge cases 2018-03-30 13:49:34 -04:00
Drew DeVault 69eb021767 Add default_orientation command 2018-03-30 10:43:55 -04:00
Drew DeVault 8efee109ad Implement modes 2018-03-29 22:11:08 -04:00
Drew DeVault 5c9cdbcdd2 Add swaybg_command 2018-03-29 22:11:08 -04:00
Drew DeVault 569b2bfd5d Move bar config into its own file 2018-03-29 22:11:08 -04:00
Drew DeVault bf7a4cd0eb Add bar configuration commands 2018-03-29 22:11:08 -04:00
Drew DeVault 0c8a64942e Add initial layer shell skeleton 2018-03-28 15:47:22 -04:00
Tony Crisci 66d1e0b313 basic layout command 2018-02-22 18:37:14 -05:00
Tony Crisci 52670c636c basic focus (without direction) 2018-02-14 16:47:23 -05:00
Drew DeVault b28602aa74 Implement workspaces 2018-01-30 23:09:21 -05:00
Dominique Martinet 869be4378d commands: add 'reload' command 2018-01-22 07:25:23 +01:00
Tony Crisci 0e3eae4baa view interface 2018-01-21 09:09:53 -05:00
Tony Crisci 6a1d71b8b8 basic command criteria 2018-01-20 16:21:45 -05:00
Tony Crisci c353e01c85 add kill command 2018-01-20 14:10:11 -05:00
Dominique Martinet c83900593d config: add 'set' command 2018-01-05 15:36:20 +01:00
Tony Crisci ba69f06695 binding config 2017-12-27 12:31:06 -05:00