Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docker-widget): Fixed issue with indexing nil [#360] and button #368

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions docker-widget/clickable-container.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
local wibox = require('wibox')
local beautiful = require('beautiful')

local create_click_events = function(widget)

local container = wibox.widget {
widget,
widget = wibox.container.background
}

-- Old and new widget
local old_cursor, old_wibox

-- Mouse hovers on the widget
container:connect_signal(
'mouse::enter',
function()
container.bg = beautiful.groups_bg
-- Hm, no idea how to get the wibox from this signal's arguments...
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = 'hand1'
end
end
)

-- Mouse leaves the widget
container:connect_signal(
'mouse::leave',
function()
container.bg = beautiful.leave_event
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
end
end
)

-- Mouse pressed the widget
container:connect_signal(
'button::press',
function()
container.bg = beautiful.press_event
end
)

-- Mouse releases the widget
container:connect_signal(
'button::release',
function()
container.bg = beautiful.release_event
end
)

return container
end

return create_click_events
Loading