awesome
awesome copied to clipboard
Mouse signals on other wiboxes
I have custom context menu widgets. I'd like to implement this common feature:
- press and hold mouse button
- move the cursor to the item in the menu
- release the mouse button
- menu item action is executed
Sometimes it's faster and you save 1 more click.
Output of awesome --version
:
awesome v4.3-1588-gb54e50ad6 (Too long) • Compiled against Lua 5.4.4 (running with 0.9.2) • API level: 4 • D-Bus support: yes • xcb-errors support: no • execinfo support: yes • xcb-randr version: 1.6 • LGI version: /usr/share/lua/5.4/lgi/version.lua • Transparency enabled: yes • Custom search paths: no
How to reproduce the issue:
- press and hold any mouse button on wibox
A
- move the cursor to any widget on wibox
B
Actual result:
No signal is emitted (mouse::enter
, mouse::leave
, ...) for widgets on wibox B
.
Also no mouse buttons on wibox B
works until the button is released.
Expected result:
All signals are emitted and all buttons on wibox B
work regardless of the button press state.
Do you use a mousegrabber? Or how did you try to implement this, its hard to know whats wrong without the code.
Just regular mouse::*
/button::*
signals.
Here is rc.lua
where you can try it:
- press and hold mouse button on "foo"
- move cursor over "bar" (the same wibox) => output "+ enter bar" and " leave bar"
- move cursor over "qux" (different wibox) => no output
- release mouse button
- move cursor over "qux" (different wibox) => output "+ enter qux" and " leave qux"
local awful = require("awful")
local wibox = require("wibox")
local function create_widget(text)
local w = wibox.widget {
widget = wibox.container.background,
bg = "#cccccc",
border_color = "#eeeeee",
border_width = 1,
{
widget = wibox.container.margin,
margins = 20,
{
widget = wibox.widget.textbox,
text = text,
},
},
}
w:connect_signal("mouse::enter", function() print("+ enter", text) end)
w:connect_signal("mouse::leave", function() print(" leave", text) end)
return w
end
awful.popup {
bg = "#003300",
fg = "#008800",
x = 20,
y = 20,
widget = {
widget = wibox.container.margin,
margins = 20,
{
layout = wibox.layout.fixed.horizontal,
spacing = 50,
create_widget("foo"),
create_widget("bar"),
}
},
}
awful.popup {
bg = "#330000",
fg = "#ff0000",
x = 240,
y = 20,
widget = {
widget = wibox.container.margin,
margins = 20,
{
layout = wibox.layout.fixed.horizontal,
spacing = 50,
create_widget("qux")
}
},
}
Every wibox is its own X11 client (what most people would call "window"). And as far as I know, no major windowing system supports the scenario where you start holding a mouse button on one window and then receiver events on a different window.
The X client that holds the context menu would likely need to be set up in a certain way (transient, maybe also certain event masks) for it to still receive events in that situation. And that would likely require specific support for this in the C core of drawin
.
i think you need to use function wiboxes_under_mouse_pointer()
for your situation