Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
|
|
Only works with DRM backend.
|
|
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.
|
|
`[0]` is the switch type, not its state; we want `[1]` for that, and
it's a string not an int :)
|
|
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
|
|
Update for the breaking change in [1].
[1]: https://github.com/swaywm/wlroots/pull/3011
|
|
This reverts commit 487c83f0de9ca2a7650ad636eed6fd694ddcb82e.
The --create flag is undocumented, not in i3, and at least partially
broken (#5913), so this removes the feature.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
|
|
|
|
And exit(1) instead of indicating success.
|
|
This stops assuming the POSIX shell command is located in /bin.
|
|
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>
|
|
Using the fullscreen command on a child of a fullscreen split
container will now fullscreen the child instead of unfullscreening
the parent.
|
|
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.
|
|
Previously, the special case handling of scratchpad and unmark commands
was (probably accidentally) limited to criteria directly handled in the
execute_command function. This would exclude: 1. for_window criteria, as
these are handled externally for views and 2. and mouse bindings which
select target the node currently under the mouse cursor.
As a concrete example `for_window [app_id="foobar"] move scratchpad,
scratchpad show` would show (or hide due to the toggling functionality)
another window from the scratchpad, instead of showing the window with
app_id "foobar".
This commit replaces the "using_criteria" flag with "node_overridden"
with the more general notion of signifying that the node (and
container/workspace) in the current command handler context of the sway
config is not defined by the currently focused node, but instead
overridden by other means, i.e., criteria or mouse position.
|
|
When issuing a focus command on a specific container, users expect to
proceed it even if is hidden by a fullscreen window.
This matches the behavior of i3.
|
|
Pending state is currently inlined directly in the container struct,
while the current state is in a state struct. A side-effect of this is
that it is not immediately obvious that pending double-buffered state is
accessed, nor is it obvious what state is double-buffered.
Instead, use the state struct for both current and pending.
|
|
There is no need to check for transactions at the end of every user
input, as the vast majority of input will not issue transactions. This
implementation can also hide where changes are made without an
appropriate transaction commit, as a future unrelated input would issue
the commit instead.
Instead, commit transactions in places where changes are made or are
likely to be made.
|
|
And make the functions handling these arrays use const types.
|
|
|
|
|
|
|
|
This changes the move command to better match i3
behavior after the layout changes.
workspace_rejigger handled the case where containers would
escape their workspace in an orthogonal move by changing
the layout to accomodate them, but this case is now handled
within the loop.
|
|
This is in preparation for changing the workspace_layout
command to work like it does in i3.
This reverts commit b4a75a1ab2a72842830aeea37733311f85e6f660.
|
|
Some comparisons of current Sway versus i3 behavior:
1) T[T[T[app]]] + move left
* Sway: T[app]
* i3: T[T[app]]
2) H[V[H[V[app]]]] + move left
* Sway: H[app]
* i3: H[V[app]]
After this commit, Sway behavior matches i3. The intermediate states
are now:
T[T[T[app]]] -> T[T[app T[]]] -> T[T[app]]
H[V[H[V[app]]]] -> H[V[app H[V[]]]] -> H[V[app]]
|
|
In i3 the layout command on a workspace affects the workspace layout
only on empty workspaces. Otherwise children are placed in a new
container with the desired layout to preserve the workspace layout.
|
|
In i3 splits are ineffective on singleton H/V containers,
and the command is interpreted to affect the parent layout
instead.
|
|
Fixes #5847.
|
|
To query whether a container is sticky, checking `con->is_sticky` is
insufficient. `container_is_floating_or_child` must also return true;
this led to a lot of repetition.
This commit introduces `container_is_sticky[_or_child]` functions, and
switches all stickiness checks to use them. (Including ones where the
container is already known to be floating, for consistency.)
|
|
This commit switches focusing behavior to force a warp when executing
`focus mode_toggle`.
Fixes #5772.
|
|
Add an option for the `hide_cursor` command to hide the cursor when
typing, i.e. whenever a key is pressed.
|
|
|
|
A "resize shrink width 1px" will cause grow_x to be 0 while grow_width is -1,
incorrectly rejecting the command even though the resize is not a noop. Fix
this by checking width/height instead of x/y.
|
|
Closes #4139.
|
|
|
|
Prior to this commit, having a layout like T[app1 V[app2]], focusing
app2, and then doing `move left` would result in T[app2 app1]. Now, the
resulting layout is T[app1 app2], which matches i3 behavior.
`container_flatten` updates `container->parent`, meaning that the
existing check would never be true.
|
|
Split cmd_exec_always into separate methods for general validation and
process creation. This fixes a potential call of join_args with 0 arguments.
|
|
|
|
|
|
`!*rgba` tests if the first byte of rgba isn't `'\0'`.
`hex_to_rgba_hex` returns NULL if `parse_color` fails. There's a null
pointer dereference in that case. The intended behavior is `!rgba`.
|
|
|
|
If the mouse/cursor/pointer is near the edge of an output when a "move
position to pointer" command is run, then the floating container will be
constrained to fit inside the bounds of the output as much as possible.
This behavior matches what i3 does in this scenario. I also think it is
a better user experience.
Relates to #4906
The logic for the bounds check follows the implementation in i3: https://github.com/i3/i3/blob/733077822302d8b77eacb606a26fd002a42f534f/src/floating.c#L536
|