Xembed support is premature in sway and should be postponed. This commit
only removes swaybar starting xembedsniproxy, if users would like, they
can still start xembedsniproxy manually, however there will be no
official support.
This commit implements the StatusNotifierItem protocol, and enables
swaybar to show tray icons. It also uses `xembedsniproxy` in order to
communicate with xembed applications.
The tray is completely optional, and can be disabled on compile time
with the `enable-tray` option. Or on runtime with the bar config option
`tray_output none`.
Overview of changes:
In swaybar very little is changed outside the tray subfolder except
that all events are now polled in `event_loop.c`, this creates no
functional difference.
Six bar configuration options were added, these are detailed in
sway-bar(5)
The tray subfolder is where all protocol implementation takes place and
is organised as follows:
tray/sni_watcher.c:
This file contains the StatusNotifierWatcher. It keeps track of
items and hosts and reports when they come or go.
tray/tray.c
This file contains the StatusNotifierHost. It keeps track of
sway's version of the items and represents the tray itself.
tray/sni.c
This file contains the StatusNotifierItem struct and all
communication with individual items.
tray/icon.c
This file implements the icon theme protocol. It allows for
finding icons by name, rather than by pixmap.
tray/dbus.c
This file allows for asynchronous DBus communication.
See #986#343
_sway_assert is a variadic function which tries
to delegate to another variadic function. This
requires a vprintf-style variant of the delegate.
https://stackoverflow.com/a/150616
This commit changes how commands decide what container to act on.
Commands get the current container though `current_container`, a global
defined in sway/commands.c. If a criteria is given before a command,
then the following command will be run once for every container the
criteria matches with a reference to the matching container in
'current_container'. Commands should use this instead of
`get_focused_container()` from now on.
This commit also fixes a few (minor) mistakes made in implementing marks
such as non-escaped arrows in sway(5) and calling the "mark" command
"floating" by accident. It also cleans up `criteria.c` in a few places.
This commit adds three commands to sway: `show_marks`, `mark` and
`unmark`. Marks are displayed right-aligned in the window border as i3
does. Marks may be found using criteria.
Fixes#1007
This commit lets the 'move' command apply to floating containers as well
as tiled ones. The command may be appended with a number of pixels and
then optionally the string `px` (like '10 px') in order to move the
container more or fewer than the standard ten pixels.
Colors are configured through the command line so that swaylock conforms
to the i3lock fork 'github.com/chrjguill/i3lock-color'. Differences from
it are that one letter options '-r' and '-s' are not implimentend because
'-s' is already used by '--scaling' in swaylock.
This commit also fixed whitespace in 'include/swaylock/swaylock.h' and
changed `parse_color` in 'common/util.h' so that it can accept colors
that do not start with a hash. This was done to keep compatability with
the i3lock fork.
This fixes issue #733. Now if the user focuses output right but is at
the rightmost monitor, the focus will wrap the the leftmost monitor.
This commit adds a new function, swayc_opposite_output, which selects
the opposite output given a position and a direction. Now, when calling
output_by_name, we first check if there is an adjacent output to switch
to. If that fails, we call swayc_opposite_output to handle wrapping.
- added L_AUTO_FIRST/LAST instead of using explicit layouts.
- when switching between auto layout that don't share the same major axis, invert the
width/height of their child views to preserve their relative proportions.
For workspace containers, swayc_change_layout also changes ->layout alongside
->workspace_layout when it's a sensible thing to do. There is an additional test
for 'layout toggle' command which ensures that containers will be tiled
horizontally after toggling from tabbed or stacked.
Some users may want to switch buttons on their input devices, turns out
libinput already supports it. Let's add a support for it in our config.
Signed-off-by: Michał Winiarski <knr@hardline.pl>
Add swayc_change_layout function, which changes either layout or
workspace_layout, depending on the container type. Workspace being
always L_HORIZ makes this much more i3-compatible.
Replace `update_view_border()` with `update_container_border()`. The latter
should handle both the case where the container is a view or if the container
has children.
The previous implementation of focus handling assumed that only views can be
focused. Containers can also be focused with a command like `focus parent` or
`focus child`.
Change `set_focused_container()` to handle the case of the given container
being a container with children and update borders accordingly.
When titlebar is hidden, top border of the topmost view inside
tabbed/stacked container will not be drawn. This is changed in layout.c
On the other hand, top border should be drawn sometimes, for example
when titlebar is hidden on a view that is not the topmost inside
tabbed/stacked container. This is changed in border.c
Panels were explicitly rendered by calling wlc_surface_render in
handle_output_pre_render. Calling wlc_surface_render does not set the
surface's geometry (like wlc_view_set_geometry does). Sway did not call
wlc_view_set_geometry for panels, so wlc defaulted their geometry to be at
the origin. This is not correct for bars unless their location is top.
Furthermore, for a surface to receive pointer events, its mask has to be
set to visible. This causes wlc to render these surfaces, causing panels
and backgrounds to be rendered twice.
This commit makes panels and surfaces visible, sets the correct geometries
and removes the code that explicitly rendered them.
Tabbed/stacked containers are now created only if a view is present on
the workspace. If a view is created on previously empty tabbed/stacked
workspace, it gets wrapped in a container.
Prior to this commit all windows (e.g. shell surfaces) were handled the same
way in handle_view_created. Since backgrounds and panels have to be treated
differently, they could not be shell surfaces. This changes checks whether
a client is a background or a panel in handle_view_created and exists to
let them be dealt with elsewhere.
Values cannot be negative or 0; if so uses the default 75x50.
Uses the same syntax as i3: floating_minimum_size <width> x <height>, although the x can be anything.
This patch makes sure to clear the border buffer of fullscreen view so
the border doesn't get drawn behind a fullscreen view, which would be
visible if the view was transparent.
I made this configurable but I didn't make the command for it. That's
left as an exercise to an eager contributor.
mod_scroll_behavior [gaps inner|gaps outer]
Would merge implementions of more behaviors for mod+scroll, if anyone
has some neato ideas.
The borders are implemented as a surface/buffer attached to each view
which is sent to and rendered by wlc in the view_pre_render callback.
All the drawing logic is handled in sway/border.c and all the logic for
calculating the geometry of the border/view is handled in
`update_geometry` in sway/layout.c (same place as gaps are calculated).
The include command (`include <path>`) makes it possible to include sub
config files from the main config file (or from within other sub config
files).
The include command uses the following rules for including config files:
* the `path` can be either a full path or a path that is relative to the
parent config. Shell expansion is supported, so it's possible to do
`include ~/.config/sway.d/*`.
* The same config file can only be included once (to prevent include
cycles). If a config is included multiple times it will just be
ignored after it has been included once.
* Including a sub config file is the same as inserting the content of
that file into the parent config, thus rules about overwriting
bindsyms etc. works the same as for a single config.
Implement #542
desktop_shell.panel_size was only used to determine if sway should
rearrange the output when rendering the panel in the output_pre_render
hook. This is not needed since the output will have been arranged at
that point.
It also caused sway to rearrange all the time when running with two
or more different monitors/resolutions because panel_size kept changing
with every output_pre_render callback.
Should fix#514
It's possible to assign workspaces to certain outputs using the command:
workspace <name> output <output>
However, this did not work in some cases where the workspace was
assigned before the given output was made available to sway.
This patch fixes those cases.
Calling `exit` in sway_terminate prevents sway from correctly shutting
down (freeing data, cleanly terminating the ipc server, etc.).
A better way is to exit straight away if the failure occurs before
`wlc_run` and use sway_abort as usual if it occur when wlc is running.
This makes IPC GET_PIXELS use the new `wlc_pixels_read` call instead of
the deprecated `wlc_output_get_pixels`.
The old version worked by passing a callback function to wlc which would
grab the pixels and send them to the IPC client.
The new version works by maintaining a list of clients who have
requested the pixels of some output and then grap and send the pixels in
the output_post_render hook of the `wlc_interface`.
This adds quotes around multiword arguments before they are passed to
`/bin/sh -c` in an exec command.
Example:
I connect to irc like this:
exec termite -e "mosh server tmux a"
Without this patch the arguments are passed to sh as:
termite -e mosh server tmux a
When it should be:
termite -e "mosh server tmux a"
For the command to work.
This implements the IPC binding event for keyboard bindings. It is
slightly different from the i3 implementation [1] since sway supports
more than one non-modifier key in a binding. Thus the json interface has
been changed from:
{
...
"symbol": "t",
...
}
to:
{
...
"symbols": [ "t" ],
...
}
[1] http://i3wm.org/docs/ipc.html#_binding_event
This is a "simple" version of --release (same as i3) that only supports
a binding that contain one normal key. e.g.:
bindsym --release $mod+x exec somthing-fun
I didn't bother implementing it for a combination like `$mod+x+z` since
it is a bit tricky to get right and also a bit weird to actually do on a
keyboard.
This makes sure that a modifier event is only sent for active bar
modifiers, and that it is only sent once for each of those modifiers.
An active bar modifier is a modifier defined for a bar with `mode hide`
and `hidden_state hide`.
Detects when a bar modifier key is pressed/released and sends a modifier
IPC event to any listeners (usually swaybars).
This way a swaybar can listen on the modifier event and hide/show the
bar accordingly (not implemented yet)
The modifier event looks like this:
{
"change": "pressed", // or released
"modifier": "Mod4"
}
Makes `ipc_recv_response` return a struct with size, type and payload
rather than just the payload string.
This is useful if the type has to be checked on the client.
I've tried to make as few changes, as possible.
Usually the reason for using qsort_r is, that you can pass an extra userdata pointer to the
compare function. However, in sway list_sort wrapped qsort_r and always called a wrapper
function for comparing, the wrapper function then had the real compare function as argument.
The only thing, that the wrapper function does, is dereferencing the 'left' and 'right' function
arguments before passing them to the real compare function.
I have renamed list_sort to list_qsort to avoid confusion (so nobody tries to use list_qsort like
list_sort) and removed the wrapper functionality. Now the dereferencing must be done in the
compare function, that gets passed.
Some compare functions were used in both list_sort and list_seq_find. To make the difference
clear, I've added a '_qsort' suffix to the compare functions, that are intended to be used with
the new list_qsort. (In other words: list_qsort is not compatible anymore with list_seq_find).
- Changed and renamed function (it isn't used anywhere but in commands.c, and only for sorting):
compare_set -> compare_set_qsort
- New wrapper functions:
sway_binding_cmp_qsort (for sway_binding_cmp)
sway_mouse_binding_cmp_qsort (for sway_mouse_binding_cmp)
Track each panel separately via its wl_resource. `set_panel_position`
might be called before `set_panel`, so reuse panel config.
Place the position in panel_config so that each panel has its own
position.