Commit graph

161 commits

Author SHA1 Message Date
fraktal
1b2dee55ef fix bar Y position in case of multi-monitor setups with mixed resolutions 2024-09-04 15:33:25 +02:00
Delgan
b3313cefc6 Fix remaining typos in the codebase (and update CI checks) 2024-05-02 16:28:51 +00:00
Daniel Eklöf
3c572c70c9
wayland: silence compiler warning
... by ensuring 'layer' is always initialized, to _something_.
2024-04-09 16:34:53 +02:00
Delgan
b85ba99980 Apply "clang-format" preferences globally 2024-04-07 10:05:10 +02:00
Daniel Eklöf
d841aeeecd
config: layer: add 'overlay' and 'background'
The layer option (Wayland only) now accepts 'overlay' and
'background'.

Closes #372
2024-04-06 15:39:19 +02:00
Daniel Eklöf
cdee55afed
bar: wayland: update bar size + refresh in output_done()
This ensures the bar's size (width) is updated when the screen
resolution (and/or scale) is changed.

Note that we already handled scale changes. This logic has been moved
from output_scale() to output_done().

Closes #330
2024-01-03 15:39:04 +01:00
Väinö Mäkelä
1283160e17
bar/wayland: Reset last_mapped_monitor on enter
If the surface enters an output, there's no need for
last_mapped_monitor, and it must be reset to fulfill the asserts in
other parts of the code.

This makes yambar no longer crash when it is hidden by an opaque window
multiple times on a compositor using wlroots' scene tree.
2024-01-03 15:14:05 +01:00
Daniel Eklöf
89e74139f5
bar: wayland: shm: try with MFD_NOEXEC_SEAL first, then without
MFD_NOEXEC_SEAL is only supported on kernels 6.3 and later.

If we were compiled on linux >= 6.3, but run on linux < 6.3, we'd exit
with an error, due to memfd_create() failing with EINVAL.

This patch fixes the problem by first trying to call
memfd_create() *with* MFD_NOEXEC_SEAL, and if that fails with EINVAL,
we try again without it.
2023-10-13 16:34:02 +02:00
Daniel Eklöf
cbd3bebb04
bar/wayland: create memfd with MFD_NOEXEC_SEAL 2023-10-08 11:12:15 +02:00
Daniel Eklöf
7fbc1f2c44
bar/wayland: seal memfd 2023-10-08 11:12:08 +02:00
Daniel Eklöf
2e0e1a402f
bar: also log module name when logging a failed module 2022-12-14 12:05:34 +01:00
Peter Rice
6ed576c719
particle/on-click: support next/previous buttons 2022-10-04 21:14:29 +02:00
Daniel Eklöf
9353aa14fe
bar: set clip region before calling the particles’ expose() methods
This ensures particles that are “too wide” doesn’t try to render
outside the bar, possibly overrunning both margins and borders. Or
worse, crashes yambar.

Closes #198
2022-06-05 00:33:30 +02:00
Daniel Eklöf
4daa3d9904
meson: stop using deprecated functions, require meson >= 0.58
* get_pkgconfig_variable() -> get_variable()
* prog.path() -> prog.full_path()
* meson.build_root() -> meson.global_build_root()
2022-02-27 11:32:46 +01:00
Daniel Eklöf
ffccabbb13
config: add inheritable option “font-shaping”
This patch adds an inheritable option, “font-shaping”, that controls
whether a particle that renders text should enable font-shaping or
not.

The option works similar to the ‘font’ option: one can set it at the
top-level, and it gets inherited down through all modules and to their
particles.

Or, you can set it on a module and it gets inherited to all its
particles, but not to other modules’ particles.

Finally, you can set it on individual particles, in which case it only
applies to them (or “child” particles).

When font-shaping is enabled (the default), the string particle shapes
full text runs using the fcft_rasterize_text_run_utf32() API. In fcft,
this results in HarfBuzz being used to shape the string.

When disabled, the string particle instead uses the simpler
fcft_rasterize_char_utf32() API, which rasterizes individual
characters.

