Commit Graph

7484 Commits

Author SHA1 Message Date
Orestis Floros
d3ff9afbb5
Merge pull request #4436 from psychon/check-cairo-status
Check cairo status in draw_util_surface_free()
2021-09-16 19:07:07 +02:00
Uli Schlachter
d2f5e7e46e Fix a minor memory leak
When xcb_request_check() returns an error, something has to clean up and
free this error.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-09-15 18:14:37 +02:00
Uli Schlachter
2e500f0817 Check cairo status in draw_util_surface_free()
When "something goes wrong" in cairo-land, the corresponding cairo
object goes into an error state. These errors are sticky. Thus, it is
enough to check for errors before destroying the context.

This commit adds a check in draw_util_surface_free() to check the cairo
context's status and print a log message if anything is wrong.

The idea here is to help debugging drawing issues. Instead of "nothing
visible", the corresponding log message hopefully helps debugging.

This code would have saved me lots of time in figuring out why my pull
request #4379 did not work.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-09-15 18:14:37 +02:00
Ingo Bürk
a0938bd606
Update docs to Discussions (#4503) 2021-09-10 09:18:01 +02:00
Ingo Bürk
3686cef63c
Merge pull request #4469 from vincentbernat/fix/handler-xrandr
handlers.c: send an "output" event on monitor configuration change
2021-09-10 08:09:32 +02:00
Vincent Bernat
381d7e6a98 doc: fix version number in release notes 2021-09-10 08:04:59 +02:00
Vincent Bernat
f9e6d5dd7a handlers.c: send an "output" event on monitor configuration change
When adding/removing a monitor, the outputs are likely to be modified.
Send an IPC event "output", like when there is a screen configuration
change.

Signed-off-by: Vincent Bernat <vincent@bernat.ch>
2021-09-10 08:04:38 +02:00
Ingo Bürk
3d2a1ef80a
Merge pull request #4502 from orestisfl/discussion-template
Add option to start a new discussion in the templates
2021-09-10 07:18:58 +02:00
Ingo Bürk
570138eb72
Merge pull request #4501 from orestisfl/window-logs
Make window id logging hex everywhere
2021-09-10 07:17:27 +02:00
Orestis Floros
e1ca00d164
Add option to start a new discussion in the templates 2021-09-10 00:51:19 +02:00
Orestis Floros
af23c0febf
Make window id logging hex everywhere
Right now some logs use %d and some use %08x and it can be confusing to
follow.
2021-09-09 21:05:24 +02:00
Orestis Floros
ce2c21885d
Merge pull request #4497 from orestisfl/icons-title-align
Make window icons follow title alignment
2021-09-09 09:27:30 +02:00
Orestis Floros
cc44d9a999
Make window icons follow title alignment
Fixes #4464.

Inspired by changes from #4453 but I didn't end up using the original
code.

For ALIGN_LEFT and ALIGN_CENTER icon offset is calculated first and then
title offset is based on that. For ALIGN_RIGHT title offset is
calculated first but we make sure that the icon fits in the window.

Additionally, icons will now hide if there is not enough space to render
them + their padding. Realistically, this won't happen in normal
usecases.

Effectively, icons have higher precedence over text: draw_util_text will
hide text when it exceeds the max width and the code takes this into
consideration. Icons will only hide when they can't fit at all, not in
order to assure that the text can be displayed fully.
2021-09-09 08:51:14 +02:00
Ingo Bürk
579973b1ef
Merge pull request #4499 from orestisfl/gh-actions-logs
GH actions: Archive complete logs on test failure
2021-09-08 07:26:20 +02:00
Ingo Bürk
f45d5d1a53
Merge pull request #4498 from orestisfl/memleak
Free window role & machine
2021-09-08 06:41:30 +02:00
Orestis Floros
3ba7599aa4
GH actions: Archive complete logs on test failure
https://docs.github.com/en/actions/reference/usage-limits-billing-and-administration#artifact-and-log-retention-policy

> By default, the artifacts and log files generated by workflows are
> retained for 90 days before they are automatically deleted.
2021-09-08 00:05:11 +02:00
Orestis Floros
8649a7e229
Free window role & machine 2021-09-07 22:52:14 +02:00
Ingo Bürk
3bdea50548
Merge pull request #4495 from kgilmer/config-directives-no-file-no-error
Lower severity of missing include path specified from error to info.
2021-09-06 12:18:34 +02:00
Ken Gilmer
46cffcc059 Lower severity of missing include path specified from error to info. Addresses https://github.com/i3/i3/issues/4494. 2021-09-05 22:14:25 -07:00
Ingo Bürk
986292c662
Merge pull request #4491 from i3/orestisfl-patch-1
Add #4409 to release notes
2021-09-01 07:48:40 +02:00
Orestis Floros
603e26baa8
Add #4409 to release notes 2021-08-31 23:58:10 +02:00
Orestis Floros
9a02399cee
Merge pull request #4454 from vincentbernat/feature/i3-notify
main: signal readiness by notifying systemd
2021-08-30 15:26:58 +02:00
Vincent Bernat
5b6a564190 main: signal readiness by notifying systemd
This is useful if we want to be able to start some services depending
on i3, notably some script using the socket or third-party bars like
polybar. To make use of this change, user is expected to use the
following stanza:

```
[Unit]
Description=i3 window manager
PartOf=graphical-session.target

[Service]
Type=notify
ExecStart=/usr/bin/i3
ExecStopPost=/bin/systemctl --user stop graphical-session.target
Restart=on-failure
```

Something similar is already possible using socket activation. For
example, we could use:

```
[Unit]
Description=i3 window manager socket
PartOf=graphical-session.target

[Socket]
ListenStream=%t/i3.sock
ExecStartPost=/bin/systemctl --user set-environment I3SOCK=%t/i3.sock
```

And other units could `Requires=i3.socket`. Unfortunately, not
everything is using I3SOCK. Notably, `i3 --get-socketpath` does not
and that's what i3ipcpp is doing. An alternative would be to patch `i3
--get-socketpath` to use I3SOCK if present, however, this may be a bit
risky. Should we check the environment variable first or the root
attribute?

Another alternative not requiring any modification is to have a
dedicated `i3-session.target`:

```
[Unit]
Description=i3 session
BindsTo=graphical-session.target
Wants=wallpaper.service
Wants=wallpaper.timer
Wants=polybar.service
Wants=i3-companion.service
```

And trigger it from i3:

```
exec_always --no-startup-id systemctl --user start --no-block i3-session.target
```

The proposed change being quite small, it seems harmless and
low-maintenance.

Signed-off-by: Vincent Bernat <vincent@bernat.ch>
2021-08-30 15:20:04 +02:00
Uli Schlachter
7b6e864823
Implement support for the WM_Sn selection (#4374)
Closes #536

When the WM_Sn selection is already owned at startup, this now either
errors out or waits for the old selection owner to exit.
2021-08-28 01:01:38 +02:00
Jeff Smith
01ba240272 Fix bug where long commands crash i3
Commands with more than 10 words would result in i3 crashing. The root
cause is that the stack which holds arguments with identifiers is
only 10 big, but generate-command-parser.pl was giving every word an
identifier of "".
2021-08-24 16:34:30 -05:00
Michael Stapelberg
36ba1043d5
ipc: document scratchpad_state (#4466)
fixes https://github.com/i3/i3/issues/4465
2021-07-30 22:48:40 +02:00
Ingo Bürk
fee005bc87
Merge pull request #4460 from iscgar/isaac/all-criterion
Implement 'all' matching criterion
2021-07-26 08:05:25 +02:00
Isaac Garzon
3a818c0f20 Implement 'all' matching criterion
This criterion matches all open windows, as a more readable (and
correct) version of the 'class=".*"' criterion (more correct because
it'll also match windows which don't have WM_CLASS set yet).
2021-07-24 22:18:58 +03:00
tomty89
fc65ca36b1
Use mkdirp() in get_process_filename() (#4397)
Avoids race condition in case multiple i3 instances are started in parallel with e.g. systemd user units for multiple X(vfb) servers.
2021-07-05 17:21:21 +02:00
Michael Stapelberg
abbf6a85d7
Implement showing window icons in titlebar (#4439)
This feature defaults to off, and can be turned on for individual windows,
or (with for_window) for all new windows. See the userguide change.

This commit is partially based on work by:

• Marius Muja
• mickael9
• Esteve Varela Colominas
• Bernardo Menicagli
2021-06-13 08:35:52 +02:00
Michael Stapelberg
eaa5e636f9
Implement include config directive (#4420)
The implementation uses wordexp(3) just like sway:
https://github.com/i3/i3/issues/1197#issuecomment-226844106

Thanks to jajm for their implementation at
bb55709d0a

This required refactoring the config parser to be re-entrant
(no more global state) and to return an error instead of dying.

In case a file cannot be opened, i3 reports an error but proceeds with the
remaining configuration.

Key bindings can be overwritten or removed using the new --remove flag of the
bindsym/bindcode directive.

All files that were successfully included are displayed in i3 --moreversion.

One caveat is i3 config file variable expansion, see the note in the userguide.

fixes #4192
2021-06-02 21:01:43 +02:00
Ingo Bürk
4c93f61353
Merge pull request #4430 from stapelberg/actions
README: update build status badge for GitHub Actions
2021-05-23 16:35:38 +02:00
Michael Stapelberg
e4b3f46366 README: update build status badge for GitHub Actions 2021-05-23 16:06:13 +02:00
Michael Stapelberg
c94f41b2da
switch from Travis to GitHub actions for continuous integration (CI) (#4428) 2021-05-23 15:44:28 +02:00
Vladimir Panteleev
e44aa7a9a9 docs/ipc: Explicitly state null as a possible type
This helps write correct descriptions of the JSON schema for strongly
typed languages that support deserializing to native types (and
require a different type for null).
2021-05-20 21:47:43 +02:00
Vladimir Panteleev
d4c23ec24b docs/ipc: Add descriptions of all message payloads
These seemed to be inconsistently specified.

Particularly, the "SYNC" message payload was not described anywhere.

Even when the payload is empty, it is helpful to specify that
explicitly, as it prevents the reader from having to guess whether if
it's really empty, or otherwise somehow implicitly obvious.

The "Reply format" section is now "Messages and replies", and covers
both the reply format and the format of sent messages.
2021-05-20 21:47:43 +02:00
Vladimir Panteleev
8db3bef66d docs/ipc: Explicitly state that reply types correspond to message types
Help avoid some squinting to make sure everything actually matches.
2021-05-20 21:47:43 +02:00
Vladimir Panteleev
63099f7a83 docs/ipc: Fix inconsistent whitespace 2021-05-20 21:47:43 +02:00
Vladimir Panteleev
1f75e8d321 docs/ipc: Re-order and clarify reply format
- Make sure to place the description of the packet before the
  description of the payload.

- Describe the relationship of messages and replies.

- Add note on pipelining.
2021-05-20 21:47:43 +02:00
Vladimir Panteleev
73bcbbe1b1 docs/ipc: Fix grammar
Add missing "it". Also add two instances of "a", which sounds more
correct to me.
2021-05-20 21:47:43 +02:00
Vladimir Panteleev
bb6ee88440 docs/ipc: Clarify i3 --get-socketpath text 2021-05-20 21:47:43 +02:00
Kjetil Torgrim Homme
2245db63ab
add cross reference to directive default_border from command border (#4273)
Added a couple of examples to make usage clearer with a cursory glance.
2021-05-20 21:47:20 +02:00
Uli Schlachter
d65a7ed250
Drop xcb_flush() before xcb_aux_sync() (#4378)
xcb_flush() flushes xcb's output buffer. Thus, after this call, all
previous requests are surely written to the connection with the X11
server.

xcb_aux_sync() synchronises with the X11 server. It makes sure all
previous requests were sent to the X11 server and already processed. It
does this via free(xcb_get_input_focus_reply(xcb_get_input_focus())): It
sends a request and waits for its reply. It is guaranteed that the X11
server processes requests in-order.

This means that the sequence xcb_flush(); xcb_aux_sync() first writes
whatever is in the output buffer and then does another write for the
four bytes of the GetInputFocus request from xcb_aux_sync().

Put differently: xcb_flush(); xcb_aux_sync() doesn't do anything more
than just xcb_aux_sync(). In fact, it has slightly more overhead for the
same result.

Thus, this commit drops all calls to xcb_flush() immediately after
xcb_aux_sync().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-20 21:44:13 +02:00
Uli Schlachter
60542da091
Do not "set" the wallpaper during startup (#4373)
"Set" the wallpaper during startup only sometimes

Since commit 4f5e0e7, i3 would take a screenshot and set that as the
background pixmap of the root window during startup. This is the easy
part of setting a proper X11 wallpaper.

The code in question was added because something either set the
background pixmap of the root window to NONE or the X11 server was
started with "-background none". This is apparently done by default by
e.g. gdm to avoid some flickering while the X11 server starts up.

This commit makes this code conditional: Only when no wallpaper is
detected is a screenshot taken.

Since I could not find any way to query the background of a window, a
more direct approach is taken to detect this situation: First, we find
some part of the root window that is not currently covered. Then we open
a white window there, close it again and grab a screenshot. If a
wallpaper is set, the X11 server will draw this wallpaper after the
window is closed and something else will be visible in the screenshot.

However, the wallpaper could have a white pixel at the tested position.
Thus, this procedure is repeated with a black window.

Only when this procedure produces two different pixel values is a
screenshot taken and set as the wallpaper.

Fixes: https://github.com/i3/i3/issues/4371
Fixes: https://github.com/i3/i3/issues/2869
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-20 21:37:35 +02:00
j-jzk
fcae64f7fd
Increase test timeout (#4416)
Default of 30 seconds can time-out on slower hardware
2021-04-29 15:59:23 +02:00
Ingo Bürk
91e751d5a2
Merge pull request #4411 from alarsyo/fix-broken-pango-link
docs: fix broken link to Pango documentation
2021-04-26 16:29:32 +02:00
Antoine Martin
00d4836ee4 docs: fix broken link to Pango documentation 2021-04-26 16:13:27 +02:00
Michael Stapelberg
9db03797da
fix crash with “layout default”: ipc.c won’t dump L_DEFAULT layout (#4409)
fixes #4408
2021-04-20 09:04:07 +02:00
Michael Stapelberg
c8158875b4
default config: use dex for XDG autostart (#4405)
fixes #4402
2021-04-17 15:26:45 +02:00
Ingo Bürk
9bf9cb9926
Merge pull request #4377 from lbonn/signed-container-positions
ipc: return signed int for container positions
2021-04-10 16:24:43 +02:00