45 Commits

Author SHA1 Message Date
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
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
Michael Stapelberg
c8158875b4
default config: use dex for XDG autostart (#4405)
fixes #4402
2021-04-17 15:26:45 +02:00
lbonn
496364fdbf ipc: return signed int for container positions
If we use json as a language-agnostic representation, it makes sense to
use proper signed integers here.
2021-04-10 14:17:00 +02:00
Orestis Floros
5df0b4b571
Merge pull request #4336 from tbgiles/next
Clear framebuffer for containers with visible windows
2021-02-07 19:10:23 +01:00
Orestis Floros
8ff8db3c36
Accept multiple outputs in move container|workspace to output
Fixes #4337
2021-02-06 11:00:16 +01:00
Tristan Giles
09e2bdaeba Clear framebuffer on containers that are visible windows 2021-01-30 22:44:43 -08:00
Orestis Floros
ef12e9a5ab
Merge pull request #4331 from ImranVirani/patch-1
Properly quote rofi call in i3 config
2021-01-29 16:20:15 +01:00
Imran Virani
60213accae
Properly quote rofi call in i3 config 2021-01-29 14:01:51 +01:00
Albert Safin
32c10a19f2
Add "machine" criterion to match WM_CLIENT_MACHINE
Closes #3981

Add "%machine" title_format placeholder
Add "machine" to the IPC and layout saving/restoring
2021-01-28 12:52:10 +01:00
Orestis Floros
8c8d5dc019
Revert "Clear framebuffer before drawing borders (#4308)"
This reverts commit 057a63527969598ad2301a1df5f5589c8e63cce5.
2021-01-25 08:13:15 +01:00
Michael Stapelberg
dcd6079c9b i3-dump-log -f: switch from pthreads to UNIX sockets
fixes #4117
2021-01-20 21:40:24 +01:00
Orestis Floros
ba134d3c7c
i3bar: Exit with 1 on wrong argument 2021-01-15 23:35:31 +01:00
Orestis Floros
6e0b29a65b
i3bar: properly restart status command after config change 2021-01-12 08:56:38 +01:00
Orestis Floros
0370c5e297
i3bar: Properly close FDs 2021-01-12 08:35:41 +01:00
Orestis Floros
31580ddc7f
Merge pull request #4231 from orestisfl/i3bar-default-bar_id
i3bar: Add default bar_id
2021-01-03 19:49:25 +01:00
Orestis Floros
c1ec2ad19b
i3bar: Add default bar_id
Instead of erroring, request the list of bar configs from i3 and use the
first one.
2021-01-03 10:17:43 +01:00
Orestis Floros
2a2c350eb6
Add release note for framebuffer fix
#4308
2021-01-03 09:48:27 +01:00
Orestis Floros
5bf58a4c87
Revert "Clear pixmap to black before starting to draw" 2021-01-03 01:11:21 +01:00
Tristan Giles
337dd653ae
Clear framebuffer before copying surface to prevent visual garbage
Fixes #3481
2021-01-02 23:54:11 +01:00
Orestis Floros
3f063bcb6f
Comment-out duplicate i3-dmenu-desktop bindcode
Fixes #4304
2021-01-02 21:54:36 +01:00
Tudor Brindus
f2ec5a4e77 Implement context-sensitive tab-clicking behavior
This commit makes it so that when clicking on a tab for the first time,
its inactive-focused child is focused. This matches i3 behavior when
scrolling on tabs.

A second click on the tab titlebar focuses the tab container itself.

Subsequent clicks cycle between these two states.

Closes #4225.
2021-01-01 16:04:33 -05:00
Anaël Beutot
d539c6e288 Fix workspace assignements after output changes
Fix #4261

The previous method was modifying the same list it was iterating upon
causing an erronous iteration and thus not every workspace got assigned
back to were they should (only the first one).
2020-12-30 23:01:50 +01:00
ekarpp
b6690045ed
i3-nagbar: add possibility to open bar on focused monitor
Closes #3692

i3-nagbar will open by default on the monitor with input focus and using the flag -p on the primary monitor.
2020-11-29 22:36:49 +01:00
Orestis Floros
68258785ac
create_workspace_on_output: Prevent duplicate workspace nums
When going through the `binding_workspace_names` to prioritize
user-specified names, we only check if the workspace exists, not the
workspace number. If the user specified a `bindsym … workspace number X`
directive, then it is appended in `binding_workspace_names` and a
workspace is created using that number even though from the POV of a
user that uses numbers to change workspaces, that workspace already
exists.

In similar code here:
1d9160f2d2/src/workspace.c (L997)
we do the check.

Fixes #4238
2020-11-28 23:22:55 +01:00
Michael Stapelberg
4b1ea08eef
release.sh and release notes changes post-release (#4258) 2020-11-15 19:22:09 +01:00
Michael Stapelberg
969e6bc8c4 release i3 4.19 2020-11-15 18:23:00 +01:00
Wilhelm Schuster
c246f176eb Add regression test for #3888 2020-11-10 17:16:56 +01:00
Maxim Schuwalow
90e7a156a2
i3bar: add support for nonprimary output
Added a new output option `nonprimary` that causes the bar to be
displayed on all outputs except the primary one.

Fixes #4083
2020-10-24 11:44:34 +02:00
Andrey Burov
60384d446b Add coordinates relative to the current output in i3bar click events
Currently i3bar click events provide x and y coordinates relative to all monitors.
I've added coordinates relative to the current output.

+-----------+-----------+
|           |   i3bar   |
|           +-----------+
|   HDMI-0  |    DP-0   |
| 1920x1080 | 2560x1080 |
+-----------+-----------+

When you click in the top right corner of the DP-0,
i3bar will provide something like this:

{
  "x": 4480,
  "y": 10,
  "output_x": 2560,
  "output_y": 10,
}

This is useful for creating a rofi menu or something else.
rofi -show run -location 1 -xoffset ${I3_OUTPUT_X} -yoffset ${I3_OUTPUT_Y}
2020-10-23 12:51:21 +03:00
acheronfail
fae10f6df7 allow ppt values in move direction and move position commands
make ppt values clear in userguide

chore: move is_ppt and DLOG out of TAILQ_FOREACH loop
2020-10-20 17:48:26 +11:00
Alessandro Vinciguerra
9e059ccc55
Add situational exit codes (#4107)
Add situational exit codes

Distinguish user canceled and other errors
Closes #3705
2020-10-20 09:38:35 +02:00
Orestis Floros
b6024122dc
Fix conflicting workspace assignments when renaming
The bug here is that workspace assignments with numbers are triggered
even if a named argument matches later on.

With this commit, get_assigned_output is called to correctly iterate the
workspace assignments.

Fixes #4021
2020-10-18 17:28:55 +02:00
Orestis Floros
0d5a7eeff8
init_ws_for_output: Change loop that assigns existing workspaces
I find the new loop more straightforward and easy to understand.

Old loop used to be:
    foreach assignment:
        foreach assignment2:
            // find if this is the first valid output in this assignment
        foreach workspace:
            // find matching by assignment name
        if workspace:
            move workspace to output
New loop is:
    foreach workspace:
        foreach assignment:
            if workspace is assigned to this output:
                move workspace to output

With this, workspace assignments triggered by numbers during output
changes should be handled correctly.

Fixes #3685
2020-10-18 17:28:53 +02:00
Orestis Floros
025743eaf9
Fix i3bar Xorg memory leak (#4140)
The `*_free_*` calls in this branch:
51b0583578/i3bar/src/xcb.c (L1854)
are never called when we remove the output from the tailq during a
refresh.

Fixes #4123
2020-06-27 00:10:53 +02:00
Michael Stapelberg
b402ce2cc9 binding state post-submit review fixes 2020-06-16 22:28:58 +02:00
Orestis Floros
4d9c3131ad
_con_move_to_con: Traverse below con to check for fullscreen
Fixes #4124
2020-06-10 03:44:02 +02:00
Orestis Floros
78595f1f68
Improve handling of nagbar processes
Other changes in nagbar_exited:
- Remove ERROR from ELOG as it shows up as "ERROR: ERROR:"
- Make sure to reset the PID even when the process did not exit
normally.
- Use ELOG when exitcode != 0
- Remove the not found error: if nagbar is not in $PATH, exec_i3_utility
prints an error as well.

For the record, I also implemented a more complicated approach with a
new watcher data structure:
bd3aaf3a33
While writing the commit message, it occurred to me to compare
watcher->pid with *watcher->data, which fixes the problems mentioned in
that patch.

Fixes #4104
2020-05-24 13:04:33 +02:00
Michael Stapelberg
aba6ec3e52
add meson build files (#4094)
Motivation:

• faster builds (on an Intel Core i9-9900K):
  ( ../configure --disable-sanitizers && make -j8; )
  19,47s user 2,78s system 395% cpu 5,632 total

  ( meson .. -Dmans=true -Ddocs=true -Dprefix=/usr && ninja; )
  38,67s user 3,73s system 1095% cpu 3,871 total

• more approachable build system configuration in the
  python-esque meson domain specific language instead of
  the autotools m4 macro language

• built-in language server support thanks to ninja:
  the required compile_commands.json is built automatically
  and only needs to be linked from the source dir, e.g.:
  ln -s build/compile_commands.json .

Changes:

• the embedded vcs version info format changed from e.g.
  4.18-282-gabe46f69 (2020-05-16, branch "next")
  to:
  4.18-282-gabe46f69
  I think it’s better to lose a little bit of detail for
  the gained cleanliness of using meson’s vcs_tag()

• Drop unused xcb-event dependency.

• We can no longer enable sanitizers and debug options
  based on whether we are in a release or non-release build,
  because our new version logic runs at ninja build time,
  not at meson configure time.

  The new behavior is probably for the better in terms of
  what people expect, and we can make the CI use address sanitizer
  explicitly to ensure it is still exercised.

• We lose the AX_EXTEND_SRCDIR behavior, i.e. including the
  path component of the parent of the source dir in all paths.
  This was a trick we used for easier debugging, so that stack
  traces would contain e.g. ../i3-4.18.1/src/main.c, instead of
  just src/main.c.

  The other mechanism (_i3_version symbol) that we have for including
  the version number in the “backtrace full” (but not merely
  “backtrace”) output of gdb still works.

• Release tarballs now use tar.xz. Why not.

Migration plan

This commit adds the meson build files to the tree, but does not remove
autotools yet. For the development phase, we will keep both build systems
functional (and built on travis).

Then, just before the i3 v4.19 release, we will remove autotools from the tree
and the release tarball will require meson to compile.

This way, we incentivize maintainers to change, while also offering them an easy
way out (if desired) by reverting the most recent commit. In practice, switching
a distribution package from autotools to meson should only be a few line change,
easier than applying the provided patch :). Take a look at the debian/ changes
in this commit for an example.

meson is broadly available everywhere that i3 is available: Both xorg-server and
systemd gained meson build files in 2017, so we can follow suit:
https://anholt.livejournal.com/52574.html
https://in.waw.pl/~zbyszek/blog/systemd-meson.html

How do I?

For producing a coverage report, enable the b_coverage meson base option
and run ninja coverage-html:
% cd build
% meson .. -Db_coverage=true
% ninja
% ninja test
% ninja coverage-html
See also https://mesonbuild.com/howtox.html#producing-a-coverage-report

For using the address sanitizer, memory sanitizer or undefined behavior
sanitizer, use the b_sanitize meson base option:
% cd build
% meson .. -Db_sanitize=address
% ninja
See also https://mesonbuild.com/Builtin-options.html#base-options

related to #4086
2020-05-19 14:45:06 +02:00
Orestis Floros
f63a4bef54
cmd_bar improvements (#4014)
- Split cmd_bar into 2 functions, improving errors and reducing strcmps
- Only update barconfig when something has changed
- Only update barconfig for the specific bar that has changed

Fixes #3958
2020-05-07 09:22:03 +02:00
Orestis Floros
142b3fa945
Merge pull request #4054 from orestisfl/randr-ewmh
randr_query_outputs: call ewmh_update_desktop_properties
2020-05-06 17:32:45 +02:00
Orestis Floros
94b619e118
randr_query_outputs: call ewmh_update_desktop_properties
Fixes #4053
2020-05-06 17:26:49 +02:00
Orestis Floros
9a1c272900
Mention rofi in default config file
Fixes #2482
2020-05-06 17:25:52 +02:00
Orestis Floros
6a37114af1
Makefile.am: Use BUILT_SOURCES for GENERATED headers (#4068)
The previous fix when using _DEPENDENCIES was wrong because that
dependency is only created for the final executable. However, the build
fails when building the object file. The manual explicitly mentions that
using _DEPENDENCIES is wrong for source files:
> In rare cases you may need to add other kinds of files such as linker
> scripts, but listing a source file in _DEPENDENCIES is wrong. If some
> source file needs to be built before all the components of a program
> are built, consider using the BUILT_SOURCES variable instead (see
> Sources).
https://www.gnu.org/software/automake/manual/automake.html#Linking

Instead, using BUILT_SOURCES works, as mentioned in the manual.
https://www.gnu.org/software/automake/manual/automake.html#Sources

I have also removed the dependencies from i3_SOURCES since AFAIK
dependencies to header files don't do anything. I have verified that
modifying the header correctly re-triggers the build for i3 &
i3-config-wizard.
> Header files listed in a _SOURCES definition will be included in the
> distribution but otherwise ignored. In case it isn’t obvious, you
> should not include the header file generated by configure in a
> _SOURCES variable; this file should not be distributed. Lex (.l) and
> Yacc (.y) files can also be listed; see Yacc and Lex.
https://www.gnu.org/software/automake/manual/automake.html#Program-Sources

An alternative instead of BUILT_SOURCES that should also work in our
case is found in this section:
https://www.gnu.org/software/automake/manual/automake.html#Built-Sources-Example
see "Recording Dependencies manually". The syntax would be:
    foo.$(OBJEXT): $(config_parser_SOURCES) $(command_parser_SOURCES)
The benefit of this over BUILT_SOURCES is that it will work for targets
other than 'all', 'check' and 'install'. However, since we don't really
have such targets we don't need to do this right now.

Tested extensively using this script:
    #!/bin/bash
    set -x

    autoreconf -fi
    while mkdir build && cd build && ../configure && make -j; do
        cd ..
        rm -rf build
    done

Fixes #3670
2020-05-05 18:13:19 +02:00
Orestis Floros
5f9cbb12b8
Add RELEASE-NOTES for next release (#4046)
* Add RELEASE-NOTES template for next

The placeholder items are useful instead of having to find the •
character for every new release.

Closes #4040

* Remove leftover bugfix release notes from tree
2020-04-30 21:07:11 +02:00