Commit Graph

562 Commits

Author SHA1 Message Date
ba134d3c7c i3bar: Exit with 1 on wrong argument 2021-01-15 23:35:31 +01:00
6668d03157 i3bar: LOG version on startup 2021-01-15 23:28:33 +01:00
1a29b28fa5 i3bar: No reason to get_workspaces after output event
got_output_reply() requests this information anyway and if it is
received before the output reply, the information will be erased by
get_output_reply().
2021-01-12 08:56:38 +01:00
6e0b29a65b i3bar: properly restart status command after config change 2021-01-12 08:56:38 +01:00
0370c5e297 i3bar: Properly close FDs 2021-01-12 08:35:41 +01:00
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
fb5d2a05c2 i3bar: Update manpage/help with options 2021-01-03 10:17:39 +01:00
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
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
e3a1c5b294 clang-format: use TypenameMacros
This commit removes line breaks and extra empty lines introduced in
commit fff3f79da9.
2020-10-20 09:36:44 +02:00
f33a49372f i3bar: Remove duplicate call to kick_tray_clients (#4163)
Fixes #4159
Fixes #4162
2020-08-31 08:58:46 +02:00
6bb01bbe83 Merge branch 'stable' into next 2020-07-26 10:11:49 +02:00
68904aeb38 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-07-22 09:33:19 +02:00
838b600fea kick tray clients before destroying the bar 2020-06-30 04:34:32 -04:00
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
81671d454e Call cont_child() more liberally (#3996)
Following the reproduction instructions from
https://github.com/i3/i3/issues/3242#issuecomment-436175346

For me, #3242 happened when the following sequence executed:
1. Fullscreening window correctly calls `stop_child()` in
6e24e2ad6f/i3bar/src/xcb.c (L685)
2. Xrandr change, `reconfig_windows()` is called and `output->visible` is
set to `true` in this line:
6e24e2ad6f/i3bar/src/xcb.c (L1791)
3. When the window's fullscreen is disabled,
`handle_visibility_notify()` returns in this line:
6e24e2ad6f/i3bar/src/xcb.c (L677)
because previously `output->visible` was set to `true`

To fix this, I call `cont_child()` more leniently since it is a no-op
when the child is not stopped.

Fixes #3242
Closes #3761
2020-04-22 08:55:41 +02:00
d614f26906 Fix SEGFAULT when i3bar receives invalid input
Fixes #3844
2020-04-22 08:54:51 +02:00
0b62129224 Remove unused headers
With help from
https://github.com/include-what-you-use/include-what-you-use/
2020-04-20 04:25:06 +02:00
3c522d9f2f Sort includes in *.c files
Not enabling in .clang-format because it breaks headers files.

Used:
    IncludeCategories:
      - Regex:           '^<config'
        Priority:        0
      - Regex:           '^".*"'
        Priority:        1
      - Regex:           '^<(xcb|xkb|yajl|X11)'
        Priority:        3
      - Regex:           '.*'
        Priority:        2
2020-04-19 09:58:25 +02:00
7df88f18eb Sort dock clients by class and instance
This is similar to #3820 but does not use qsort but an insertion sort in
con_attach.

Since each bar block automatically gets its own incremental bar id,
bards end up being sorted according to their definition order in the
config file.

For i3bar, the WM_CLASS is modified to include an instance name which
depends on the bar_id. This could be useful for other reason, e.g. users
targeting a specific bar instance.

Fixes #3491
2020-04-14 20:47:51 +02:00
4212fb6488 i3bar: Set WM_CLASS instance to bar_id 2020-04-14 20:46:49 +02:00
e2b2a28625 Merge pull request #4004 from orestisfl/i3bar-segfault
Fix SEGFAULT when i3bar receives invalid input
2020-04-10 14:00:51 +02:00
91ec14f2bc Fix SEGFAULT when i3bar receives invalid input
Fixes #3844
2020-04-10 11:38:19 +02:00
40697a233c i3bar: Add a macro to log child info
Mentioned in #3242
2020-04-10 03:22:34 +02:00
016d4a3f45 Call cont_child() more liberally (#3996)
Following the reproduction instructions from
https://github.com/i3/i3/issues/3242#issuecomment-436175346

For me, #3242 happened when the following sequence executed:
1. Fullscreening window correctly calls `stop_child()` in
6e24e2ad6f/i3bar/src/xcb.c (L685)
2. Xrandr change, `reconfig_windows()` is called and `output->visible` is
set to `true` in this line:
6e24e2ad6f/i3bar/src/xcb.c (L1791)
3. When the window's fullscreen is disabled,
`handle_visibility_notify()` returns in this line:
6e24e2ad6f/i3bar/src/xcb.c (L677)
because previously `output->visible` was set to `true`

To fix this, I call `cont_child()` more leniently since it is a no-op
when the child is not stopped.

Fixes #3242
Closes #3761
2020-04-09 10:43:48 +02:00
5024a13b8b Remove comment referencing old source code
Behaviour was changed in f691a55923
2020-03-01 05:03:41 +09:00
47be36410c Assume xcb_cursor_context_new never fails (#3955)
According to libxcb-cursor code, the only condition in which
xcb_cursor_context_new() returns a non-zero result is a memory
allocation failure[1].  Thus, it is safe to assume that
xcursor_supported is always true, and remove dead code.

[1]: https://gitlab.freedesktop.org/xorg/lib/libxcb-cursor/blob/0.1.3/cursor/cursor.c#L131-132
2020-02-24 08:48:58 +01:00
83c7aff089 Limit workspace numbers within 0..INT32_MAX
Before this commit, large workspace numbers treated oddly:

   $ i3-msg 'rename workspace to 1234567890'
   # displayed in i3bar as `0`

   $ i3-msg 'rename workspace to 4294967200'
   $ i3-msg -t get_workspaces | jq '.[]|select(.focused).num'
   -96 # int32_t overflow

   $ i3-msg 'rename workspace to 99999999999999999999'
   $ i3-msg -t get_workspaces | jq '.[]|select(.focused).num'
   -1 # treated as unnumbered

This commit puts a consistent limit on workspace numbers.  Now
workspaces with numbers beyond INT32_MAX are treated as unnumbered.
2020-02-21 02:07:04 +00:00
1f0c628cde clang-format: bring back ForeachMacros (#3948)
* clang-format: bring back ForeachMacros

ForeachMacros was disabled in 4211274fcd
due to the breakage of include/queue.h. The currently used version,
clang-format-6.0 doesn't break it.

* Add curly braces

Co-authored-by: Orestis Floros <orestisflo@gmail.com>
2020-02-19 11:31:09 +01:00
d14e59b3a7 i3bar: Make header declarations extern
See #3914
2020-02-01 17:33:53 +01:00
5835bbc385 Added workspace ID in GET_WORKSPACES response. 2020-01-08 09:07:53 +01:00
33634fbacd Fix i3bar leak on handle_destroy_notify 2019-10-14 17:34:38 +03:00
ee30c34b5c Fix small leak in i3bar's main
If -s is used, the socket_path returned by getenv is never freed.

Also some small rearrangements.
2019-10-14 03:54:48 +03:00
98d96c3a2c reorder_trayclients_cmp: Correct comment 2019-10-11 19:32:58 +03:00
eda814755a Make tray icon order deterministic
Fixes #3573
2019-10-11 18:25:22 +03:00
d5a3b8af02 Introduce trayclient_and_output_from_window
Saves some code repetition
2019-10-11 16:12:48 +03:00
94228fd902 Add setting for minimal width of workspace buttons 2019-06-25 13:10:01 +07:00
ca82f95812 feat: added support for user-defined border widths in i3bar blocks (#3726)
This change introduces support for four new properties on the i3bar
protocol, namely "border_top", "border_right", "border_bottom"
and "border_left".

If a block is drawn with a border, these values define the width of
the corresponding edge in pixels. They all default to 1 if not
specified to preserve compatibility.

fixes #3722
2019-06-22 22:18:29 +02:00
48af067dfe feat: support transparency (RGBA) in i3bar (#3727)
We introduce a --transparency flag for i3bar in order to enable a mode which
supports the use of RGBA colors.

An important constraint here is that tray icons will always have
a fully transparent background.

fixes #3723
2019-06-22 17:23:21 +02:00
baf1067087 i3bar: If click events disabled, use whole bar for other events
Fixes #3700
2019-05-13 12:56:04 +03:00
8903f29795 child_handle_button: Call only if x >= offset
c2a1b6e9 was a bit overzealous, other actions should be executed if the
button was pressed after the workspace buttons but before the
statusline.

Also, should we allow other actions everywhere in the bar if click
events are disabled by the child?
2019-03-29 16:10:19 +02:00
c2a1b6e91f handle_button: Introduce child_handle_button
Also fixes an issue where action would be called if the button press was
on a separator. For example, if a user scrolled on a separator, the
workspace would change.

Applies to --release commands as well.
2019-03-28 21:05:43 +02:00
03d2ccdeef handle_button: Use full render width for calculations
Fixes #3664

Also, click events' width will now always be >= min_width.
2019-03-28 21:05:29 +02:00
5084a881af Do not assume STDIN_FILENO is available for input from child 2018-10-26 09:31:43 -04:00
3745e6f484 Add "modifiers" to events sent by i3bar 2018-10-25 16:02:06 -07:00
5d70e2850f Merge pull request #3475 from Gravemind/fix-i3bar-re-hidden-on-any-modifier
i3bar: Fix i3bar re-hidden by any modifier (#3474)
2018-10-23 18:41:11 +03:00
e240c118c7 Close & reopen tray selwin when needed
Fixes #1329
Fixes #3317 (duplicate)
Examples where the tray "disappeared":
- Start without a "tray_output", reload config with "tray_output none",
remove "tray_output none" and reload.
- Start with "tray_output primary" (or "tray_output <output>"), disable
the primary output and then reconnect it.

Fixes #2010
Cached in output_for_tray
2018-10-23 16:41:09 +03:00
c40c79538e i3bar: Fix i3bar re-hidden by any modifier (#3474)
The bug was introduced in 4.15-next fe6b3b7474
2018-10-23 15:17:30 +02:00
a65914f338 Fix missing prototypes
i3 will now compile with no warnings when -Wmissing-prototypes is used.
2018-10-13 21:10:10 +03:00
2a9522dda4 Enforce strict prototypes
i3 will now compile with no warnings when -Wstrict-prototypes is used.
2018-10-13 21:10:09 +03:00