2022-08-31 12:20:58 +00:00
-- This file is part of Reno desktop.
--
-- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
--
-- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
2022-08-25 15:27:31 +00:00
-- Base for widgets
local awmtk2 = require ( " awmtk2 " )
local wibox = require ( " wibox " )
local gears = require ( " gears " )
local awful = require ( " awful " )
local beautiful = require ( " beautiful " )
return function ( args )
2022-09-06 22:40:51 +00:00
local style = awmtk2.create_style ( " taglist " ,
2023-01-19 13:42:20 +00:00
awmtk2.generic . oneline_widget , args.style , args.vertical )
2022-08-25 15:27:31 +00:00
local templates = awmtk2.create_template_lib ( " taglist " , awmtk2.templates , args.templates )
2023-01-16 12:47:51 +00:00
local t = awmtk2.build_templates ( templates , style , args.vertical )
2022-08-25 15:27:31 +00:00
local widget = wibox.widget ( t.container ( awful.widget . taglist ( {
screen = args.screen ,
filter = awful.widget . taglist.filter . all ,
style = {
shape = style.button . shape
} ,
layout = {
spacing = style.base . spacing ,
spacing_widget = style.base . spacing_widget ,
layout = style.base . layout or wibox.layout . fixed.horizontal
} ,
widget_template = t.button ( t.article ( {
icon_id = " icon_role " ,
title_id = " text_role "
} ) , {
id = " background " ,
create_callback = function ( self , tag , index , tags )
self : connect_signal ( " button::press " , function ( self , x , y , b )
if b == 1 then
awful.tag . viewmore ( { tag } )
elseif b == 3 then
awful.tag . viewtoggle ( tag )
2022-09-07 17:43:25 +00:00
elseif b == 4 then
awful.tag . viewnext ( )
elseif b == 5 then
awful.tag . viewprev ( )
2022-08-25 15:27:31 +00:00
end
end )
local bg = self : get_children_by_id ( " background " ) [ 1 ]
if tag.selected then
bg.bgimage = style.button . bgimage_focus
bg.bg = style.button . bg_focus
else
bg.bgimage = style.button . bgimage_normal
bg.bg = style.button . bg_normal
end
end ,
update_callback = function ( self , tag , index , tags )
local bg = self : get_children_by_id ( " background " ) [ 1 ]
if tag.selected then
bg.bgimage = style.button . bgimage_focus
bg.bg = style.button . bg_focus
else
bg.bgimage = style.button . bgimage_normal
bg.bg = style.button . bg_normal
end
end
} )
} ) ) )
return widget
end