Use Powerline for Tasklist
This commit is contained in:
parent
f22b49a467
commit
521dc19898
|
@ -15,35 +15,14 @@ local beautiful = require("beautiful")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
local theme = require("theme")
|
local theme = require("theme")
|
||||||
local lain = require("lain")
|
local lain = require("lain")
|
||||||
local dpi = beautiful.xresources.apply_dpi
|
|
||||||
local battery_widget = require("widgets.battery-widget.battery")
|
local battery_widget = require("widgets.battery-widget.battery")
|
||||||
local volume_widget = require("widgets.volume-widget.volume")
|
local volume_widget = require("widgets.volume-widget.volume")
|
||||||
|
local pl = require("powerline")
|
||||||
|
|
||||||
-- import widgets
|
-- import widgets
|
||||||
local task_list = require("widgets.task-list")
|
local task_list = require("widgets.task-list")
|
||||||
|
|
||||||
|
|
||||||
-- ===================================================================
|
|
||||||
-- Helper functions
|
|
||||||
-- ===================================================================
|
|
||||||
|
|
||||||
local function pl(widget, bgcolor, adjacentcolor)
|
|
||||||
local container = wibox.widget{
|
|
||||||
{
|
|
||||||
{
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
wibox.layout.margin(widget, dpi(6), dpi(10)),
|
|
||||||
lain.util.separators.arrow_left(bgcolor, adjacentcolor),
|
|
||||||
},
|
|
||||||
bg = bgcolor,
|
|
||||||
widget = wibox.container.background
|
|
||||||
},
|
|
||||||
top = 2, bottom = 2, left = 0, right = 0,
|
|
||||||
widget = wibox.container.margin
|
|
||||||
}
|
|
||||||
return container
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- Custom Widgets
|
-- Custom Widgets
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
local lain = require("lain")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
|
local dpi = beautiful.xresources.apply_dpi
|
||||||
|
|
||||||
|
-- ===================================================================
|
||||||
|
-- Helper functions
|
||||||
|
-- ===================================================================
|
||||||
|
|
||||||
|
local function powerline(widget, bgcolor, adjacentcolor, right)
|
||||||
|
right = right or false
|
||||||
|
local container = {
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
|
wibox.layout.margin(widget, dpi(6), dpi(10)),
|
||||||
|
}
|
||||||
|
if (not right) then
|
||||||
|
table.insert(container, lain.util.separators.arrow_left(bgcolor, adjacentcolor))
|
||||||
|
else
|
||||||
|
table.insert(container, lain.util.separators.arrow_right(bgcolor, adjacentcolor))
|
||||||
|
end
|
||||||
|
return wibox.widget{
|
||||||
|
{
|
||||||
|
container,
|
||||||
|
bg = bgcolor,
|
||||||
|
widget = wibox.container.background
|
||||||
|
},
|
||||||
|
top = 0, bottom = 0, left = 0, right = 0,
|
||||||
|
widget = wibox.container.margin
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return powerline
|
|
@ -71,7 +71,7 @@ theme.tasklist_fg_urgent = theme.fg_urgent
|
||||||
theme.tasklist_fg_normal = theme.fg_normal
|
theme.tasklist_fg_normal = theme.fg_normal
|
||||||
|
|
||||||
-- Panel Sizing
|
-- Panel Sizing
|
||||||
theme.top_panel_height = dpi(32)
|
theme.top_panel_height = dpi(30)
|
||||||
theme.top_panel_powerline = "#002F5F"
|
theme.top_panel_powerline = "#002F5F"
|
||||||
|
|
||||||
-- Notification Sizing
|
-- Notification Sizing
|
||||||
|
|
|
@ -15,6 +15,8 @@ local wibox = require('wibox')
|
||||||
local gears = require('gears')
|
local gears = require('gears')
|
||||||
local utf8 = require("utf8")
|
local utf8 = require("utf8")
|
||||||
local clickable_container = require('widgets.clickable-container')
|
local clickable_container = require('widgets.clickable-container')
|
||||||
|
local pl = require("powerline")
|
||||||
|
local theme = require("theme")
|
||||||
|
|
||||||
local dpi = require('beautiful').xresources.apply_dpi
|
local dpi = require('beautiful').xresources.apply_dpi
|
||||||
local capi = {button = button}
|
local capi = {button = button}
|
||||||
|
@ -58,22 +60,19 @@ end
|
||||||
local function list_update(w, buttons, label, data, objects)
|
local function list_update(w, buttons, label, data, objects)
|
||||||
-- update the widgets, creating them if needed
|
-- update the widgets, creating them if needed
|
||||||
w:reset()
|
w:reset()
|
||||||
|
local index = 0
|
||||||
|
local count = 0
|
||||||
|
for _ in pairs(objects) do
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
for i, o in ipairs(objects) do
|
for i, o in ipairs(objects) do
|
||||||
local cache = data[o]
|
index = index + 1
|
||||||
local ib, cb, tb, cbm, bgb, tbm, ibm, tt, l, ll, bg_clickable
|
local ib, cb, tb, cbm, bgb, tbm, ibm, tt, l, ll, bg_clickable
|
||||||
if cache then
|
|
||||||
ib = cache.ib
|
|
||||||
tb = cache.tb
|
|
||||||
bgb = cache.bgb
|
|
||||||
tbm = cache.tbm
|
|
||||||
ibm = cache.ibm
|
|
||||||
tt = cache.tt
|
|
||||||
else
|
|
||||||
ib = wibox.widget.imagebox()
|
ib = wibox.widget.imagebox()
|
||||||
tb = wibox.widget.textbox()
|
tb = wibox.widget.textbox()
|
||||||
cb = clickable_container(wibox.container.margin(wibox.widget.imagebox(ICON_DIR .. "close.svg"), dpi(9), dpi(9), dpi(9), dpi(9)))
|
cb = clickable_container(wibox.container.margin(wibox.widget.imagebox(ICON_DIR .. "close.svg"), dpi(9), dpi(9), dpi(9), dpi(9)))
|
||||||
cb.shape = gears.shape.circle
|
cb.shape = gears.shape.circle
|
||||||
cbm = wibox.container.margin(cb, dpi(4), dpi(8), dpi(2), dpi(2)) -- 4, 8 ,12 ,12 -- close button
|
cbm = wibox.container.margin(cb, dpi(0), dpi(0), dpi(0), dpi(0)) -- 4, 8 ,12 ,12 -- close button
|
||||||
cbm:buttons(gears.table.join(awful.button({}, 1, nil,
|
cbm:buttons(gears.table.join(awful.button({}, 1, nil,
|
||||||
function()
|
function()
|
||||||
o.kill(o)
|
o.kill(o)
|
||||||
|
@ -82,7 +81,7 @@ local function list_update(w, buttons, label, data, objects)
|
||||||
bg_clickable = clickable_container()
|
bg_clickable = clickable_container()
|
||||||
bgb = wibox.container.background()
|
bgb = wibox.container.background()
|
||||||
tbm = wibox.container.margin(tb, dpi(4), dpi(4))
|
tbm = wibox.container.margin(tb, dpi(4), dpi(4))
|
||||||
ibm = wibox.container.margin(ib, dpi(9), dpi(9), dpi(9), dpi(9)) -- 12 is default top and bottom margin --app icon
|
ibm = wibox.container.margin(ib, dpi(5), dpi(5), dpi(5), dpi(5)) -- 12 is default top and bottom margin --app icon
|
||||||
l = wibox.layout.fixed.horizontal()
|
l = wibox.layout.fixed.horizontal()
|
||||||
ll = wibox.layout.fixed.horizontal()
|
ll = wibox.layout.fixed.horizontal()
|
||||||
|
|
||||||
|
@ -93,7 +92,14 @@ local function list_update(w, buttons, label, data, objects)
|
||||||
ll:add(l)
|
ll:add(l)
|
||||||
ll:add(cbm)
|
ll:add(cbm)
|
||||||
|
|
||||||
bg_clickable:set_widget(ll)
|
|
||||||
|
if (index % 2 == 0) then
|
||||||
|
local end_color = count == index and "#12151c" or theme.top_panel_powerline
|
||||||
|
bg_clickable:set_widget(pl(ll, theme.bg_normal, end_color, true))
|
||||||
|
else
|
||||||
|
local end_color = count == index and "#12151c" or theme.bg_normal
|
||||||
|
bg_clickable:set_widget(pl(ll, theme.top_panel_powerline, end_color, true))
|
||||||
|
end
|
||||||
-- And all of this gets a background
|
-- And all of this gets a background
|
||||||
bgb:set_widget(bg_clickable)
|
bgb:set_widget(bg_clickable)
|
||||||
|
|
||||||
|
@ -107,16 +113,6 @@ local function list_update(w, buttons, label, data, objects)
|
||||||
delay_show = 1,
|
delay_show = 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
data[o] = {
|
|
||||||
ib = ib,
|
|
||||||
tb = tb,
|
|
||||||
bgb = bgb,
|
|
||||||
tbm = tbm,
|
|
||||||
ibm = ibm,
|
|
||||||
tt = tt
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local text, bg, bg_image, icon, args = label(o, tb)
|
local text, bg, bg_image, icon, args = label(o, tb)
|
||||||
args = args or {}
|
args = args or {}
|
||||||
|
|
||||||
|
@ -137,12 +133,12 @@ local function list_update(w, buttons, label, data, objects)
|
||||||
tb:set_markup('<i><Invalid text></i>')
|
tb:set_markup('<i><Invalid text></i>')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
bgb:set_bg(bg)
|
-- bgb:set_bg(bg)
|
||||||
if type(bg_image) == 'function' then
|
if type(bg_image) == 'function' then
|
||||||
-- TODO: Why does this pass nil as an argument?
|
-- TODO: Why does this pass nil as an argument?
|
||||||
bg_image = bg_image(tb, o, nil, objects, i)
|
bg_image = bg_image(tb, o, nil, objects, i)
|
||||||
end
|
end
|
||||||
bgb:set_bgimage(bg_image)
|
-- bgb:set_bgimage(bg_image)
|
||||||
if icon then
|
if icon then
|
||||||
ib.image = icon
|
ib.image = icon
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue