feat: wire up buttons for tag list
This commit is contained in:
parent
4ac05d48a6
commit
fdcffa9650
@ -3,6 +3,36 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local wibox = require("wibox")
|
||||
local clickable_container = require("widget.clickable-container")
|
||||
|
||||
local capi = {button = _G.button}
|
||||
|
||||
function create_buttons(buttons, object)
|
||||
if buttons then
|
||||
local btns = {}
|
||||
for _, b in ipairs(buttons) do
|
||||
-- Create a proxy button object: it will receive the real
|
||||
-- press and release events, and will propagate them to the
|
||||
-- button object the user provided, but with the object as
|
||||
-- argument.
|
||||
local btn = capi.button {modifiers = b.modifiers, button = b.button}
|
||||
btn:connect_signal(
|
||||
'press',
|
||||
function()
|
||||
b:emit_signal('press', object)
|
||||
end
|
||||
)
|
||||
btn:connect_signal(
|
||||
'release',
|
||||
function()
|
||||
b:emit_signal('release', object)
|
||||
end
|
||||
)
|
||||
btns[#btns + 1] = btn
|
||||
end
|
||||
|
||||
return btns
|
||||
end
|
||||
end
|
||||
|
||||
function list_update(w, buttons, label, data, objects)
|
||||
-- update the widgets, creating them if needed
|
||||
w:reset()
|
||||
@ -35,7 +65,7 @@ function list_update(w, buttons, label, data, objects)
|
||||
-- bgb:set_widget(l)
|
||||
bgb:set_widget(bg_clickable)
|
||||
|
||||
bgb:buttons(common.create_buttons(buttons, o))
|
||||
bgb:buttons(create_buttons(buttons, o))
|
||||
|
||||
data[o] = {
|
||||
ib = ib,
|
||||
|
@ -4,10 +4,12 @@
|
||||
|
||||
(local awful (require :awful))
|
||||
(local beautiful (require :beautiful))
|
||||
(local gears (require :gears))
|
||||
(local wibox (require :wibox))
|
||||
(local common (require :awful.widget.common))
|
||||
(local dpi (. (require :beautiful) :xresources :apply_dpi))
|
||||
|
||||
(local button (. (require :lib.keys) :button))
|
||||
(local std (require :lib.std))
|
||||
|
||||
;;;
|
||||
@ -93,7 +95,11 @@
|
||||
(awful.widget.taglist
|
||||
s
|
||||
awful.widget.taglist.filter.all
|
||||
{}
|
||||
(gears.table.join
|
||||
(button [] 1 (lambda [t] (: t :view_only)))
|
||||
(button [] 3 (lambda [t] (when _G.client.focus (: _G.client.focus :move_to_tag t))))
|
||||
(button [] 4 (lambda [t] (awful.tag.viewnext t.screen)))
|
||||
(button [] 5 (lambda [t] (awful.tag.viewprev t.screen))))
|
||||
{:font (.. beautiful.font " Bold 10")
|
||||
:spacing 2}
|
||||
;; update-tag-list
|
||||
|
Loading…
Reference in New Issue
Block a user