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
|
for i, o in ipairs(objects) do
|
||||||
local cache = data[o]
|
local cache = data[o]
|
||||||
|
|
||||||
|
-- Allow the buttons to be replaced.
|
||||||
|
if cache and cache._buttons ~= buttons then
|
||||||
|
cache = nil
|
||||||
|
end
|
||||||
|
|
||||||
if not cache then
|
if not cache then
|
||||||
cache = (args and args.widget_template) and
|
cache = (args and args.widget_template) and
|
||||||
custom_template(args) or default_template()
|
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)
|
args.create_callback(cache.primary, o, i, objects)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
cache._buttons = buttons
|
||||||
data[o] = cache
|
data[o] = cache
|
||||||
elseif cache.update_callback then
|
elseif cache.update_callback then
|
||||||
cache.update_callback(cache.primary, o, i, objects)
|
cache.update_callback(cache.primary, o, i, objects)
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
--
|
--
|
||||||
--@DOC_awful_widget_layoutlist_popup_EXAMPLE@
|
--@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@
|
--@DOC_awful_widget_layoutlist_bar_EXAMPLE@
|
||||||
--
|
--
|
||||||
|
@ -36,9 +36,11 @@ local surface = require("gears.surface")
|
||||||
|
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
local default_buttons = gtable.join(
|
local default_buttons = {
|
||||||
abutton({ }, 1, function(a) a.callback() end)
|
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 function wb_label(item, _, textbox)
|
||||||
local selected = alayout.get(item.screen) == item.layout
|
local selected = alayout.get(item.screen) == item.layout
|
||||||
|
@ -201,17 +203,6 @@ local layoutlist = {}
|
||||||
-- @property filter
|
-- @property filter
|
||||||
-- @param[opt=awful.widget.layoutlist.source.for_screen] function
|
-- @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.
|
--- The default foreground (text) color.
|
||||||
-- @beautiful beautiful.layoutlist_fg_normal
|
-- @beautiful beautiful.layoutlist_fg_normal
|
||||||
-- @tparam[opt=nil] string|pattern fg_normal
|
-- @tparam[opt=nil] string|pattern fg_normal
|
||||||
|
@ -308,8 +299,11 @@ end
|
||||||
|
|
||||||
function layoutlist:set_buttons(buttons)
|
function layoutlist:set_buttons(buttons)
|
||||||
self._private.buttons = buttons
|
self._private.buttons = buttons
|
||||||
|
|
||||||
|
if self._private.layout then
|
||||||
update(self)
|
update(self)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function layoutlist:get_buttons()
|
function layoutlist:get_buttons()
|
||||||
return self._private.buttons
|
return self._private.buttons
|
||||||
|
@ -376,7 +370,6 @@ end
|
||||||
-- function to generate the list of layouts.
|
-- function to generate the list of layouts.
|
||||||
-- @tparam[opt] table args.widget_template A custom widget to be used for each action.
|
-- @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=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[opt={}] table args.style Extra look and feel parameters
|
||||||
-- @tparam boolean args.style.disable_icon
|
-- @tparam boolean args.style.disable_icon
|
||||||
-- @tparam boolean args.style.disable_name
|
-- @tparam boolean args.style.disable_name
|
||||||
|
|
|
@ -59,16 +59,18 @@ local modkey = "mod4" --DOC_HIDE
|
||||||
start_callback = function() layout_popup.visible = true end,
|
start_callback = function() layout_popup.visible = true end,
|
||||||
stop_callback = function() layout_popup.visible = false end,
|
stop_callback = function() layout_popup.visible = false end,
|
||||||
export_keybindings = true,
|
export_keybindings = true,
|
||||||
release_event = "release",
|
stop_event = "release",
|
||||||
stop_key = {"Escape", "Super_L", "Super_R"},
|
stop_key = {"Escape", "Super_L", "Super_R"},
|
||||||
keybindings = {
|
keybindings = {
|
||||||
{{ modkey } , " " , function()
|
{{ 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},
|
end},
|
||||||
{{ modkey, "Shift" } , " " , function()
|
{{ 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},
|
end},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
layout_popup.visible = true --DOC_HIDE
|
||||||
|
|
||||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
||||||
|
|
Loading…
Reference in New Issue