Commit Graph

1042 Commits

Author SHA1 Message Date
Orestis Floros
910e58585f
Support multiple _NET_WM_STATE changes in one ClientMessage (#5910) 2024-02-12 08:40:39 +01:00
rsgowman
6a530de220
Create new workspaces to the right of existing ones with the same number
i.e. creating workspaces named "1", "2:a", "2:b", "3" should result in
that same order rather than "1", "2:b", "2:a", "3".
2024-02-06 20:28:20 +01:00
rsgowman
0639167185
Don't skip identically numbered workspaces when moving to next/prev (#4578)
eg if you have workspaces: { 1, 2:a, 2:b, 3 } and are on workspace 1,
then 'workspace next' should traverse 1 -> 2:a -> 2:b -> 3 -> 1 instead
of 1 -> 2:a -> 3 -> 1.

Fixes #4452
2024-02-06 20:07:21 +01:00
Orestis Floros
f8befe378a
Avoid creating redundant containers when switching between tabbed/stacked and split layouts (#5469)
Fixes #3001
2024-01-31 08:14:32 +01:00
Orestis Floros
5fdfb14530
con_is_maximized: Fix case where parent is workspace (#5880)
See added test for simple example.
2024-01-26 08:51:28 +01:00
Seth Pollen
a56670bca8 split up compound test assertions 2024-01-24 14:29:01 +01:00
sethpollen
b660d6a902
Add support for _NET_WM_STATE_MAXIMIZED_{HORZ, VERT} (#5840)
If a window occupies the entirety of its workspace vertically and/or horizontally, pass it the _NET_WM_STATE_MAXIMIZED_{HORZ, VERT} atoms. This helps applications like Google Chrome draw the tab bar correctly and handle tab clicks correctly (see https://crbug.com/1495853).

This change is based on work from @yshui in #2380.
2024-01-22 20:34:40 +01:00
Orestis Floros
69f68dcd74
focus workspace: consider workspace_auto_back_and_forth (#5754)
Additionally, adds some tests for the command.

Fixes #5744
2023-11-05 11:08:44 +01:00
Sergey Zhmylove
26608b74d9
Fix failing testcase when the font exists (#5679)
When the font from testcase's config exists on the system,
load_configuration() does not fallback to a 'fixed' one resulting in a
fail of this case.
The fallback scenario is added as well.
2023-09-23 17:06:54 +02:00
Orestis Floros
5489db6bc8 motif hints: respect maximum border style in append_layout 2023-09-21 18:55:01 +02:00
Orestis Floros
82b9821204 Remanage window after urgency flag change
Fixes #5658
2023-09-06 17:24:53 +02:00
Wesley Schwengle
c6befec0fd Fix dead links for Modern Perl book
Closes: #5523

Signed-off-by: Wesley Schwengle <wesleys@opperschaap.net>
2023-09-04 16:09:05 +02:00
Orestis Floros
e6b41172da
Regrab buttons on mode change (#5554)
Unfortunately, grabbing / ungrabbing doesn't seem to work correctly in
xvfb so we can't really test this.

I also fixed the deduplication code in bindings_get_buttons_to_grab().
2023-06-30 08:57:19 +02:00
Orestis Floros
a95870120c
fix workspace not being focused on title bar scroll (#5518) 2023-05-29 14:08:46 +02:00
Orestis Floros
74785f4795
Allow switching workspaces when in global fullscreen mode (#5398)
Fixes #2974
2023-04-02 18:55:21 +02:00
Orestis Floros
ba1f40f45f
i3bar: Add protocol for workspace buttons
Closes #3818 (parent issue)
Fixes #1808
Fixes #2333
Fixes #2617
Fixes #3548
2023-01-22 18:59:58 +01:00
Orestis Floros
c52f13900d
Add focus workspace command 2023-01-22 18:33:23 +01:00
Orestis Floros
fa25afedd2
Do not canonicalize "nonprimary" output for i3bar
Fixes #5346
2023-01-06 22:30:56 +01:00
Michael Stapelberg
ab6f1fd160
fix focus <direction> with negative gaps (#5333)
fixes #5293
2022-12-21 08:11:51 +01:00
Orestis Floros
d5c8319b6c
Add "mode" field in binding event
This does *not* go in the binding object to reflect the same hierarchy
of the config file: a mode is a collection of bindings.

Fixes #5323
2022-12-14 13:23:12 +01:00
Orestis Floros
30131ed697
Support nonprimary output keyword (#5273)
Fixes #4878
2022-11-19 18:11:26 +01:00
Orestis Floros
029cb8af19
Use mask to determine workspace gaps assignments (#5283)
Fixes #5282
2022-11-13 16:03:58 +01:00
Michael Stapelberg
96614a2f32
apply updated workspace gap assignments after reload (#5279)
Fixes https://github.com/i3/i3/issues/5257
2022-11-12 17:32:30 +01:00
Michael Stapelberg
1ba0eaca22
Make floating_from and tiling_from criterion work in commands, too (#5278)
Fixes https://github.com/i3/i3/issues/5258
2022-11-12 16:44:08 +01:00
Michael Stapelberg
170a322cc2
fix: prevent gaps inside floating split containers (#5276)
Fixes https://github.com/i3/i3/issues/5272
2022-11-12 14:58:13 +01:00
Michael Stapelberg
d130126204
gaps: fix inner gaps for stacked/tabbed containers in splith/splitv (#5275)
Fixes https://github.com/i3/i3/issues/5261
2022-11-12 14:08:13 +01:00
Michael Stapelberg
804bca3a9a
gaps: make workspace gap assignments order-independent (#5259)
This commit moves subtracting the global gaps from the workspace gaps:
previously, this calculation was done while parsing the configuration
(order dependent), now it’s done at workspace assignment evaluation time.

related to https://github.com/i3/i3/issues/3724

fixes https://github.com/i3/i3/issues/5253
2022-11-07 19:02:57 +01:00
Michael Stapelberg
2a91514a31 t/548-motif-hints: add missing $x->flush after $x->change_property
I noticed the test was flaky before, possibly this fixes it.

related to #3009
2022-11-06 18:18:23 +01:00
Michael Stapelberg
d26ddcbfe5 draw leaf window decorations on ->frame instead of ->parent->frame
related to https://github.com/i3/i3/issues/3724
fixes https://github.com/i3/i3/issues/1966
2022-11-05 15:58:15 +01:00
Michael Stapelberg
4d0323fa9e t/319-gaps.t: also test the gaps command 2022-11-01 17:55:46 +01:00
Michael Stapelberg
a5791b2e64 gaps: allow optional px suffix 2022-11-01 17:55:46 +01:00
Michael Stapelberg
b2c696f680 add basic gaps test 2022-11-01 17:55:46 +01:00
Michael Stapelberg
b825dc124a Merge gaps support as-is
This code was copied over unmodified from https://github.com/Airblader/i3-gaps.

I have split out the differences between i3-gaps and i3 into three areas:
1. Gaps
2. i3bar height
3. rgba colors
2022-11-01 17:55:46 +01:00
Michael Stapelberg
0b89d4b2a7 implement bar { padding } config directive
related to https://github.com/i3/i3/issues/3724
related to https://github.com/i3/i3/pull/4288
fixes https://github.com/i3/i3/issues/3721
2022-10-30 22:22:08 +01:00
Michael Stapelberg
327bca26d8 add test for bar { height } 2022-10-30 22:22:08 +01:00
Michael Stapelberg
c45342e74f Merge support for the bar { height } option as-is from i3-gaps
related to https://github.com/i3/i3/issues/3724
related to https://github.com/i3/i3/issues/3721

In a follow-up commit, we can evolve this into the padding directive as
discussed on issue #3721.
2022-10-30 22:22:08 +01:00
Orestis Floros
080c73d1a4
i3-dmenu-desktop: ignore SIGPIPE when writing to dmenu (#5228)
Fixes broken test
2022-10-29 08:20:09 +02:00
Orestis Floros
b18b80ca40
i3-dmenu-desktop test: Do not autostart i3 (#5224)
This actually fixes a hang that happens on my machine for some reason.
Regardless, starting i3 is not necessary for this test.
2022-10-24 19:57:07 +02:00
Michael Stapelberg
55d400b17d make tiling drag configurable
fixes https://github.com/i3/i3/issues/5155
2022-10-16 18:21:08 +02:00
Michael Stapelberg
812ec43d46
Fix i3-dmenu-desktop quoting (#5162)
Commit 70f23caa9a introduced new issues.

Instead of distinguishing " and \, as that commit attempted,
let’s instead keep the level of escaping by escaping each backslash,
just like each double quote.

I tested this with:

    # recommended way to quote $ and " in quoted arguments, not ambiguous
    Exec=/tmp/logargs "hello \\$PWD \\"and\\" more"

    # permitted way to quote $ and " in quoted arguments, but ambiguous
    Exec=/tmp/logargs "hello \$PWD \"and\" more"

    # permitted way to quote arguments, slightly unusual to quote first arg
    Exec="/tmp/logargs" hey

    # a complicated shell expression, not ambiguous
    Exec=sh -c "if [ -n \\"\\$*\\" ]; then exec /tmp/logargs --alternate-editor= --display=\\"\\$DISPLAY\\" \\"\\$@\\"; else exec /tmp/logargs --alternate-editor= --create-frame; fi" placeholder %F

related to https://github.com/i3/i3/issues/4697 (electrum, original)
related to https://github.com/i3/i3/issues/5152 (phpstorm, breakage)
related to https://github.com/i3/i3/issues/5156 (emacsclient, breakage)
2022-09-28 18:29:26 +02:00
Orestis Floros
8ec41334ec Fix motif logic for new floats
- manage.c still used wrong `motif_border_style == BS_NORMAL`
- container must be set to floating first for correct code path and
  correct max_user_border_style to be used in con_set_border_style
- Motif test now includes default_floating_border
2022-09-24 20:46:47 +02:00
Orestis Floros
f6097d4a37 Motif hints: Respect maximum border style configuration set by user
Context:
Motif hints [1] allow applications to request specific window manager
frame decorations. Most applications like alacritty, chromium, and
godot, use the hints as a binary flag, setting or un-setting
`MWM_DECOR_ALL`.
Previously [2], we had disallowed applications to set the "normal"
border style through motif hints. This effectively meant that users that
had set `default_border pixel` would not see applications spawning with
normal decorations [3].
However, that meant that applications like godot [4] could not toggle
their border between none and normal so the behaviour changed with
v4.21 [5].
That change however also allowed applications to override the default
none/pixel border style the user set. For example, alacritty can be
configured to either have all or no decorations [6] and they always set
the motif hint on startup, completely overriding i3 user's preference:
1. If decorations are disabled with alacritty's config then they will
   override `default_border normal` and no title will be used.
2. If decorations are enabled (also the default behavior) with
   alacritty's config then they will override `default_border pixel` and
   a title will be used.

This patch redefines how we interpret motif hints. When a client sets
`MWM_DECOR_ALL`, we interpret it as "the maximum decoration the user has
allowed for this window". I.e., if a client was all decorations and the
user expects the window to not have a title, we don't include the title
in "all" decorations.

The user's preference is determined by these:
1. For new tiling windows, as set by `default_border`
2. For new floating windows, as set by `default_floating_border`
3. For all windows that the user runs the `border` command, whatever is
   the result of that command for that window.
Example:
- User opens new tiling window with `default_border pixel` => maximum
  decoration = PIXEL
- Window requests all/title decorations => i3 enforces the user maximum
  decoration, PIXEL (no change)
- Window requests no decorations => i3 accepts it and sets border to
  NONE, maximum decoration remains PIXEL
- User toggles the border, next style is NORMAL => maximum decoration is
  now NORMAL
- Window requests no decorations => i3 accepts it and sets border to
  NONE
- Window requests all/title decorations => i3 accepts it and sets the
  maximum border, NORMAL
- User toggles the border, next style is NONE => maximum decoration is
  now NONE
- Window requests all/title decorations => i3 enforces the user maximum
  decoration, NONE (no change)

With this, we will still allow behaviour where windows can toggle their
border style with motif hints [4][7].

Reference/footnotes:
[1]: https://linux.die.net/man/3/vendorshell
[2]: https://github.com/i3/i3/pull/2386
[3]: Notice how there is apparently a gap because `default border none`
settings would not be respected if an application wanted just "border"
decorations but this was never reported, probably because of the rare
conjunction of applications requesting that and users defaulting to none
borders.
[4]: https://github.com/godotengine/godot/issues/40037
[5]: https://github.com/i3/i3/pull/5135
[6]: Set by an underlying library here:
fafdedfb7d/src/platform_impl/linux/x11/util/hint.rs (L113-L142)
called by alactitty here:
4ddb608563/alacritty/src/display/window.rs (L341)
[7]: https://github.com/i3/i3/issues/3678

Closes #3678
Fixes #5149
2022-09-24 20:46:47 +02:00
Michael Stapelberg
8ade46bdf0
unflake t/289-ipc-shutdown-event.t (#5144)
Before this commit, the test was flaky: it relied on the Perl test process
sending the kill() system call before i3 exited. This can easily be triggered
by adding a sleep(1) after the “cmd 'exit'” line.

This is because with i3_autostart => 1 (the default), i3test.pm kills i3
or bails out if it can’t.

So, we instead set i3_autostart => 0 and launch i3 ourselves.
This will unfortunately still make the code kill i3 and bail out,
because launch_with_config updates the $i3_pid variable that i3test.pm
uses for tracking whether it should clean up i3.
The solution is to exit i3 by calling exit_gracefully,
which will make the i3test.pm state correct.

related to https://github.com/i3/i3/issues/3009
2022-09-21 17:47:40 +02:00
zhrvn
5ce8e3241b
Fix crash in parse_file() when parsing nested variables (#5003)
Count extra_bytes correctly

If there is a variable with the same name as the rest of another
variable after removing $, then it will be counted twice. Therefore,
we need to completely replace it with spaces (variable names cannot
contain spaces) in order to correctly calculate the length of a new
string.

fixes https://github.com/i3/i3/pull/5002

Co-authored-by: Ivan Zharov <zhiv.email@gmail.com>
Co-authored-by: Michael Stapelberg <stapelberg@users.noreply.github.com>
2022-09-12 09:03:50 +02:00
zhrvn
e48b9aa284
Fix segfault with mode "default" key bindings (#5007)
ignore bindings when not in a valid mode

Co-authored-by: Ivan Zharov <zhiv.email@gmail.com>
Co-authored-by: Michael Stapelberg <stapelberg@users.noreply.github.com>
2022-09-11 15:22:01 +02:00
Michael Stapelberg
ac368e7916
config_parser: prevent trailing whitespace in output (string → word) (#5117)
fixes https://github.com/i3/i3/issues/5064
2022-09-09 10:23:55 +02:00
Michael Stapelberg
6fb58eb841
config: set bar block font to i3-wide font *after* parsing (#5118)
Otherwise, the font directive needs to come before bar blocks,
which is surprising to users.

fixes https://github.com/i3/i3/issues/5031
2022-09-09 10:21:33 +02:00
Orestis Floros
ebcd1d43ea
Allow dragging tiled windows with the mouse. (#3085)
Fixes #2643

Inner drop region behaves like move to mark.
The outer region is close to the edge (currently 30px from the edge).
This will place the container as a sibling in the given direction within
the parent container. If the move direction goes against the orientation
of the parent container, tree_move() is called.

Contributors:
Co-authored-by: Orestis Floros <orestisflo@gmail.com>
See #3085
- Inner drop region behaves like move to mark
- Handle workspaces
- Fix crash when target closes
- Initiate tiling drag from titlebar
- Hide indicator until container is dragged outside of original position
- Calculate outer_threshold using percentages instead of fixed pixel
values
- Emit 'move' event properly
- Don't focus previously unfocused containers
- Use tree_split() on different orientation
- Fix redundant split containers
- DT_PARENT
- Readability & optimizations
- Limit parent threshold by render_deco_height()
- Tests
- Fullscreen container handling
- Initiate drag from title bar
- Fix issue of EnterNotify events still triggering after drag_callback
  is called
- Include decorations for drop target calculation

Co-authored-by: Michael Forster <email@michael-forster.de>
See #2178
- Original implementation of tiling drag + indicator window
> A container can be dragged by the title bar to one of the four sides
> of another container. That container will then be split either
> horizontally or vertically.

Co-authored-by: Tony Crisci <tony@dubstepdish.com>
See #2653
- Original implementation of outer/inner drop region indicator:
> There are two drop regions per direction.
>
> The inner region is closer to the center of the window. Dropping on
> this region will split the target container and put the container
> within the split at the given direction beside the target container.
>
> The outer region is close to the edge (currently 30px from the edge).
> This will place the container as a sibling in the given direction within
> the parent container.
>
> Dropping into the outer region moves the con beside the target. If the
> move direction goes against the orientation of the parent container, the
> con moves out of the row.
- Fix crash: Ignore containers without a managed window (eg i3bar)
2022-07-28 12:03:16 +02:00
zhiv-git
ce2665ca96
Fix segfault when bindsym command is empty (#5001)
Remove end token from BINDCOMMAND

fixes i3/i3#5000: bindsym command cannot be empty, because NULL string
causes i3 to segfault when copied in configure_binding()
2022-06-08 22:38:21 +02:00
George Rodrigues
6ab64aa5b7
Fix typos (#4989) 2022-06-01 09:49:05 +02:00