Merge pull request #1618 from legostax/master
Added _hover & _click to client buttons
This commit is contained in:
commit
dacf22aae7
|
@ -79,16 +79,36 @@ local titlebar = {
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
--- minimize_button_normal
|
--- minimize_button_normal.
|
||||||
-- @beautiful beautiful.titlebar_minimize_button_normal
|
-- @beautiful beautiful.titlebar_minimize_button_normal
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- minimize_button_normal_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_minimize_button_normal_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- minimize_button_normal_press.
|
||||||
|
-- @beautiful beautiful.titlebar_minimize_button_normal_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- close_button_normal.
|
--- close_button_normal.
|
||||||
-- @beautiful beautiful.titlebar_close_button_normal
|
-- @beautiful beautiful.titlebar_close_button_normal
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- close_button_normal_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_close_button_normal_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- close_button_normal_press.
|
||||||
|
-- @beautiful beautiful.titlebar_close_button_normal_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- ontop_button_normal.
|
--- ontop_button_normal.
|
||||||
-- @beautiful beautiful.titlebar_ontop_button_normal
|
-- @beautiful beautiful.titlebar_ontop_button_normal
|
||||||
-- @param surface
|
-- @param surface
|
||||||
|
@ -114,11 +134,31 @@ local titlebar = {
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- minimize_button_focus_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_minimize_button_focus_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- minimize_button_focus_press.
|
||||||
|
-- @beautiful beautiful.titlebar_minimize_button_focus_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- close_button_focus.
|
--- close_button_focus.
|
||||||
-- @beautiful beautiful.titlebar_close_button_focus
|
-- @beautiful beautiful.titlebar_close_button_focus
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- close_button_focus_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_close_button_focus_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- close_button_focus_press.
|
||||||
|
-- @beautiful beautiful.titlebar_close_button_focus_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- ontop_button_focus.
|
--- ontop_button_focus.
|
||||||
-- @beautiful beautiful.titlebar_ontop_button_focus
|
-- @beautiful beautiful.titlebar_ontop_button_focus
|
||||||
-- @param surface
|
-- @param surface
|
||||||
|
@ -134,81 +174,241 @@ local titlebar = {
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- floating_button_normal_active_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_floating_button_normal_active_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- floating_button_normal_active_press.
|
||||||
|
-- @beautiful beautiful.titlebar_floating_button_normal_active_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- maximized_button_normal_active.
|
--- maximized_button_normal_active.
|
||||||
-- @beautiful beautiful.titlebar_maximized_button_normal_active
|
-- @beautiful beautiful.titlebar_maximized_button_normal_active
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- maximized_button_normal_active_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_maximized_button_normal_active_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- maximized_button_normal_active_press.
|
||||||
|
-- @beautiful beautiful.titlebar_maximized_button_normal_active_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- ontop_button_normal_active.
|
--- ontop_button_normal_active.
|
||||||
-- @beautiful beautiful.titlebar_ontop_button_normal_active
|
-- @beautiful beautiful.titlebar_ontop_button_normal_active
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- ontop_button_normal_active_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_ontop_button_normal_active_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- ontop_button_normal_active_press.
|
||||||
|
-- @beautiful beautiful.titlebar_ontop_button_normal_active_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- sticky_button_normal_active.
|
--- sticky_button_normal_active.
|
||||||
-- @beautiful beautiful.titlebar_sticky_button_normal_active
|
-- @beautiful beautiful.titlebar_sticky_button_normal_active
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- sticky_button_normal_active_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_sticky_button_normal_active_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- sticky_button_normal_active_press.
|
||||||
|
-- @beautiful beautiful.titlebar_sticky_button_normal_active_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- floating_button_focus_active.
|
--- floating_button_focus_active.
|
||||||
-- @beautiful beautiful.titlebar_floating_button_focus_active
|
-- @beautiful beautiful.titlebar_floating_button_focus_active
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- floating_button_focus_active_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_floating_button_focus_active_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- floating_button_focus_active_press.
|
||||||
|
-- @beautiful beautiful.titlebar_floating_button_focus_active_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- maximized_button_focus_active.
|
--- maximized_button_focus_active.
|
||||||
-- @beautiful beautiful.titlebar_maximized_button_focus_active
|
-- @beautiful beautiful.titlebar_maximized_button_focus_active
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- maximized_button_focus_active_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_maximized_button_focus_active_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- maximized_button_focus_active_press.
|
||||||
|
-- @beautiful beautiful.titlebar_maximized_button_focus_active_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- ontop_button_focus_active.
|
--- ontop_button_focus_active.
|
||||||
-- @beautiful beautiful.titlebar_ontop_button_focus_active
|
-- @beautiful beautiful.titlebar_ontop_button_focus_active
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- ontop_button_focus_active_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_ontop_button_focus_active_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- ontop_button_focus_active_press.
|
||||||
|
-- @beautiful beautiful.titlebar_ontop_button_focus_active_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- sticky_button_focus_active.
|
--- sticky_button_focus_active.
|
||||||
-- @beautiful beautiful.titlebar_sticky_button_focus_active
|
-- @beautiful beautiful.titlebar_sticky_button_focus_active
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- sticky_button_focus_active_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_sticky_button_focus_active_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- sticky_button_focus_active_press.
|
||||||
|
-- @beautiful beautiful.titlebar_sticky_button_focus_active_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- floating_button_normal_inactive.
|
--- floating_button_normal_inactive.
|
||||||
-- @beautiful beautiful.titlebar_floating_button_normal_inactive
|
-- @beautiful beautiful.titlebar_floating_button_normal_inactive
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- floating_button_normal_inactive_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_floating_button_normal_inactive_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- floating_button_normal_inactive_press.
|
||||||
|
-- @beautiful beautiful.titlebar_floating_button_normal_inactive_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- maximized_button_normal_inactive.
|
--- maximized_button_normal_inactive.
|
||||||
-- @beautiful beautiful.titlebar_maximized_button_normal_inactive
|
-- @beautiful beautiful.titlebar_maximized_button_normal_inactive
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- maximized_button_normal_inactive_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_maximized_button_normal_inactive_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- maximized_button_normal_inactive_press.
|
||||||
|
-- @beautiful beautiful.titlebar_maximized_button_normal_inactive_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- ontop_button_normal_inactive.
|
--- ontop_button_normal_inactive.
|
||||||
-- @beautiful beautiful.titlebar_ontop_button_normal_inactive
|
-- @beautiful beautiful.titlebar_ontop_button_normal_inactive
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- ontop_button_normal_inactive_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_ontop_button_normal_inactive_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- ontop_button_normal_inactive_press.
|
||||||
|
-- @beautiful beautiful.titlebar_ontop_button_normal_inactive_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- sticky_button_normal_inactive.
|
--- sticky_button_normal_inactive.
|
||||||
-- @beautiful beautiful.titlebar_sticky_button_normal_inactive
|
-- @beautiful beautiful.titlebar_sticky_button_normal_inactive
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- sticky_button_normal_inactive_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_sticky_button_normal_inactive_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- sticky_button_normal_inactive_press.
|
||||||
|
-- @beautiful beautiful.titlebar_sticky_button_normal_inactive_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- floating_button_focus_inactive.
|
--- floating_button_focus_inactive.
|
||||||
-- @beautiful beautiful.titlebar_floating_button_focus_inactive
|
-- @beautiful beautiful.titlebar_floating_button_focus_inactive
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- floating_button_focus_inactive_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_floating_button_focus_inactive_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- floating_button_focus_inactive_press.
|
||||||
|
-- @beautiful beautiful.titlebar_floating_button_focus_inactive_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- maximized_button_focus_inactive.
|
--- maximized_button_focus_inactive.
|
||||||
-- @beautiful beautiful.titlebar_maximized_button_focus_inactive
|
-- @beautiful beautiful.titlebar_maximized_button_focus_inactive
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- maximized_button_focus_inactive_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_maximized_button_focus_inactive_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- maximized_button_focus_inactive_press.
|
||||||
|
-- @beautiful beautiful.titlebar_maximized_button_focus_inactive_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- ontop_button_focus_inactive.
|
--- ontop_button_focus_inactive.
|
||||||
-- @beautiful beautiful.titlebar_ontop_button_focus_inactive
|
-- @beautiful beautiful.titlebar_ontop_button_focus_inactive
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- ontop_button_focus_inactive_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_ontop_button_focus_inactive_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- ontop_button_focus_inactive_press.
|
||||||
|
-- @beautiful beautiful.titlebar_ontop_button_focus_inactive_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- sticky_button_focus_inactive.
|
--- sticky_button_focus_inactive.
|
||||||
-- @beautiful beautiful.titlebar_sticky_button_focus_inactive
|
-- @beautiful beautiful.titlebar_sticky_button_focus_inactive
|
||||||
-- @param surface
|
-- @param surface
|
||||||
-- @see gears.surface
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- sticky_button_focus_inactive_hover.
|
||||||
|
-- @beautiful beautiful.titlebar_sticky_button_focus_inactive_hover
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
|
--- sticky_button_focus_inactive_press.
|
||||||
|
-- @beautiful beautiful.titlebar_sticky_button_focus_inactive_press
|
||||||
|
-- @param surface
|
||||||
|
-- @see gears.surface
|
||||||
|
|
||||||
--- Set a declarative widget hierarchy description.
|
--- Set a declarative widget hierarchy description.
|
||||||
-- See [The declarative layout system](../documentation/03-declarative-layout.md.html)
|
-- See [The declarative layout system](../documentation/03-declarative-layout.md.html)
|
||||||
-- @param args An array containing the widgets disposition
|
-- @param args An array containing the widgets disposition
|
||||||
|
@ -421,10 +621,14 @@ function titlebar.widget.button(c, name, selector, action)
|
||||||
if img ~= "" then
|
if img ~= "" then
|
||||||
prefix = prefix .. "_"
|
prefix = prefix .. "_"
|
||||||
end
|
end
|
||||||
|
if ret.state ~= "" then
|
||||||
|
img = img .. "_"
|
||||||
|
end
|
||||||
-- First try with a prefix based on the client's focus state,
|
-- First try with a prefix based on the client's focus state,
|
||||||
-- then try again without that prefix if nothing was found,
|
-- then try again without that prefix if nothing was found,
|
||||||
-- and finally, try a fallback for compatibility with Awesome 3.5 themes
|
-- and finally, try a fallback for compatibility with Awesome 3.5 themes
|
||||||
local theme = beautiful["titlebar_" .. name .. "_button_" .. prefix .. img]
|
local theme = beautiful["titlebar_" .. name .. "_button_" .. prefix .. img .. ret.state]
|
||||||
|
or beautiful["titlebar_" .. name .. "_button_" .. prefix .. img]
|
||||||
or beautiful["titlebar_" .. name .. "_button_" .. img]
|
or beautiful["titlebar_" .. name .. "_button_" .. img]
|
||||||
or beautiful["titlebar_" .. name .. "_button_" .. prefix .. "_inactive"]
|
or beautiful["titlebar_" .. name .. "_button_" .. prefix .. "_inactive"]
|
||||||
if theme then
|
if theme then
|
||||||
|
@ -433,10 +637,33 @@ function titlebar.widget.button(c, name, selector, action)
|
||||||
end
|
end
|
||||||
ret:set_image(img)
|
ret:set_image(img)
|
||||||
end
|
end
|
||||||
|
ret.state = ""
|
||||||
if action then
|
if action then
|
||||||
ret:buttons(abutton({ }, 1, nil, function() action(c, selector(c)) end))
|
ret:buttons(abutton({ }, 1, nil, function()
|
||||||
|
ret.state = ""
|
||||||
|
update()
|
||||||
|
action(c, selector(c))
|
||||||
|
end))
|
||||||
|
else
|
||||||
|
ret:buttons(abutton({ }, 1, nil, function()
|
||||||
|
ret.state = ""
|
||||||
|
update()
|
||||||
|
end))
|
||||||
end
|
end
|
||||||
|
ret:connect_signal("mouse::enter", function()
|
||||||
|
ret.state = "hover"
|
||||||
|
update()
|
||||||
|
end)
|
||||||
|
ret:connect_signal("mouse::leave", function()
|
||||||
|
ret.state = ""
|
||||||
|
update()
|
||||||
|
end)
|
||||||
|
ret:connect_signal("button::press", function(_, _, _, b)
|
||||||
|
if b == 1 then
|
||||||
|
ret.state = "press"
|
||||||
|
update()
|
||||||
|
end
|
||||||
|
end)
|
||||||
ret.update = update
|
ret.update = update
|
||||||
update()
|
update()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue