Merge pull request #3464 from Elv13/fix_3388
Fix an assert in the layoutlist code
This commit is contained in:
commit
1d55ae09aa
|
@ -125,6 +125,11 @@ function common.list_update(w, buttons, label, data, objects, args)
|
|||
for i, o in ipairs(objects) do
|
||||
local cache = data[o]
|
||||
|
||||
-- Allow the buttons to be replaced.
|
||||
if cache and cache._buttons ~= buttons then
|
||||
cache = nil
|
||||
end
|
||||
|
||||
if not cache then
|
||||
cache = (args and args.widget_template) and
|
||||
custom_template(args) or default_template()
|
||||
|
@ -139,6 +144,7 @@ function common.list_update(w, buttons, label, data, objects, args)
|
|||
args.create_callback(cache.primary, o, i, objects)
|
||||
end
|
||||
|
||||
cache._buttons = buttons
|
||||
data[o] = cache
|
||||
elseif cache.update_callback then
|
||||
cache.update_callback(cache.primary, o, i, objects)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
--
|
||||
--@DOC_awful_widget_layoutlist_popup_EXAMPLE@
|
||||
--
|
||||
-- This example extends 'awful.widget.layoutbox' to show a layout list popup:
|
||||
-- This example extends `awful.widget.layoutbox` to show a layout list popup:
|
||||
--
|
||||
--@DOC_awful_widget_layoutlist_bar_EXAMPLE@
|
||||
--
|
||||
|
@ -36,9 +36,11 @@ local surface = require("gears.surface")
|
|||
|
||||
local module = {}
|
||||
|
||||
local default_buttons = gtable.join(
|
||||
abutton({ }, 1, function(a) a.callback() end)
|
||||
)
|
||||
local default_buttons = {
|
||||
abutton({ }, 1, function(a) a.callback( ) end),
|
||||
abutton({ }, 4, function() alayout.inc(-1) end),
|
||||
abutton({ }, 5, function() alayout.inc( 1) end),
|
||||
}
|
||||
|
||||
local function wb_label(item, _, textbox)
|
||||
local selected = alayout.get(item.screen) == item.layout
|
||||
|
@ -201,17 +203,6 @@ local layoutlist = {}
|
|||
-- @property filter
|
||||
-- @param[opt=awful.widget.layoutlist.source.for_screen] function
|
||||
|
||||
--- The layoutlist buttons.
|
||||
--
|
||||
-- The default is:
|
||||
--
|
||||
-- gears.table.join(
|
||||
-- awful.button({ }, 1, awful.layout.set)
|
||||
-- )
|
||||
--
|
||||
-- @property buttons
|
||||
-- @param table
|
||||
|
||||
--- The default foreground (text) color.
|
||||
-- @beautiful beautiful.layoutlist_fg_normal
|
||||
-- @tparam[opt=nil] string|pattern fg_normal
|
||||
|
@ -308,7 +299,10 @@ end
|
|||
|
||||
function layoutlist:set_buttons(buttons)
|
||||
self._private.buttons = buttons
|
||||
update(self)
|
||||
|
||||
if self._private.layout then
|
||||
update(self)
|
||||
end
|
||||
end
|
||||
|
||||
function layoutlist:get_buttons()
|
||||
|
@ -376,7 +370,6 @@ end
|
|||
-- function to generate the list of layouts.
|
||||
-- @tparam[opt] table args.widget_template A custom widget to be used for each action.
|
||||
-- @tparam[opt=ascreen.focused()] screen args.screen A screen
|
||||
-- @tparam[opt=nil] table args.buttons The list of `awful.buttons`.
|
||||
-- @tparam[opt={}] table args.style Extra look and feel parameters
|
||||
-- @tparam boolean args.style.disable_icon
|
||||
-- @tparam boolean args.style.disable_name
|
||||
|
|
|
@ -59,16 +59,18 @@ local modkey = "mod4" --DOC_HIDE
|
|||
start_callback = function() layout_popup.visible = true end,
|
||||
stop_callback = function() layout_popup.visible = false end,
|
||||
export_keybindings = true,
|
||||
release_event = "release",
|
||||
stop_event = "release",
|
||||
stop_key = {"Escape", "Super_L", "Super_R"},
|
||||
keybindings = {
|
||||
{{ modkey } , " " , function()
|
||||
awful.layout.set(gears.table.cycle_value(ll.layouts, ll.current_layout, 1))
|
||||
awful.layout.set((gears.table.cycle_value(ll.layouts, ll.current_layout, 1)))
|
||||
end},
|
||||
{{ modkey, "Shift" } , " " , function()
|
||||
awful.layout.set(gears.table.cycle_value(ll.layouts, ll.current_layout, -1), nil)
|
||||
awful.layout.set((gears.table.cycle_value(ll.layouts, ll.current_layout, -1)), nil)
|
||||
end},
|
||||
}
|
||||
}
|
||||
|
||||
layout_popup.visible = true --DOC_HIDE
|
||||
|
||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
||||
|
|
Loading…
Reference in New Issue