This gives user greater control over the font rendering. One example
is bitmap fonts, which HarfBuzz often doesn’t get right.

Closes #159
2022-02-23 18:43:13 +01:00
Daniel Eklöf
1d9297593e
bar/wayland: error handling when dispatching Wayland events 2022-01-09 23:12:52 +01:00
Daniel Eklöf
56c4a1c751
bar/wayland: add support for new events in wl-output v4
* name()
* description()
2022-01-01 11:47:24 +01:00
Daniel Eklöf
2a0a722c13
bar/wayland: handle layer surface being closed
If the output we’re mapped on is disabled (or disconnected), the
compositor will unmap us.

Up until now, our response was to simply shutdown.

Now, we destroy the surface, remove all pending rendering buffers, and
all further calls to commit() will return immediately, without doing
anything.

If the user has configured a specific monitor to use, we wait for that
output to come back. When it does, we re-create the layer surface and
then we’re up and running again.

Bars running on the “default” monitor are handled in a similar
way. Since we don’t have an output name from the configuration, we
instead store the name of the output we were mapped on, when we’re
either unmapped from that output, or that output global is destroyed.

As soon as we see that output come back, we re-create the layer
surface.
2022-01-01 11:43:40 +01:00
natemaia
39a5493450 Fix: X11 struts
https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html#idm45643490065584
2021-12-09 02:07:24 +01:00
Daniel Eklöf
d40220e511
bar/wayland: handle failure to set initial size in setup() 2021-11-15 18:06:10 +01:00
Daniel Eklöf
bd44e82eca
bar/wayland: coalesce “refresh” commands
This reduces the number of repaints primarily during startup, but also
when e.g. switching workspace.
2021-10-22 18:07:14 +02:00
Daniel Eklöf
939b81a4ea
bar/wayland: create comm pipe with CLOEXEC | NONBLOCK 2021-10-22 18:06:43 +02:00
Daniel Eklöf
fee0b91174
bar/wayland: remove unused member ‘bar_expose’ 2021-10-22 18:06:19 +02:00
Daniel Eklöf
4f3aa8c6b0
bar: do a synchronous “refresh” *before* starting the modules
This ensures the surface has been mapped, and our “current” output is
known.

This fixes an issue where modules depending on the current output
being known failed to update correctly during startup.
2021-10-22 18:05:20 +02:00
Daniel Eklöf
94a0154c23
bar: refresh before starting the main loop
This ensures the bar surface gets mapped, and a background + border
rendered, even though no module “refreshes” it during initialization.

Closes #116
2021-10-17 16:48:09 +02:00
Jan Beich
ec465ba3b3 wayland: unbreak build without memfd_create
New FreeBSD versions have memfd_create but other BSDs don't.

bar/wayland.c:774:15: error: implicit declaration of function 'memfd_create' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    pool_fd = memfd_create("yambar-wayland-shm-buffer-pool", MFD_CLOEXEC);
              ^
bar/wayland.c:774:62: error: use of undeclared identifier 'MFD_CLOEXEC'
    pool_fd = memfd_create("yambar-wayland-shm-buffer-pool", MFD_CLOEXEC);
                                                             ^
2021-10-03 23:07:23 +00:00
Baptiste Daroussin
82c92185ea memfd: linux/memfd does not exist on FreeBSD
memfd_create is defined in sys/mman.h on FreeBSD
2021-10-01 17:22:55 +02:00
Daniel Eklöf
1079bca3eb
Silence “variable length array bound evaluates to non-positive value 0” 2021-08-26 13:27:29 +02:00
Daniel Eklöf
7ca22a6dab
bar: don’t adjust spacing for left/center/right widths if all exposables are zero-width 2021-08-25 18:48:15 +02:00
Nulo
eb94c8cceb
Add layer option
Only applies to Wayland and the default is still bottom.
2021-08-25 18:42:46 +02:00
Nulo
910522262f
Only add spacing if the module is not empty
If the module is empty (width is 0) no spacing will be rendered for it.

