Commit graph

141 commits

Author SHA1 Message Date
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
Daniel Eklöf
1262f1b3d1
bar/wayland: use wl_*_release() instead of wl_*_destroy()
This lets the compositor free up internal state.
2020-11-09 19:53:57 +01:00
Daniel Eklöf
e25c42dc87
module/river: meson: explicitly add wl_proto_src + wl_proto_headers to sources
The ‘river’ module depends on generated protocol sources. These are
normally provided, indirectly, by the Wayland bar backend. But when
building plugins as shared modules, the plugins no longer depend on
the bar, and thus ‘river’ fails to build.

Fix this by doing two things:

* **Remove** the ‘river’ protocol from the ‘generic’ Wayland protocols
* Explicitly add both the generic and the ‘river’ specific protocols
  to the ‘river’ module.
2020-09-24 17:30:18 +02:00
Daniel Eklöf
c17e4b1110
meson: bar: remove unused list variable 2020-08-30 11:01:40 +02:00
Daniel Eklöf
7b2d524598
moduel/river: wip: new module; 'tags' status on Wayland compositor 'river' 2020-07-23 19:00:42 +02:00
Daniel Eklöf
588e6150d2
bar/wayland: do *not* set backend->scale in xdg_output_handle_done()
This is done by update_size(). Setting it in xdg_output_handle_done()
causes update_size() to do an early exit, and thus we end up never
actually configuring the surface.

We also never instantiate a pixman image, which led to a hard crash at
startup when the user had configured a specific output to use.
2020-07-20 17:30:20 +02:00
Daniel Eklöf
aa1b3457a1
bar/wayland: make sure we don't strcmp() a NULL pointer 2020-07-20 17:29:56 +02:00
Daniel Eklöf
e38f593acd
bar/wayland: don't try to set cursor surface if serial is 0 2020-07-11 07:39:02 +02:00
Daniel Eklöf
74933c40ee
bar/wayland: log error message when failing to load cursor (image) 2020-07-11 07:37:01 +02:00
Daniel Eklöf
84ba1c231a
bar/wayland: update cursor on pointer enter event 2020-07-10 18:38:00 +02:00
Daniel Eklöf
c03564513d
bar/wayland: seat: handle failure to create pointer surface 2020-07-10 18:37:39 +02:00
Daniel Eklöf
0a0ef8852a
bar/wayland: move seat.pointer.pointer -> seat.wl_pointer 2020-07-10 18:20:29 +02:00
Daniel Eklöf
f426155e0b
bar/wayland: explicitly refresh on scale changes
Just calling update_size() isn't enough, as that in itself doesn't
trigger a redraw.
2020-07-10 11:43:34 +02:00
Daniel Eklöf
6bf077240c
bar/wayland: update_size: release old buffer when reloading buffers 2020-07-10 11:43:12 +02:00
Daniel Eklöf
dd74b7f747
bar/wayland: don't initialize backend->scale = 1
This causes the first call to update_size() to exit early, and thus we
never configure the initial state.
2020-07-10 11:42:26 +02:00
Daniel Eklöf
31a4cddde3
bar/wayland: guess scale when no 'output' has been configured 2020-07-10 10:48:17 +02:00
Daniel Eklöf
d80fbd4084
bar/wayland: remove commented out code 2020-07-10 10:48:07 +02:00
Daniel Eklöf
d929c12ecb
bar/wayland: reload cursor theme: remember current pointer name
This allows us to avoid reloading the same pointer image again and
again.
2020-07-09 19:52:10 +02:00
Daniel Eklöf
f04b1e806c
bar: let backend check if xcursor should be updated or not
This allows the backend to support multi-seat "properly", by checking
against the correct seat. Before this, when we used a single, global
xcursor value, a seat whose pointer needed to be updated would not be
updated.
2020-07-09 19:02:02 +02:00
Daniel Eklöf
5884e665a4
bar/wayland: set-cursor: don't skip out if "old" xcursor is same as "new"
We might be setting on a different seat than before.
2020-07-09 18:55:04 +02:00
Daniel Eklöf
13c2b8296d
bar/wayland: resize surface+buffers on dynamic scale changes 2020-07-09 18:51:44 +02:00