Fix some alt+tab bugs
This commit is contained in:
parent
513f78d700
commit
d090699596
|
@ -14,10 +14,12 @@ local module,pause_monitoring = {},false
|
||||||
|
|
||||||
-- Keep its own history instead of using awful.client.focus.history
|
-- Keep its own history instead of using awful.client.focus.history
|
||||||
local focusIdx,focusTable = 1,setmetatable({}, { __mode = 'v' })
|
local focusIdx,focusTable = 1,setmetatable({}, { __mode = 'v' })
|
||||||
|
local focusTag = setmetatable({}, { __mode = 'v' })
|
||||||
local function push_focus(c)
|
local function push_focus(c)
|
||||||
if c and not pause_monitoring then
|
if c and not pause_monitoring then
|
||||||
focusTable[c] = focusIdx
|
focusTable[c] = focusIdx
|
||||||
focusIdx = focusIdx + 1
|
focusIdx = focusIdx + 1
|
||||||
|
focusTag[c] = tag.selected(c.screen)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
capi.client.connect_signal("focus", push_focus)
|
capi.client.connect_signal("focus", push_focus)
|
||||||
|
@ -58,7 +60,7 @@ end
|
||||||
local function select_next(menu)
|
local function select_next(menu)
|
||||||
local item = menu.next_item
|
local item = menu.next_item
|
||||||
item.selected = true
|
item.selected = true
|
||||||
item.button1()
|
item.button1(nil,nil,nil,nil,true)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -95,40 +97,44 @@ local function new(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
local t,auto_release = tag.selected(capi.client.focus and capi.client.focus.screen or capi.mouse.screen),args.auto_release
|
local t,auto_release = tag.selected(capi.client.focus and capi.client.focus.screen or capi.mouse.screen),args.auto_release
|
||||||
local currentMenu = radical.box({filter = true, show_filter=true, autodiscard = true,
|
local currentMenu = radical.box({filter = true, show_filter=not auto_release, autodiscard = true,
|
||||||
disable_markup=true,fkeys_prefix=not auto_release,width=(((capi.screen[capi.client.focus and capi.client.focus.screen or capi.mouse.screen]).geometry.width)/2),
|
disable_markup=true,fkeys_prefix=not auto_release,width=(((capi.screen[capi.client.focus and capi.client.focus.screen or capi.mouse.screen]).geometry.width)/2),
|
||||||
icon_transformation = beautiful.alttab_icon_transformation,filter_underlay="Use [Shift] to toggle clients",filter_underlay_color=beautiful.menu_bg_normal,
|
icon_transformation = beautiful.alttab_icon_transformation,filter_underlay="Use [Shift] to toggle clients",filter_underlay_color=beautiful.menu_bg_normal,
|
||||||
filter_placeholder="<span fgcolor='".. (beautiful.menu_fg_disabled or beautiful.fg_disabled or "#777777") .."'>Type to filter</span>"})
|
filter_placeholder="<span fgcolor='".. (beautiful.menu_fg_disabled or beautiful.fg_disabled or "#777777") .."'>Type to filter</span>"})
|
||||||
|
|
||||||
local pref_bg = wibox.widget.background()
|
if not auto_release then
|
||||||
local pref_l = wibox.layout.align.horizontal()
|
local pref_bg = wibox.widget.background()
|
||||||
pref_bg.fit = function(s,w,h)
|
local pref_l = wibox.layout.align.horizontal()
|
||||||
local w2,h2 = wibox.widget.background.fit(s,w,h)
|
pref_bg.fit = function(s,w,h)
|
||||||
return w2,currentMenu.item_height
|
local w2,h2 = wibox.widget.background.fit(s,w,h)
|
||||||
end
|
return w2,currentMenu.item_height
|
||||||
pref_bg:set_bg(currentMenu.bg_alternate)
|
end
|
||||||
local tb2= wibox.widget.textbox()
|
pref_bg:set_bg(currentMenu.bg_alternate)
|
||||||
tb2:set_text("foo!!!!")
|
local tb2= wibox.widget.textbox()
|
||||||
pref_l:set_first(tb2)
|
tb2:set_text("foo!!!!")
|
||||||
pref_bg:set_widget(pref_l)
|
pref_l:set_first(tb2)
|
||||||
local pref_menu,pref_menu_l = radical.bar{item_style=radical.item.style.basic}
|
pref_bg:set_widget(pref_l)
|
||||||
pref_menu:add_widget(radical.widgets.separator(pref_menu,radical.widgets.separator.VERTICAL))
|
local pref_menu,pref_menu_l = radical.bar{item_style=radical.item.style.basic}
|
||||||
pref_menu:add_item{text="Exclusive"}
|
pref_menu:add_widget(radical.widgets.separator(pref_menu,radical.widgets.separator.VERTICAL))
|
||||||
pref_menu:add_widget(radical.widgets.separator(pref_menu,radical.widgets.separator.VERTICAL))
|
pref_menu:add_item{text="Exclusive"}
|
||||||
pref_menu:add_item{text="12 clients"}
|
pref_menu:add_widget(radical.widgets.separator(pref_menu,radical.widgets.separator.VERTICAL))
|
||||||
pref_menu:add_widget(radical.widgets.separator(pref_menu,radical.widgets.separator.VERTICAL))
|
pref_menu:add_item{text="12 clients"}
|
||||||
pref_menu:add_item{text="All Screens"}
|
pref_menu:add_widget(radical.widgets.separator(pref_menu,radical.widgets.separator.VERTICAL))
|
||||||
pref_menu:add_widget(radical.widgets.separator(pref_menu,radical.widgets.separator.VERTICAL))
|
pref_menu:add_item{text="All Screens"}
|
||||||
pref_l:set_third(pref_menu_l)
|
pref_menu:add_widget(radical.widgets.separator(pref_menu,radical.widgets.separator.VERTICAL))
|
||||||
|
pref_l:set_third(pref_menu_l)
|
||||||
|
|
||||||
currentMenu:add_prefix_widget(pref_bg)
|
currentMenu:add_prefix_widget(pref_bg)
|
||||||
|
end
|
||||||
|
|
||||||
currentMenu:add_key_hook({}, "Tab", "press", select_next)
|
currentMenu:add_key_hook({}, "Tab", "press", select_next)
|
||||||
currentMenu:add_key_hook({}, "Shift_L", "press", function()
|
currentMenu:add_key_hook({}, "Shift_L", "press", function()
|
||||||
currentMenu._current_item.checked = not currentMenu._current_item.checked
|
currentMenu._current_item.checked = not currentMenu._current_item.checked
|
||||||
client2.toggletag (t, currentMenu._current_item.client)
|
client2.toggletag (t, currentMenu._current_item.client)
|
||||||
reload_underlay(currentMenu._current_item.client,currentMenu._current_item)
|
reload_underlay(currentMenu._current_item.client,currentMenu._current_item)
|
||||||
reload_highlight(currentMenu._current_item)
|
if not auto_release then
|
||||||
|
reload_highlight(currentMenu._current_item)
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -136,11 +142,13 @@ local function new(args)
|
||||||
if module.titlebar_path then
|
if module.titlebar_path then
|
||||||
for k,v2 in ipairs(histo) do
|
for k,v2 in ipairs(histo) do
|
||||||
local l,v = wibox.layout.fixed.horizontal(),v2[2]
|
local l,v = wibox.layout.fixed.horizontal(),v2[2]
|
||||||
l:add( button_group({client = v, field = "floating" , focus = false, checked = function() return v.floating end, onclick = function() v.floating = not v.floating end }))
|
if not auto_release then
|
||||||
l:add( button_group({client = v, field = "maximized", focus = false, checked = function() return v.maximized end, onclick = function() v.maximized = not v.maximized end }))
|
l:add( button_group({client = v, field = "floating" , focus = false, checked = function() return v.floating end, onclick = function() v.floating = not v.floating end }))
|
||||||
l:add( button_group({client = v, field = "sticky" , focus = false, checked = function() return v.sticky end, onclick = function() v.sticky = not v.sticky end }))
|
l:add( button_group({client = v, field = "maximized", focus = false, checked = function() return v.maximized end, onclick = function() v.maximized = not v.maximized end }))
|
||||||
l:add( button_group({client = v, field = "ontop" , focus = false, checked = function() return v.ontop end, onclick = function() v.ontop = not v.ontop end }))
|
l:add( button_group({client = v, field = "sticky" , focus = false, checked = function() return v.sticky end, onclick = function() v.sticky = not v.sticky end }))
|
||||||
l:add( button_group({client = v, field = "close" , focus = false, checked = function() return false end, onclick = function() v:kill() end }))
|
l:add( button_group({client = v, field = "ontop" , focus = false, checked = function() return v.ontop end, onclick = function() v.ontop = not v.ontop end }))
|
||||||
|
l:add( button_group({client = v, field = "close" , focus = false, checked = function() return false end, onclick = function() v:kill() end }))
|
||||||
|
end
|
||||||
|
|
||||||
local underlays = reload_underlay(v)
|
local underlays = reload_underlay(v)
|
||||||
|
|
||||||
|
@ -153,18 +161,23 @@ local function new(args)
|
||||||
underlay = underlays,
|
underlay = underlays,
|
||||||
checkable = not auto_release,
|
checkable = not auto_release,
|
||||||
checked = not auto_release and is_in_tag(t,v) or nil,
|
checked = not auto_release and is_in_tag(t,v) or nil,
|
||||||
button1 = function()
|
button1 = function(a,b,c,d,no_hide)
|
||||||
if v:tags()[1] and v:tags()[1].selected == false then
|
local t = focusTag[v] or v:tags()[1]
|
||||||
tag.viewonly(v:tags()[1])
|
if t and t.selected == false and not util.table.hasitem(v:tags(),tag.selected(v.screen)) then
|
||||||
|
tag.viewonly(t)
|
||||||
end
|
end
|
||||||
capi.client.focus = v
|
capi.client.focus = v
|
||||||
v:raise()
|
v:raise()
|
||||||
currentMenu.visible = false
|
if not no_hide then
|
||||||
|
currentMenu.visible = false
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
i.client = v
|
i.client = v
|
||||||
|
|
||||||
i:connect_signal("selected::changed",reload_highlight)
|
if not auto_release then
|
||||||
|
i:connect_signal("selected::changed",reload_highlight)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -181,7 +194,9 @@ local function new(args)
|
||||||
if not m.visible then
|
if not m.visible then
|
||||||
pause_monitoring = false
|
pause_monitoring = false
|
||||||
push_focus(capi.client.focus)
|
push_focus(capi.client.focus)
|
||||||
tag_list.highlight()
|
if not auto_release then
|
||||||
|
tag_list.highlight()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
return currentMenu
|
return currentMenu
|
||||||
|
|
Loading…
Reference in New Issue