This makes modules that auto-hide (for example, network modules for interfaces not used all of the time) occupy no space in the bar.
2021-08-12 19:29:07 +02:00
Daniel Eklöf
74016d7d33
bar: add bar->output_name(), returns the name of the output we’re on 2021-08-09 19:56:47 +02:00
Érico Nogueira
7d94631991 bar: fix typo.
Running 'yambar --backend=wayland' would always error out saying it was
built without wayland support.
2021-07-29 15:57:00 -03:00
Daniel Eklöf
b97ba80aea
bar: add border.{left,right,top,bottom}-width
This allows you to configure the width of each side of the border
individually. border.width can still be used, and will set all four
borders to the same width.

Closes #77
2021-07-28 11:00:04 +02:00
Daniel Eklöf
0aef2f85ee
config: add bar.trackpad-sensitivity
This is an integer that specifies the amount of scrolling that needs
to be accumulated before a wheel-up/down event is emitted.

A higher value means you need to drag your fingers a longer distance
before the event is emitted.

The default is 30.
2021-07-01 17:15:54 +02:00
Daniel Eklöf
4ce3fe2285
bar/wayland: fix mouse wheel up not being emitted
We emit mouse wheel up events when the ‘discrete’ counter is
negative. Thus, when looping, we need to loop to its *absolute* value.
2021-07-01 17:15:54 +02:00
Daniel Eklöf
530afe6cf5
bar: wayland: initial support for mouse wheel up/down 2021-07-01 17:15:54 +02:00
Daniel Eklöf
93a5bbb4a4
bar: wayland: require seat version 5, to get discrete axis events 2021-07-01 17:15:54 +02:00
Daniel Eklöf
5e6e9e189b
bar: xcb: add support for mouse wheel up/down 2021-07-01 17:15:53 +02:00
Daniel Eklöf
c79ffbe057
Add support binding on-click handlers to other buttons than LEFT
One can now bind the left/middle/right mouse buttons to on-click. In
fact, you can have all three buttons bound to different handlers for
the same particle. The new syntax is

    on-click:
        left: <command>
        middle: <command>
        right: <command>

Leaving one out is the same thing as not mapping it at
all. Furthermore,

    on-click: <command>

is still valid, and is a shorthand for

    on-click:
        left: <commsnd>
2021-07-01 17:15:53 +02:00
Daniel Eklöf
dd724d1bc2
exposable: add ‘btn’ argument to on_mouse() 2021-07-01 17:15:52 +02:00
Daniel Eklöf
08fa56a0f4
bar: set thread name of the bar’s own thread 2021-06-21 18:16:22 +02:00
Daniel Eklöf
371bfb4065
bar: don’t prepend ‘mod:’ to module thread titles 2021-06-20 21:21:59 +02:00
Daniel Eklöf
97d5570daf
bar: set module thread titles using the new mod->description() 2021-06-20 21:14:58 +02:00
Daniel Eklöf
8c93b48146
bar/wayland: xdg_handle_output_name(): free previous monitor name 2021-04-07 07:58:16 +02:00
Daniel Eklöf
d0f1f762ea
bar/xcb: fallback to non-primary monitor
If the user did *not* configured a specific monitor, we prefer the
primary monitor. However, if that monitor is disconnected, yambar
would exit with:

  no matching monitor

This patch changes this, to use the *last* connected monitor. It also
improves the error message.

Note: if the user did specify a monitor in the configuration, but
perhaps misspelled it, we will *not* fallback to another monitor, but
instead log an error saying that specific monitor could not be found.
2020-12-04 21:16:14 +01:00
Daniel Eklöf
c11a79c98d
bar, module: particles may no longer return NULL in instantiate() 2020-11-25 20:41:10 +01:00
Daniel Eklöf
4d05947985
bar: deal with NULL exposables
Allow modules to return NULL in begin_expose()
2020-11-25 20:36:46 +01:00
Daniel Eklöf
008235d904
bar/wayland: close command pipe FDs in cleanup 2020-11-25 20:36:45 +01:00
Daniel Eklöf
328ebe8fe9
bar/wayland: plug memory leak: free seat name 2020-11-25 20:36:45 +01:00