Add filterClients and cycleClientsByIdx configuration for window_switcher widget (#162)
This commit is contained in:
parent
4d2d8e5e27
commit
c405103262
|
@ -24,6 +24,9 @@ bling.widget.window_switcher.enable {
|
|||
next_key = "Right", -- The key on which to select the next client
|
||||
vim_previous_key = "h", -- Alternative key on which to select the previous client
|
||||
vim_next_key = "l", -- Alternative key on which to select the next client
|
||||
|
||||
cycleClientsByIdx = awful.client.focus.byidx, -- The function to cycle the clients
|
||||
filterClients = awful.widget.tasklist.filter.currenttags, -- The function to filter the viewed clients
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -84,12 +84,14 @@ local function draw_widget(
|
|||
name_focus_color,
|
||||
icon_valign,
|
||||
icon_width,
|
||||
mouse_keys
|
||||
mouse_keys,
|
||||
filterClients
|
||||
)
|
||||
filterClients = filterClients or awful.widget.tasklist.filter.currenttags
|
||||
local tasklist_widget = type == "thumbnail"
|
||||
and awful.widget.tasklist({
|
||||
screen = awful.screen.focused(),
|
||||
filter = awful.widget.tasklist.filter.currenttags,
|
||||
filter = filterClients,
|
||||
buttons = mouse_keys,
|
||||
style = {
|
||||
font = name_font,
|
||||
|
@ -167,7 +169,7 @@ local function draw_widget(
|
|||
})
|
||||
or awful.widget.tasklist({
|
||||
screen = awful.screen.focused(),
|
||||
filter = awful.widget.tasklist.filter.currenttags,
|
||||
filter = filterClients,
|
||||
buttons = mouse_keys,
|
||||
style = {
|
||||
font = name_font,
|
||||
|
@ -274,6 +276,9 @@ local enable = function(opts)
|
|||
local scroll_previous_key = opts.scroll_previous_key or 4
|
||||
local scroll_next_key = opts.scroll_next_key or 5
|
||||
|
||||
local cycleClientsByIdx = opts.cycleClientsByIdx or awful.client.focus.byidx
|
||||
local filterClients = opts.filterClients or awful.widget.tasklist.filter.currenttags
|
||||
|
||||
local window_switcher_box = awful.popup({
|
||||
bg = "#00000000",
|
||||
visible = false,
|
||||
|
@ -308,7 +313,7 @@ local enable = function(opts)
|
|||
modifiers = { "Any" },
|
||||
button = scroll_previous_key,
|
||||
on_press = function()
|
||||
awful.client.focus.byidx(-1)
|
||||
cycleClientsByIdx(-1)
|
||||
end,
|
||||
}),
|
||||
|
||||
|
@ -316,7 +321,7 @@ local enable = function(opts)
|
|||
modifiers = { "Any" },
|
||||
button = scroll_next_key,
|
||||
on_press = function()
|
||||
awful.client.focus.byidx(1)
|
||||
cycleClientsByIdx(1)
|
||||
end,
|
||||
})
|
||||
)
|
||||
|
@ -343,21 +348,21 @@ local enable = function(opts)
|
|||
end,
|
||||
|
||||
[cycle_key] = function()
|
||||
awful.client.focus.byidx(1)
|
||||
cycleClientsByIdx(1)
|
||||
end,
|
||||
|
||||
[previous_key] = function()
|
||||
awful.client.focus.byidx(1)
|
||||
cycleClientsByIdx(1)
|
||||
end,
|
||||
[next_key] = function()
|
||||
awful.client.focus.byidx(-1)
|
||||
cycleClientsByIdx(-1)
|
||||
end,
|
||||
|
||||
[vim_previous_key] = function()
|
||||
awful.client.focus.byidx(1)
|
||||
cycleClientsByIdx(1)
|
||||
end,
|
||||
[vim_next_key] = function()
|
||||
awful.client.focus.byidx(-1)
|
||||
cycleClientsByIdx(-1)
|
||||
end,
|
||||
}
|
||||
|
||||
|
@ -445,8 +450,10 @@ local enable = function(opts)
|
|||
name_focus_color,
|
||||
icon_valign,
|
||||
icon_width,
|
||||
mouse_keys
|
||||
mouse_keys,
|
||||
filterClients
|
||||
)
|
||||
window_switcher_box.screen = awful.screen.focused()
|
||||
window_switcher_box.visible = true
|
||||
end)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue