Hi,

On 16.04.2014 20:54, david cobac wrote:
> Some precisions :
> it seems it finally interacts but not the whole widget...
> Since i have two of these widgets side by side, it appears that sensitive
> area overlaps on the other : it's like the area of the widget is on its
> bottom right and includes a part of the other widget...
> 
> A problem of position of the lgi.cairo surface with the widget itself ?
> 
> 
> 2014-04-16 16:54 GMT+02:00 david cobac <david.co...@gmail.com>:
> 
>> Hi !
>> I've several  widgets defined the same way :
>>
>> mpdtw  = wibox.widget.base.make_widget()
>> mpdtw.fit = function ( mpdtw , width , height )
>>    local size = math.min ( width , height )
>>    return size, size
>> end
>> mpdtw.draw = function ( mpdtw , wibox , cr , width , height )
>> ...
>> ...
>> end
>>
>> None of them react when i define events like this for example :
>>
>> mpdtw:buttons(awful.util.table.join(
>> awful.button({ }, 1, function () awful.util.spawn( "mpc toggle" ) end),
>> awful.button({ }, 4, function () awful.util.spawn( "mpc seek +2%" ) end),
>>  awful.button({ }, 5, function () awful.util.spawn( "mpc seek -2%" ) end)
>>   ))
>>
>> thanks for any help !
>>
>> awesome v3.5.5 (Kansas City Shuffle)
>>  • Build: Apr 12 2014 19:40:24 for x86_64 by gcc version 4.8.2 (root@antec
>> )
>>  • Compiled against Lua 5.1.5 (running with Lua 5.1)
>>  • D-Bus support: ✘

Attached is a patch describing my change in the default config. I place the
widget so that I can find it even though it doesn't actually draw anything. :-)

With this, everything works fine for me. I also tried clicking at various points
of the widget and all of them reacted fine.

Could it be that "mpc" fails to connect to mpd? You could try using
naughty.notify{text="clicked"} in the callback function to test if mpd or the
click failed.

Cheers,
Uli
-- 
A normal person is just someone you don't know well enough yet.
 - Nettie Wiebe
diff --git a/awesomerc.lua.in b/awesomerc.lua.in
index 2d61b31..a0e9792 100755
--- a/awesomerc.lua.in
+++ b/awesomerc.lua.in
@@ -112,6 +112,20 @@ menubar.utils.terminal = terminal -- Set the terminal for 
applications that requ
 mytextclock = awful.widget.textclock()
 
 -- Create a wibox for each screen and add it
+mpdtw = wibox.widget.base.make_widget()
+function mpdtw:fit(width, height)
+       local s = math.min(width, height)
+       return s, s
+end
+function mpdtw:draw()
+       -- Nothing to do here
+end
+mpdtw:buttons(awful.util.table.join(
+awful.button({ }, 1, function () print("a") end),
+awful.button({ }, 4, function () print("b") end),
+awful.button({ }, 5, function () print("c") end)
+  ))
+
 mywibox = {}
 mypromptbox = {}
 mylayoutbox = {}
@@ -184,6 +198,7 @@ for s = 1, screen.count() do
     -- Widgets that are aligned to the left
     local left_layout = wibox.layout.fixed.horizontal()
     left_layout:add(mylauncher)
+    left_layout:add(mpdtw)
     left_layout:add(mytaglist[s])
     left_layout:add(mypromptbox[s])
 

Reply via email to