Commit Graph

7593 Commits

Author SHA1 Message Date
be440e0146 t/133-size-hints: synchronize with i3 before inspecting X11 windows
related to https://github.com/i3/i3/issues/3009
2025-12-22 18:06:21 +01:00
71dd66f3d9 cmd_floating: Fix crash when running empty workspace (#6563)
When running 'floating toggle' (or enable/disable) on an empty
workspace, the focused container is the workspace itself, which has
window=NULL. The command would call run_assignments(workspace->window),
which would pass NULL to match_matches_window(), causing a crash when
trying to access window->id.

Add a NULL check at the beginning of `run_assignments` to immediately
skip assignments for that case.

Fixes: #6561
2025-12-22 08:43:52 +01:00
0e2e8290f2 provide I3_WINDOW_ID to processes called with exec when possible (#6160)
fixes #1729
2025-12-20 08:04:30 +01:00
cbe78b4e55 clear old release-notes post 4.25 release 2025-12-19 08:29:02 +01:00
a194acc2f7 release.sh: update version numbers post 4.25 release 2025-12-19 08:28:21 +01:00
10840a791b debian: update changelog 2025-12-19 08:28:21 +01:00
3fa5d421cb Merge branch 'release-4.25' 2025-12-19 08:20:08 +01:00
acf73a3378 Restore non-git version suffix 2025-12-19 08:20:07 +01:00
1d8fcb8594 release i3 4.25 4.25 2025-12-19 08:19:53 +01:00
8944b0e50a release.sh: fix website updates after migration to hugo 2025-12-19 08:16:33 +01:00
1a1ea5b592 release.sh: fix shebang for NixOS 2025-12-19 07:49:24 +01:00
3ac79edbce meson: strip release-notes/ directory from dist tarballs 2025-12-19 07:49:07 +01:00
b933998878 Revert "include i3.service systemd user unit (#6547)" (#6554)
This reverts commit c5d0d5e837.

By starting i3 in a systemd unit, the user’s environment is lost.
This breaks too many workflows.

Blanket-importing the environment using systemctl import-environment
(without arguments) is explicitly discouraged in the systemctl man page.

It’s not clear how to fix this issue cleanly, so revert to unblock the release.

related to https://github.com/i3/i3/issues/5186
2025-12-18 18:43:56 +01:00
c5d0d5e837 include i3.service systemd user unit (#6547)
On Linux systems using systemd, we should activate graphical-session.target.

We conceptually need our i3.desktop file to do a
blockingly-run-via-systemd action (this is what scopes the activation of
graphical-session.target to the X session), and shipping an i3.service
is the best way to define the systemd unit we use for that.

Based on https://github.com/i3/i3/pull/5591 by David Sansome.

fixes https://github.com/i3/i3/issues/5186
2025-12-16 18:01:07 +01:00
d45c6ebda5 t/318-i3-dmenu-desktop.t: use $Config{perlpath} (absolute) over $^X (#6548)
I noticed that the Nix build does not actually work when using the
“#!/usr/bin/env $^X” shebang because /usr/bin/env is not present in the
Nix build sandbox.

$Config{perlpath} is always absolute, so let’s prefer that.

Tested both inside and outside a Nix build sandbox.

related to https://github.com/i3/i3/pull/6537
2025-12-15 18:49:41 +01:00
d88f0b831e i3test: add require statements before pragma imports (#6538)
Calling `feature->import(":5.10")` without loading feature.pm first
produces a warning in Nix derivation sandbox environments:

    Attempt to call undefined import method with arguments (":5.10")
    via package "feature" (Perhaps you forgot to load the package?)

Unlike the `strict` and `warnings` packages, which are loaded
by the use statements at the top of i3test.pm, the `use v5.10` line
does not load the `feature` package, but is handled directly by perl(1).

This commit adds explicit require statements for correctness.
2025-12-14 11:44:25 +01:00
9911520f4f t/323-net-frame-extents.t: unflake by adding sync_with_i3 (#6545)
related to https://github.com/i3/i3/issues/3009
2025-12-13 12:07:44 +01:00
0d6c6def8c t/318-i3-dmenu-desktop: Use $^X for generated script shebang (#6537)
The test creates a fake i3-msg Perl script at runtime. Previously it
used `#!/usr/bin/env perl` as the shebang, but this can fail in certain
build environments (e.g., Nix sandboxed builds) where the `perl` found
via `/usr/bin/env` may not have the same module paths as the `perl`
running the test suite.

Use `$^X` instead, which contains the path to the Perl interpreter
currently running the test. This ensures the generated script uses the
same Perl with the same `PERL5LIB` environment, guaranteeing that
`JSON::XS` and other required modules are available.
2025-12-13 08:30:29 +01:00
5446ea33ef fix switching to/restoring from LC_NUMERIC (#6544)
Before this commit, we used setlocale(LC_NUMERIC, "");,
but that is not correct because it doesn’t nest:
load_layout.c (sets LC_NUMERIC=C) calls con_mark(),
which calls ipc_send_window_event() (sets LC_NUMERIC=C),
which calls setlocale(LC_NUMERIC, ""); when returning,
but now load_layout has LC_NUMERIC set per the environment,
whereas the function expects to remain in LC_NUMERIC=C.

Using newlocale and uselocale just swaps handles,
which is a little cleaner than querying the locale with
strdup(setlocale(LC_NUMERIC, NULL)); and restoring it later.

The test only fails with certain locales, e.g. LC_NUMERIC=de_DE.
I don’t think it’s important to set a locale in our test runner,
(which locales are available is very system-dependent),
as I am personally regularly testing with LC_NUMERIC=de_DE ;)

fixes https://github.com/i3/i3/issues/6391
2025-12-13 08:27:00 +01:00
072e2ffcf3 i3.desktop: set Type=XSession (#6460)
This fixes issues with display link displays not working on i3 and
should not affect any other features from my testing.

Co-authored-by: FedGuy699 <bytebustersco@gmail.com>
2025-12-12 20:40:31 +01:00
f231b3840d delete pseudo-doc.doxygen (#6536)
We only added that for people who use doxygen to browse code bases. That
was before the age of LSP support in editors, which does a much better
job of that nowadays.

Distributions like Fedora have for some reason started shipping the full
doxygen-generated HTML, which is many megabytes in size. This was never
our intent, so remove the file to prevent it.

fixes https://github.com/i3/i3/issues/6436
2025-12-06 10:05:59 +01:00
b1e99d8ff0 Chore: Code cleanup and style improvements (#6516)
This PR is a pure linting and code cleanup effort with no functional
changes, focusing on improving code quality and consistency.

The bulk of the changes involve:

* Code Formatting: The entire codebase was reformatted after updating
our `clang-format` version.
* Compiler Warnings: Addressed `-Wsuggest-attribute` warnings from GCC
by applying `pure`, `const`, and `format` attributes where appropriate.
This helps the compiler with optimizations and bug detection.
*   Code Modernization:
* Variable declarations were moved closer to their first use or into
tighter scopes.
* `memset` calls were replaced with C99 zero-initializers (`= {0}`).
* Redundant `struct` keywords, unnecessary type casts, and some
superfluous `return` statements were removed.
* CI Adjustments: The GitHub Actions workflow was updated to correctly
apply compiler flags for both GCC and Clang.
2025-11-07 09:49:03 +00:00
d674090f96 commands_parser.c: Make re-entrant (#6523)
Refactor to work with various for_window matching related issues

Depends on https://github.com/i3/i3/pull/6514
Related to https://github.com/i3/i3/issues/3588#issuecomment-544186208
Related to https://github.com/i3/i3/issues/4346
Related to https://github.com/i3/i3/issues/6037
Reverts commit 1cc2548027 / #6509
2025-11-07 08:18:36 +01:00
e035d0c658 Refactor: Extract parser stack implementation to parser_util (#6514)
The command and config parsers both used a similar stack implementation
for handling tokens. This resulted in duplicated code.

This commit extracts the common stack implementation (push/get/clear
functions for strings and longs) into a new `parser_util` module.

This resolves a long standing TODO comment.
2025-11-05 22:56:49 +01:00
197bad6f59 Update to clang-format-20 (#6521) 2025-11-05 22:46:34 +01:00
2711f427af Remove spurious character from hex code (#6500)
Fixes a small mistake in the color hex codes for i3-nagbar, where one of
the codes has an extra trailing zero.
2025-11-05 07:43:12 +00:00
14a84076aa commands: Simplify criteria matching by iterating over all_cons (#6515)
This avoids copying the list of all windows for each command.
2025-10-31 09:50:32 +01:00
c7344095ec Fix leak sanitizer memleaks (#6520)
```sh
export LSAN_OPTIONS=suppressions=lsan.supp
echo leak:libxcb.so >suppressions=lsan.supp
```

Before:
```sh
rg -l LeakSanitizer latest/i3-log-for-*
latest/i3-log-for-308-focus_wrapping.t
latest/i3-log-for-313-include.t
latest/i3-log-for-316-drag-container.t
latest/i3-log-for-525-i3bar-mouse-bindings.t
latest/i3-log-for-529-net-wm-desktop.t
latest/i3-log-for-533-randr15.t
latest/i3-log-for-538-i3bar-primary-output.t
```

After:
```sh
rg -l LeakSanitizer latest/i3-log-for-*
```

Closes: #4087
2025-10-31 07:38:41 +01:00
683c4f777e Ensure execl is followed by exit (#6510)
exec* calls return when an error occurs, this is unexpected but would
still leave the forked process in a broken state. This commit fixes that
by ensuring they are followed by an immediate exit.
2025-10-13 08:58:13 +02:00
5c321cc582 main: debug build: Avoid buffer over-read and simplify (#6507)
In theory, if `/proc/sys/kernel/core_pattern` is 1024 or more bytes, the
null character terminating the buffer can be overwritten.

Note: Found with [bugfinder](https://github.com/stanek-michal/bugfinder)
2025-10-08 17:49:16 +02:00
1cc2548027 271-for_window_tilingfloating: Fix flaky test (#6509)
Floating assignments run based on the _I3_FLOATING_WINDOW property which
means we have to go through X11 first.
2025-10-07 17:37:04 +02:00
45bfae0fc8 assignments: Avoid crash when using for_window reload (#6508)
Note: Found with [bugfinder](https://github.com/stanek-michal/bugfinder)
2025-10-07 17:36:09 +02:00
0d47ec22a9 randr: Avoid use-after-free in RandR <= 1.4 (#6506)
Before the xcb_randr_get_crtc_info() call fails, `new` has been already
added to `outputs with `TAILQ_INSERT_TAIL(&outputs, new, outputs);`.

Note: Found with [bugfinder](https://github.com/stanek-michal/bugfinder)
2025-10-07 17:34:57 +02:00
389cf064e6 randr: Fix memleak (#6505)
`sasprintf` always allocates `oname` but it is only conditionally freed.

Note: Found with [bugfinder](https://github.com/stanek-michal/bugfinder)
2025-10-07 17:33:07 +02:00
b3329fbb02 tiling_drag: Fix crash when performing tree_move (#6503)
tree_move calls tree_flatten which can destroy redundant containers.

An example reproduction would be V[H[a V[b]]] where V[b] is focused
(parent of b) and a is moved away using the DT_PARENT target.

Note: Found with [bugfinder](https://github.com/stanek-michal/bugfinder)
2025-10-07 17:32:15 +02:00
e8e063cf00 Fix AdressSanitizer failures in tests (#6502)
Example in
https://github.com/i3/i3/actions/runs/18260895234/job/51988635887?pr=6502
`i3-log-for-124-move.t`:
```
../libi3/font.c:332:9: runtime error: signed integer overflow: 2147483641 + 11 cannot be represented in type 'int'
    #0 0x5611ce962d65 in draw_text_xcb ../libi3/font.c:332
    #1 0x5611ce962d65 in draw_text ../libi3/font.c:376
    #2 0x5611ce95de20 in draw_util_text ../libi3/draw_util.c:219
    #3 0x5611ce947e7a in x_draw_decoration ../src/x.c:751
    #4 0x5611ce94f93a in x_push_node ../src/x.c:1097
    #5 0x5611ce94e9d8 in x_push_node ../src/x.c:1204
    #6 0x5611ce94e9d8 in x_push_node ../src/x.c:1204
    #7 0x5611ce94e9d8 in x_push_node ../src/x.c:1204
    #8 0x5611ce952e9b in x_push_changes ../src/x.c:1373
    #9 0x5611ce922d1f in tree_render ../src/tree.c:468
    #10 0x5611ce8d1bbb in handle_run_command ../src/ipc.c:220
    #11 0x5611ce8c87fe in ipc_receive_message ../src/ipc.c:1481
    #12 0x7effc262b64a in ev_invoke_pending (/lib/x86_64-linux-gnu/libev.so.4+0x564a) (BuildId: cfcffb10ff16734dcc7d31d002a90940abff0323)
    #13 0x7effc262f22e in ev_run (/lib/x86_64-linux-gnu/libev.so.4+0x922e) (BuildId: cfcffb10ff16734dcc7d31d002a90940abff0323)
    #14 0x5611ce809d48 in ev_loop /usr/include/ev.h:841
    #15 0x5611ce809d48 in main ../src/main.c:1229
    #16 0x7effc1e41ca7  (/lib/x86_64-linux-gnu/libc.so.6+0x29ca7) (BuildId: def5460e3cee00bfee25b429c97bcc4853e5b3a8)
    #17 0x7effc1e41d64 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29d64) (BuildId: def5460e3cee00bfee25b429c97bcc4853e5b3a8)
    #18 0x5611ce80e770 in _start (/usr/src/i3/build/i3+0x230770) (BuildId: 181abde9a3dd28a8a4be68b90b9b710c8e280633)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../libi3/font.c:332:9 
```

Unrelated but I fixed the build fails in `next` because of a
false-positive:
```
In file included from ../include/all.h:40,
                 from ../src/commands.c:10:
../src/commands.c: In function ‘cmd_floating’:
../include/log.h:30:33: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
   30 | #define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
      |                                 ^~~~~~~~~~~~~
../src/commands.c:1193:13: note: in expansion of macro ‘DLOG’
 1193 |             DLOG("should switch mode to %s\n", floating_mode);
      |             ^~~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.
```
2025-10-06 08:09:17 +02:00
ab6a75a693 fix libi3: in dpi retrieval function wrong variable used (#6466)
this is proposed fix for #6465

---------

Co-authored-by: Dmitry K <dmitry.k@siklu.com>
2025-10-03 14:12:50 +02:00
d1daf169bb GitHub Actions: stop pushing to Balto (they’re shutting down) (#6491)
fixes https://github.com/i3/i3/issues/6490
2025-08-29 18:30:55 +02:00
9fc24064e7 Fix paragraph separators cutting off titles (#6337)
Pango has the option to render paragraph separators and other special
characters as glyphs, which fixes the cutting off described in #5391.

https://docs.gtk.org/Pango/method.Layout.set_single_paragraph_mode.html
2025-07-09 06:56:55 +00:00
cfa4cf16be Set _NET_FRAME_EXTENTS according to the actual decoration size (#5944)
Inspired by #5384, but instead of just using the border width, this PR
reports the actual frame extents for the window, which may also include
the title bar (for floating windows and tiled windows in plain split
containers, but not for tiled windows in stacked/tabbed containers).

The existing `con_border_style_rect()` function should already handle
all configuration options which can affect the decoration sizes (if it
does not, that would also show up in other places); its result just
needs to be converted into the format used by the `_NET_FRAME_EXTENTS`
property.

This PR fixes #4292 probably in the best way possible (the reported
`_NET_FRAME_EXTENTS` values should always match the actual sizes of
window frame elements which are actually drawn into the X11 frame window
into which the client window is reparented). The only really problematic
case is with the stacked/tabbed containers, for which the title bar is
actually drawn into a completely separate window, therefore the title
bar size cannot be reported in `_NET_FRAME_EXTENTS` (actually I tried to
calculate the size of those decorations and add it to the top decoration
size, but that did not change the behavior of `picom`).

<details><summary>Large screenshots here (3840×2160)</summary>

Example of configuration with `hide_edge_borders smart` — a single
window does not have borders, so only the top frame size is non-zero:

![2024-03-09_21-41](https://github.com/i3/i3/assets/616082/d2f41206-89f8-465f-ba25-1f51075ba680)

but multiple windows have borders:

![2024-03-09_21-44](https://github.com/i3/i3/assets/616082/db7469e6-50eb-4687-83fd-88481691b361)

Changing border width works too (although with `border normal 8` you can
see that the top border overlaps the title text, because on the i3 side
that border does not really exists, and `picom` just draws it over; also
the pixel sizes reported by `xprop` and `xwininfo` are not identical to
what is specified in i3, because I use 168 dpi on this system, therefore
4 px in the i3 config = 7 dpx):

![2024-03-09_21-48](https://github.com/i3/i3/assets/616082/7f64d217-3218-4d03-ba15-3fe33e6161d1)

Handling of tabbed containers is less perfect though. Here is a single
tabbed container with `hide_edge_borders smart`, so it does not really
have a border — note that all frame extents are zero, and the titlebar
is rounded separately (although it could easily be excluded from
rounding, that does not really help much):

![2024-03-09_22-02](https://github.com/i3/i3/assets/616082/c6ea1106-b1d7-43b8-8354-bc6fbf45d87a)

Once the border actually appears, you may notice that the top part of
the `picom` border actually gets drawn over the top part of the window,
partially obscuring the top line in this terminal (`picom` does not mind
that the top frame size is reported as 0):

![2024-03-09_22-04](https://github.com/i3/i3/assets/616082/eb80fc5c-fa52-43f4-857e-94dc713221bf)

Some examples of floating windows (no major problems there):

![2024-03-09_22-09](https://github.com/i3/i3/assets/616082/3336c1cb-ee48-46ae-ab89-061be46bdb31)

Options like `hide_edge_borders both` work too when gaps are removed
(although the resulting behavior with `picom` is probably not very
useful — the rounded border gets drawn only if all of the left, bottom
and right borders are present):

![2024-03-09_22-15](https://github.com/i3/i3/assets/616082/9961db74-7c49-43f0-a90f-e9ab81474038)

The same with `border pixel 8` (note that windows with only the top
border hidden still get the rounded border treatment by `picom`, but the
border overlaps the top part of the window):

![2024-03-09_22-21](https://github.com/i3/i3/assets/616082/dd0a0fc6-701d-4e01-ba96-f3eb5131c95b)

</details>

---------

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
Co-authored-by: Orestis Floros <orestisflo@gmail.com>
2025-04-21 23:26:17 +02:00
44b67d1126 Fix typos via codespell (#6415)
There are some typos in the documentation, messages, etc.
Fix them via codespell.
2025-03-21 12:48:29 +00:00
853b0d9161 i3bar: fix clang compilation error by using const size_t (#6349)
Thanks to Shouη (@Shoun2137 on GitHub) for the suggestion.
2024-12-30 08:29:29 +01:00
9dc5230000 Update meson setup command to remove warning (#6338)
This is a very easy fix, to remove the following warning:
```
WARNING: Running the setup command as `meson [options]` instead of `meson setup [options]` is ambiguous and deprecated.
```
The fix is to just run `meson setup` instead and it works like a charm.

Related PRs: i3/i3lock#365 and i3/i3status#538.
2024-12-29 19:50:09 +01:00
2746e0319b i3bar: work around weird clang compiler behavior
clang used to not warn (= error, with -Werror) about this line. Oh well.
2024-11-06 19:22:15 +01:00
e107254f1e GitHub Actions: update actions/upload-artifact to v4
The older versions are now deprecated and result in failing GitHub Actions runs.
2024-11-06 19:22:15 +01:00
2f9ffa3178 debian: update changelog 2024-11-06 18:34:21 +01:00
d64e5df5b4 Merge branch 'release-4.24' 2024-11-06 18:27:13 +01:00
454fb63392 Restore non-git version suffix 2024-11-06 18:27:13 +01:00
4a42eb085c release i3 4.24 4.24 2024-11-06 18:26:52 +01:00
4661e74b5e Fix: remove "dynamic" TWM (#6193)
related to https://github.com/i3/i3.github.io/issues/137
2024-08-05 18:23:55 +02:00