Commit graph

131 commits

Author SHA1 Message Date
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
Daniel Eklöf
40d47f8273
bar/wayland: handle seat removal 2020-07-07 20:52:25 +02:00
Daniel Eklöf
b658f577de
bar/wayland: don't roundtrip when adding globals
Instead, roundtrip once all globals have been handled. This means all
listeners have been registered.

When we detect a specific monitor to map to, and it has a non-default
scale, update the cursor theme (since it depends on the scale).
2020-07-07 20:44:17 +02:00
Daniel Eklöf
b73e3acd0a
bar/wayland: remove debug output 2020-07-07 16:42:57 +02:00
Daniel Eklöf
6f22edaba6
bar/wayland: multi-seat support
We only care about the mouse. We now track per-seat cursor positions
and cursor themes.

Any enter/leave/motion/button event will call the bar on_mouse()
method using the coordinates from the "current" seat.

Since the bar framework doesn't deal with multi-seats at all, we
internally, in the backend, track the currently active seat. This is
the seat which we last saw any kind of events from.

This is used in e.g. set_cursor(), which is called from the bar.
2020-07-07 14:09:25 +02:00
Daniel Eklöf
0678015eb1
bar/wayland: shutdown when compositor "closed" our layer surface 2020-04-28 18:58:27 +02:00
Daniel Eklöf
860ec01791
bar/wayland: log globals 2020-04-28 18:58:18 +02:00
Daniel Eklöf
c707b00a2a
bar/wayland: don't destroy pointer unnecessarily
We only need to create/destroy the pointer when the POINTER capability
changes.
2020-04-28 18:57:32 +02:00
Daniel Eklöf
c7cfb451e3
bar/wayland: spell compositor correctly 2020-04-27 20:50:36 +02:00
Daniel Eklöf
df1a004f97
bar/wayland: layer surface "namespace" is a category, not application ID 2020-02-06 19:11:16 +01:00
Daniel Eklöf
edfe7e70f9
bar/wayland: don't use wl_display_dispatch()
wl_display_dispatch() calls poll(), which is unnecessary since we
already know the FD is readable.

Use the more lower level wl_display_read_events() +
wl_display_dispatch_pending().

These require wl_display_prepare_read() to have been called.
2020-01-03 21:24:26 +01:00