fix audio (hopefully last time), added new widgets(cpu/gpu/ram info), reworked the bars a bit, more stuff and fixes

This commit is contained in:
Kievits Rene
2022-05-08 01:51:44 +02:00
parent bfd342deac
commit 46d338cbaf
24 changed files with 1296 additions and 794 deletions

View File

@@ -8,75 +8,115 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears") local gears = require("gears")
local wibox = require("wibox") local wibox = require("wibox")
return function(s, widget) return function(s, widgets)
local top_center = awful.popup { local top_center = awful.popup {
screen = s, screen = s,
widget = wibox.container.background, widget = wibox.container.background,
ontop = false, ontop = false,
bg = color["Grey900"], bg = color["Grey900"],
visible = true, visible = true,
maximum_width = dpi(500), maximum_width = dpi(500),
placement = function(c) awful.placement.top(c, { margins = dpi(10) }) end, placement = function(c) awful.placement.top(c, { margins = dpi(10) }) end,
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5) gears.shape.rounded_rect(cr, width, height, 5)
end end
}
top_center:struts {
top = 55
}
local function prepare_widgets(widgets)
local layout = {
forced_height = 45,
layout = wibox.layout.fixed.horizontal
} }
for i, widget in pairs(widgets) do
if i == 1 then
table.insert(layout,
{
widget,
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
elseif i == #widgets then
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
else
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
end
end
return layout
end
top_center:setup { top_center:setup {
nil, nil,
{ prepare_widgets(widgets),
widget, nil,
margins = dpi(6), layout = wibox.layout.fixed.horizontal
widget = wibox.container.margin }
},
nil,
forced_height = 45,
layout = wibox.layout.align.horizontal
}
client.connect_signal( client.connect_signal(
"manage", "manage",
function(c) function(c)
if #s.selected_tag:clients() < 1 then if #s.selected_tag:clients() < 1 then
top_center.visible = false top_center.visible = false
else else
top_center.visible = true top_center.visible = true
end end
end end
) )
client.connect_signal( client.connect_signal(
"unmanage", "unmanage",
function(c) function(c)
if #s.selected_tag:clients() < 1 then if #s.selected_tag:clients() < 1 then
top_center.visible = false top_center.visible = false
else else
top_center.visible = true top_center.visible = true
end end
end end
) )
client.connect_signal( client.connect_signal(
"tag::switched", "tag::switched",
function(c) function(c)
if #s.selected_tag:clients() < 1 then if #s.selected_tag:clients() < 1 then
top_center.visible = false top_center.visible = false
else else
top_center.visible = true top_center.visible = true
end end
end end
) )
awesome.connect_signal( awesome.connect_signal(
"refresh", "refresh",
function(c) function(c)
if #s.selected_tag:clients() < 1 then if #s.selected_tag:clients() < 1 then
top_center.visible = false top_center.visible = false
else else
top_center.visible = true top_center.visible = true
end end
end end
) )
end end

View File

@@ -10,285 +10,289 @@ local wibox = require("wibox")
return function(screen, programs) return function(screen, programs)
local function create_dock_element(class, program, name, is_steam, size) local function create_dock_element(class, program, name, is_steam, size)
if program == nil or class == nil then if program == nil or class == nil then
return return
end
is_steam = is_steam or false
local dock_element = wibox.widget {
{
{
{
resize = true,
forced_width = size,
forced_height = size,
image = Get_icon(user_vars.icon_theme, nil, program, class, is_steam),
widget = wibox.widget.imagebox,
id = "icon"
},
margins = dpi(5),
widget = wibox.container.margin,
id = "margin"
},
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end,
bg = color["Grey900"],
widget = wibox.container.background,
id = "background"
},
top = dpi(5),
left = dpi(5),
right = dpi(5),
widget = wibox.container.margin
}
for k, c in ipairs(client.get()) do
if string.lower(c.class):match(program) and c == client.focus then
dock_element.background.bg = color["Grey800"]
end
end
Hover_signal(dock_element.background, color["Grey800"], color["White"])
dock_element:connect_signal(
"button::press",
function()
if is_steam then
awful.spawn("steam steam://rungameid/" .. program)
else
awful.spawn(program)
end
end
)
awful.tooltip {
objects = { dock_element },
text = name,
mode = "outside",
preferred_alignments = "middle",
margins = dpi(10)
}
return dock_element
end end
is_steam = is_steam or false
local dock = awful.popup { local dock_element = wibox.widget {
widget = wibox.container.background, {
ontop = true, {
bg = color["Grey900"], {
visible = true, resize = true,
screen = screen, forced_width = size,
type = "dock", forced_height = size,
height = user_vars.dock_icon_size + 10, image = Get_icon(user_vars.icon_theme, nil, program, class, is_steam),
placement = function(c) awful.placement.bottom(c, { margins = dpi(10) }) end, widget = wibox.widget.imagebox,
id = "icon"
},
margins = dpi(5),
widget = wibox.container.margin,
id = "margin"
},
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 15) gears.shape.rounded_rect(cr, width, height, 10)
end end,
} bg = color["Grey900"],
local fakedock = awful.popup {
widget = wibox.container.background, widget = wibox.container.background,
ontop = true, id = "background"
bg = '#00000000', },
visible = true, top = dpi(5),
screen = screen, left = dpi(5),
type = "dock", right = dpi(5),
id = "fakedock", widget = wibox.container.margin
height = dpi(10),
placement = function(c) awful.placement.bottom(c, { margins = dpi(0) }) end,
} }
local function get_dock_elements(pr) for k, c in ipairs(client.get()) do
local dock_elements = { layout = wibox.layout.fixed.horizontal } if string.lower(c.class):match(program) and c == client.focus then
dock_element.background.bg = color["Grey800"]
for i, p in ipairs(pr) do end
dock_elements[i] = create_dock_element(p[1], p[2], p[3], p[4], user_vars.dock_icon_size)
end
return dock_elements
end end
local dock_elements = get_dock_elements(programs) Hover_signal(dock_element.background, color["Grey800"], color["White"])
local function get_fake_elements(amount) dock_element:connect_signal(
local fake_elements = { layout = wibox.layout.fixed.horizontal } "button::press",
function()
for i = 0, amount, 1 do if is_steam then
fake_elements[i] = wibox.widget { awful.spawn("steam steam://rungameid/" .. program)
bg = '00000000', else
forced_width = user_vars.dock_icon_size + dpi(20), awful.spawn(program)
forced_height = dpi(10), end
id = "fake",
widget = wibox.container.background
}
end
return fake_elements
end end
)
local function create_incicator_widget(prog) awful.tooltip {
local container = { layout = wibox.layout.flex.horizontal } objects = { dock_element },
local clients = client.get() text = name,
for index, pr in ipairs(prog) do mode = "outside",
local indicators = { layout = wibox.layout.flex.horizontal, spacing = dpi(5) } preferred_alignments = "middle",
local col = color["Grey600"] margins = dpi(10)
for i, c in ipairs(clients) do
if string.lower(c.class or c.name):match(string.lower(pr[1]) or string.lower(pr[2])) then
if c == client.focus then
col = color["YellowA200"]
elseif c.urgent then
col = color["RedA200"]
elseif c.maximized then
col = color["GreenA200"]
elseif c.minimized then
col = color["BlueA200"]
elseif c.fullscreen then
col = color["PinkA200"]
else
col = color["Grey600"]
end
indicators[i] = wibox.widget {
widget = wibox.container.background,
shape = gears.shape.rounded_rect,
forced_height = dpi(3),
bg = col,
forced_width = dpi(5),
}
end
end
container[index] = wibox.widget {
indicators,
forced_height = dpi(5),
forced_width = dpi(50),
left = dpi(5),
right = dpi(5),
widget = wibox.container.margin,
}
end
return wibox.widget {
container,
bottom = dpi(5),
widget = wibox.container.margin,
}
end
fakedock:setup {
get_fake_elements(#programs),
type = 'dock',
layout = wibox.layout.fixed.vertical
} }
local function check_for_dock_hide(s) return dock_element
local naughty = require("naughty") end
if #s.selected_tag:clients() < 1 then
dock.visible = true local dock = awful.popup {
return widget = wibox.container.background,
ontop = true,
bg = color["Grey900"],
visible = true,
screen = screen,
type = "dock",
height = user_vars.dock_icon_size + 10,
placement = function(c) awful.placement.bottom(c, { margins = dpi(10) }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 15)
end
}
local fakedock = awful.popup {
widget = wibox.container.background,
ontop = true,
bg = '#00000000',
visible = true,
screen = screen,
type = "dock",
id = "fakedock",
height = dpi(10),
placement = function(c) awful.placement.bottom(c, { margins = dpi(0) }) end,
}
local function get_dock_elements(pr)
local dock_elements = { layout = wibox.layout.fixed.horizontal }
for i, p in ipairs(pr) do
dock_elements[i] = create_dock_element(p[1], p[2], p[3], p[4], user_vars.dock_icon_size)
end
return dock_elements
end
local dock_elements = get_dock_elements(programs)
local function get_fake_elements(amount)
local fake_elements = { layout = wibox.layout.fixed.horizontal }
for i = 0, amount, 1 do
fake_elements[i] = wibox.widget {
bg = '00000000',
forced_width = user_vars.dock_icon_size + dpi(20),
forced_height = dpi(10),
id = "fake",
widget = wibox.container.background
}
end
return fake_elements
end
local function create_incicator_widget(prog)
local container = { layout = wibox.layout.flex.horizontal }
local clients = client.get()
for index, pr in ipairs(prog) do
local indicators = { layout = wibox.layout.flex.horizontal, spacing = dpi(5) }
local col = color["Grey600"]
for i, c in ipairs(clients) do
if string.lower(c.class or c.name):match(string.lower(pr[1]) or string.lower(pr[2])) then
if c == client.focus then
col = color["YellowA200"]
elseif c.urgent then
col = color["RedA200"]
elseif c.maximized then
col = color["GreenA200"]
elseif c.minimized then
col = color["BlueA200"]
elseif c.fullscreen then
col = color["PinkA200"]
else
col = color["Grey600"]
end
indicators[i] = wibox.widget {
widget = wibox.container.background,
shape = gears.shape.rounded_rect,
forced_height = dpi(3),
bg = col,
forced_width = dpi(5),
}
end end
if s == mouse.screen then end
--[[ if mouse.current_widget then container[index] = wibox.widget {
indicators,
forced_height = dpi(5),
forced_width = dpi(50),
left = dpi(5),
right = dpi(5),
widget = wibox.container.margin,
}
end
return wibox.widget {
container,
bottom = dpi(5),
widget = wibox.container.margin,
}
end
fakedock:setup {
get_fake_elements(#programs),
type = 'dock',
layout = wibox.layout.fixed.vertical
}
local function check_for_dock_hide(s)
local naughty = require("naughty")
if #s.selected_tag:clients() < 1 then
dock.visible = true
return
end
if s == mouse.screen then
--[[ if mouse.current_widget then
if tostring(mouse.current_widget):match("fake") then if tostring(mouse.current_widget):match("fake") then
dock.visible = true dock.visible = true
return return
end end
end ]] end ]]
local visible = false local visible = false
for j, c in ipairs(s.selected_tag:clients()) do for j, c in ipairs(s.selected_tag:clients()) do
--naughty.notify({ title = tostring(c.class) }) --naughty.notify({ title = tostring(c.class) })
if c.maximized or c.fullscreen then if c.maximized or c.fullscreen then
dock.visible = false dock.visible = false
return return
end end
local y = c:geometry().y local y = c:geometry().y
local h = c.height local h = c.height
if (y + h) >= s.geometry.height - user_vars.dock_icon_size - 35 then if (y + h) >= s.geometry.height - user_vars.dock_icon_size - 35 then
dock.visible = false dock.visible = false
return return
else else
dock.visible = true dock.visible = true
end end
--[[ if visible then --[[ if visible then
dock.visible = visible dock.visible = visible
return return
end ]] end ]]
end end
else else
dock.visible = false dock.visible = false
end
end end
end
local dock_intelligent_hide = gears.timer { local dock_intelligent_hide = gears.timer {
timeout = 1, timeout = 1,
autostart = true, autostart = true,
call_now = true, call_now = true,
callback = function() callback = function()
check_for_dock_hide(screen) check_for_dock_hide(screen)
end end
} }
fakedock:connect_signal( fakedock:connect_signal(
"mouse::enter", "mouse::enter",
function() function()
dock_intelligent_hide:stop() for index, c in ipairs(screen.clients) do
dock.visible = true if not c.fullscreen then
end dock_intelligent_hide:stop()
) dock.visible = true
end
client.connect_signal( end
"manage", end
function() )
check_for_dock_hide(screen)
dock:setup {
dock_elements,
create_incicator_widget(programs),
layout = wibox.layout.fixed.vertical
}
end
)
client.connect_signal(
"unmanage",
function()
check_for_dock_hide(screen)
dock:setup {
dock_elements,
create_incicator_widget(programs),
layout = wibox.layout.fixed.vertical
}
end
)
client.connect_signal(
"focus",
function()
check_for_dock_hide(screen)
dock:setup {
dock_elements,
create_incicator_widget(programs),
layout = wibox.layout.fixed.vertical
}
end
)
dock:connect_signal(
"mouse::enter",
function()
dock_intelligent_hide:stop()
end
)
dock:connect_signal(
"mouse::leave",
function()
dock_intelligent_hide:again()
end
)
client.connect_signal(
"manage",
function()
check_for_dock_hide(screen)
dock:setup { dock:setup {
get_dock_elements(programs), dock_elements,
create_incicator_widget(programs), create_incicator_widget(programs),
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
} }
end
)
client.connect_signal(
"unmanage",
function()
check_for_dock_hide(screen)
dock:setup {
dock_elements,
create_incicator_widget(programs),
layout = wibox.layout.fixed.vertical
}
end
)
client.connect_signal(
"focus",
function()
check_for_dock_hide(screen)
dock:setup {
dock_elements,
create_incicator_widget(programs),
layout = wibox.layout.fixed.vertical
}
end
)
dock:connect_signal(
"mouse::enter",
function()
dock_intelligent_hide:stop()
end
)
dock:connect_signal(
"mouse::leave",
function()
dock_intelligent_hide:again()
end
)
dock:setup {
get_dock_elements(programs),
create_incicator_widget(programs),
layout = wibox.layout.fixed.vertical
}
end end

View File

@@ -8,56 +8,55 @@ awful.screen.connect_for_each_screen(
-- For each screen this function is called once -- For each screen this function is called once
-- If you want to change the modules per screen use the indices -- If you want to change the modules per screen use the indices
-- e.g. 1 would be the primary screen and 2 the secondary screen. -- e.g. 1 would be the primary screen and 2 the secondary screen.
function(s) function(s)
-- Create 9 tags -- Create 9 tags
awful.layout.layouts = user_vars.layouts awful.layout.layouts = user_vars.layouts
awful.tag( awful.tag(
{ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, { "1", "2", "3", "4", "5", "6", "7", "8", "9" },
s, s,
user_vars.layouts[1] user_vars.layouts[1]
) )
require("src.modules.powermenu")(s) require("src.modules.powermenu")(s)
-- TODO: rewrite calendar osd, maybe write an own inplementation -- TODO: rewrite calendar osd, maybe write an own inplementation
-- require("src.modules.calendar_osd")(s) -- require("src.modules.calendar_osd")(s)
require("src.modules.volume_osd")(s) require("src.modules.volume_osd")(s)
require("src.modules.brightness_osd")(s) require("src.modules.brightness_osd")(s)
require("src.modules.titlebar") require("src.modules.titlebar")
require("src.modules.volume_controller")(s)
-- Widgets -- Widgets
s.battery = require("src.widgets.battery")() s.battery = require("src.widgets.battery")()
s.network = require("src.widgets.network")() s.network = require("src.widgets.network")()
s.audio = require("src.widgets.audio")() s.audio = require("src.widgets.audio")()
s.date = require("src.widgets.date")() s.date = require("src.widgets.date")()
s.clock = require("src.widgets.clock")() s.clock = require("src.widgets.clock")()
s.bluetooth = require("src.widgets.bluetooth")() s.bluetooth = require("src.widgets.bluetooth")()
s.layoutlist = require("src.widgets.layout_list")() s.layoutlist = require("src.widgets.layout_list")()
s.powerbutton = require("src.widgets.power")() s.powerbutton = require("src.widgets.power")()
s.kblayout = require("src.widgets.kblayout")(s) s.kblayout = require("src.widgets.kblayout")(s)
s.taglist = require("src.widgets.taglist")(s) s.taglist = require("src.widgets.taglist")(s)
s.tasklist = require("src.widgets.tasklist")(s) s.tasklist = require("src.widgets.tasklist")(s)
s.systray = require("src.widgets.systray")(s) s.systray = require("src.widgets.systray")(s)
s.cpu_usage = require("src.widgets.cpu_info")("usage")
s.cpu_temp = require("src.widgets.cpu_info")("temp")
s.cpu_freq = require("src.widgets.cpu_info")("freq", "average")
s.ram_info = require("src.widgets.ram_info")()
s.gpu_usage = require("src.widgets.gpu_info")("usage")
s.gpu_temp = require("src.widgets.gpu_info")("temp")
-- Add more of these if statements if you want to change
-- the modules/widgets per screen.
if s.index == 1 then
require("crylia_bar.left_bar")(s, { s.layoutlist, s.systray, s.taglist })
require("crylia_bar.center_bar")(s, { s.tasklist })
require("crylia_bar.right_bar")(s, { s.gpu_usage, s.gpu_temp, s.cpu_usage, s.cpu_temp, s.audio, s.kblayout, s.date, s.clock, s.powerbutton })
require("crylia_bar.dock")(s, user_vars.dock_programs)
end
-- Add more of these if statements if you want to change if s.index == 2 then
-- the modules/widgets per screen. require("crylia_bar.left_bar")(s, { s.layoutlist, s.taglist })
-- uncomment this example and dont forget to remove/comment the other code below require("crylia_bar.center_bar")(s, { s.tasklist })
--[[ if s.index == 1 then require("crylia_bar.right_bar")(s, { s.ram_info, s.audio, s.kblayout, s.network, s.date, s.clock, s.powerbutton })
require("crylia_bar.left_bar")(s, {s.layoutlist, s.systray, s.taglist}) end
require("crylia_bar.center_bar")(s, s.tasklist) end
require("crylia_bar.right_bar")(s, {s.date, s.clock,s.powerbutton})
require("crylia_bar.dock")(s, user_vars.dock_programs)
end ]]
--[[ if s.index == 2 then
require("crylia_bar.left_bar")(s, {s.layoutlist, s.systray, s.taglist})
require("crylia_bar.center_bar")(s, s.tasklist)
require("crylia_bar.right_bar")(s, {s.battery, s.network, s.bluetooth, s.audio, s.kblayout, s.date, s.clock,s.powerbutton})
end ]]
-- Bars
require("crylia_bar.left_bar")(s, { s.layoutlist, s.systray, s.taglist })
require("crylia_bar.center_bar")(s, s.tasklist)
require("crylia_bar.right_bar")(s, { s.battery, s.network, s.bluetooth, s.audio, s.kblayout, s.date, s.clock, s.powerbutton })
require("crylia_bar.dock")(s, user_vars.dock_programs)
end
) )

View File

@@ -10,54 +10,68 @@ local wibox = require("wibox")
return function(s, widgets) return function(s, widgets)
local top_left = awful.popup { local top_left = awful.popup {
screen = s, screen = s,
widget = wibox.container.background, widget = wibox.container.background,
ontop = false, ontop = false,
bg = color["Grey900"], bg = color["Grey900"],
visible = true, visible = true,
maximum_width = dpi(650), maximum_width = dpi(650),
placement = function(c) awful.placement.top_left(c, { margins = dpi(10) }) end, placement = function(c) awful.placement.top_left(c, { margins = dpi(10) }) end,
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5) gears.shape.rounded_rect(cr, width, height, 5)
end end
} }
top_left:struts { top_left:struts {
top = 55 top = 55
} }
top_left:setup { local function prepare_widgets(widgets)
{ local layout = {
{ forced_height = 45,
widgets[1], layout = wibox.layout.fixed.horizontal
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
},
{
widgets[2],
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
},
{
widgets[3],
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
},
forced_height = 45,
layout = wibox.layout.fixed.horizontal
},
nil,
nil,
layout = wibox.layout.fixed.horizontal
} }
for i, widget in pairs(widgets) do
if i == 1 then
table.insert(layout,
{
widget,
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
elseif i == #widgets then
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
else
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
end
end
return layout
end
top_left:setup {
prepare_widgets(widgets),
nil,
nil,
layout = wibox.layout.fixed.horizontal
}
end end

View File

@@ -10,89 +10,67 @@ local wibox = require("wibox")
return function(s, widgets) return function(s, widgets)
local top_right = awful.popup { local top_right = awful.popup {
widget = wibox.container.background, widget = wibox.container.background,
ontop = false, ontop = false,
bg = color["Grey900"], bg = color["Grey900"],
visible = true, visible = true,
screen = s, screen = s,
placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end, placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end,
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5) gears.shape.rounded_rect(cr, width, height, 5)
end end
} }
top_right:setup { top_right:struts {
nil, top = 55
nil, }
{
{ local function prepare_widgets(widgets)
widgets[1], local layout = {
left = dpi(6), forced_height = 45,
right = dpi(3), layout = wibox.layout.fixed.horizontal
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
},
{
widgets[2],
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
},
{
widgets[3],
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
},
{
widgets[4],
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
},
{
widgets[5],
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
},
{
widgets[6],
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
},
{
widgets[7],
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
},
{
widgets[8],
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
},
forced_height = 45,
layout = wibox.layout.fixed.horizontal
},
layout = wibox.layout.align.horizontal
} }
for i, widget in pairs(widgets) do
if i == 1 then
table.insert(layout,
{
widget,
left = dpi(6),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
elseif i == #widgets then
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(6),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
else
table.insert(layout,
{
widget,
left = dpi(3),
right = dpi(3),
top = dpi(6),
bottom = dpi(6),
widget = wibox.container.margin
})
end
end
return layout
end
top_right:setup {
nil,
nil,
prepare_widgets(widgets),
layout = wibox.layout.align.horizontal
}
end end

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M12,1C7,1 3,5 3,10V17A3,3 0 0,0 6,20H9V12H5V10A7,7 0 0,1 12,3A7,7 0 0,1 19,10V12H15V20H18A3,3 0 0,0 21,17V10C21,5 16.97,1 12,1Z" /></svg>

After

Width:  |  Height:  |  Size: 422 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M7,10L12,15L17,10H7Z" /></svg>

After

Width:  |  Height:  |  Size: 315 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M7,15L12,10L17,15H7Z" /></svg>

After

Width:  |  Height:  |  Size: 315 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M19,11C19,12.19 18.66,13.3 18.1,14.28L16.87,13.05C17.14,12.43 17.3,11.74 17.3,11H19M15,11.16L9,5.18V5A3,3 0 0,1 12,2A3,3 0 0,1 15,5V11L15,11.16M4.27,3L21,19.73L19.73,21L15.54,16.81C14.77,17.27 13.91,17.58 13,17.72V21H11V17.72C7.72,17.23 5,14.41 5,11H6.7C6.7,14 9.24,16.1 12,16.1C12.81,16.1 13.6,15.91 14.31,15.58L12.65,13.92L12,14A3,3 0 0,1 9,11V10.28L3,4.27L4.27,3Z" /></svg>

After

Width:  |  Height:  |  Size: 661 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z" /></svg>

After

Width:  |  Height:  |  Size: 476 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M17,17H7V7H17M21,11V9H19V7C19,5.89 18.1,5 17,5H15V3H13V5H11V3H9V5H7C5.89,5 5,5.89 5,7V9H3V11H5V13H3V15H5V17A2,2 0 0,0 7,19H9V21H11V19H13V21H15V19H17A2,2 0 0,0 19,17V15H21V13H19V11M13,13H11V11H13M15,9H9V15H15V9Z" /></svg>

After

Width:  |  Height:  |  Size: 505 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M12,4A6,6 0 0,0 6,10C6,13.31 8.69,16 12.1,16L11.22,13.77C10.95,13.29 11.11,12.68 11.59,12.4L12.45,11.9C12.93,11.63 13.54,11.79 13.82,12.27L15.74,14.69C17.12,13.59 18,11.9 18,10A6,6 0 0,0 12,4M12,9A1,1 0 0,1 13,10A1,1 0 0,1 12,11A1,1 0 0,1 11,10A1,1 0 0,1 12,9M7,18A1,1 0 0,0 6,19A1,1 0 0,0 7,20A1,1 0 0,0 8,19A1,1 0 0,0 7,18M12.09,13.27L14.58,19.58L17.17,18.08L12.95,12.77L12.09,13.27Z" /></svg>

After

Width:  |  Height:  |  Size: 754 B

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24">
<path d="M2,7V8.5H3V17H4.5V7C3.7,7 2.8,7 2,7M6,7V7L6,16H7V17H14V16H22V7H6M17.5,9A2.5,2.5 0 0,1 20,11.5A2.5,2.5 0 0,1 17.5,14A2.5,2.5 0 0,1 15,11.5A2.5,2.5 0 0,1 17.5,9Z" />
</svg>

After

Width:  |  Height:  |  Size: 461 B

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1">
<g id="surface1">
<path style=" stroke:none;fill-rule:evenodd;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 0 7.421875 L 0 9.878906 L 0.4375 9.902344 C 1.09375 9.933594 1.367188 10.148438 1.367188 10.625 C 1.367188 11.066406 1.113281 11.253906 0.472656 11.285156 L 0 11.308594 L 0 16.21875 L 1.40625 16.21875 L 1.40625 19.03125 L 9.882812 19.03125 L 9.898438 17.894531 C 9.917969 16.484375 10.011719 16.265625 10.59375 16.265625 C 11.175781 16.265625 11.269531 16.488281 11.289062 17.894531 L 11.304688 19.03125 L 22.59375 19.03125 L 22.59375 16.21875 L 24 16.21875 L 24 11.308594 L 23.527344 11.285156 C 22.890625 11.257812 22.632812 11.066406 22.632812 10.625 C 22.632812 10.148438 22.90625 9.933594 23.558594 9.902344 L 24 9.878906 L 24 4.96875 L 0 4.96875 L 0 7.421875 M 22.59375 7.472656 L 22.59375 8.566406 L 22.324219 8.699219 C 20.804688 9.4375 20.800781 11.773438 22.3125 12.5 L 22.59375 12.632812 L 22.59375 14.8125 L 1.40625 14.8125 L 1.40625 12.632812 L 1.6875 12.5 C 3.199219 11.773438 3.1875 9.386719 1.667969 8.691406 L 1.40625 8.570312 L 1.40625 6.375 L 22.59375 6.375 L 22.59375 7.472656 M 4.265625 10.59375 L 4.265625 13.40625 L 8.484375 13.40625 L 8.484375 7.78125 L 4.265625 7.78125 L 4.265625 10.59375 M 9.890625 10.59375 L 9.890625 13.40625 L 14.109375 13.40625 L 14.109375 7.78125 L 9.890625 7.78125 L 9.890625 10.59375 M 15.515625 10.59375 L 15.515625 13.40625 L 19.734375 13.40625 L 19.734375 7.78125 L 15.515625 7.78125 L 15.515625 10.59375 M 7.078125 10.59375 L 7.078125 12 L 5.671875 12 L 5.671875 9.1875 L 7.078125 9.1875 L 7.078125 10.59375 M 12.703125 10.59375 L 12.703125 12 L 11.296875 12 L 11.296875 9.1875 L 12.703125 9.1875 L 12.703125 10.59375 M 18.328125 10.59375 L 18.328125 12 L 16.921875 12 L 16.921875 9.1875 L 18.328125 9.1875 L 18.328125 10.59375 M 8.527344 16.371094 C 8.503906 16.453125 8.484375 16.769531 8.484375 17.074219 L 8.484375 17.625 L 2.8125 17.625 L 2.8125 16.21875 L 8.570312 16.21875 L 8.527344 16.371094 M 21.1875 16.921875 L 21.1875 17.625 L 12.703125 17.625 L 12.703125 17.074219 C 12.703125 16.769531 12.683594 16.453125 12.660156 16.371094 L 12.617188 16.21875 L 21.1875 16.21875 L 21.1875 16.921875 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M15 13V5A3 3 0 0 0 9 5V13A5 5 0 1 0 15 13M12 4A1 1 0 0 1 13 5H11A1 1 0 0 1 12 4Z" /></svg>

After

Width:  |  Height:  |  Size: 375 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M15 13V5A3 3 0 0 0 9 5V13A5 5 0 1 0 15 13M12 4A1 1 0 0 1 13 5V12H11V5A1 1 0 0 1 12 4Z" /></svg>

After

Width:  |  Height:  |  Size: 380 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M15 13V5A3 3 0 0 0 9 5V13A5 5 0 1 0 15 13M12 4A1 1 0 0 1 13 5V8H11V5A1 1 0 0 1 12 4Z" /></svg>

After

Width:  |  Height:  |  Size: 379 B

View File

@@ -0,0 +1 @@
Lutris;Steam;Io.elementary.appcenter;Repoman;Com.github.donadigo.eddy;Sysmontask;join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=Gnome-calculator;Virt-manager;Gwe;

View File

@@ -15,229 +15,229 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/"
-- Returns the volume_osd -- Returns the volume_osd
return function(s) return function(s)
local volume_osd_widget = wibox.widget { local volume_osd_widget = wibox.widget {
{
{
{ {
{
nil,
{ {
{ nil,
{ {
nil, id = "icon",
{ forced_height = dpi(220),
nil, image = icondir .. "volume-high.svg",
{ widget = wibox.widget.imagebox
id = "icon", },
forced_height = dpi(220), nil,
image = icondir .. "volume-high.svg", expand = "none",
widget = wibox.widget.imagebox id = "icon_margin2",
}, layout = wibox.layout.align.vertical
nil,
expand = "none",
id = "icon_margin2",
layout = wibox.layout.align.vertical
},
nil,
id = "icon_margin1",
expand = "none",
layout = wibox.layout.align.horizontal
},
{
{
id = "label",
text = "Volume",
align = "left",
valign = "center",
widget = wibox.widget.textbox
},
nil,
{
id = "value",
text = "0%",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "label_value_layout",
forced_height = dpi(48),
layout = wibox.layout.align.horizontal,
},
{
{
id = "volume_slider",
bar_shape = gears.shape.rounded_rect,
bar_height = dpi(10),
bar_color = color["Grey800"] .. "88",
bar_active_color = "#ffffff",
handle_color = "#ffffff",
handle_shape = gears.shape.circle,
handle_width = dpi(10),
handle_border_color = color["White"],
maximum = 100,
widget = wibox.widget.slider
},
id = "slider_layout",
forced_height = dpi(24),
widget = wibox.container.place
},
id = "icon_slider_layout",
spacing = dpi(0),
layout = wibox.layout.align.vertical
},
id = "osd_layout",
layout = wibox.layout.align.vertical
}, },
id = "container", nil,
left = dpi(24), id = "icon_margin1",
right = dpi(24), expand = "none",
widget = wibox.container.margin layout = wibox.layout.align.horizontal
},
{
{
id = "label",
text = "Volume",
align = "left",
valign = "center",
widget = wibox.widget.textbox
},
nil,
{
id = "value",
text = "0%",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "label_value_layout",
forced_height = dpi(48),
layout = wibox.layout.align.horizontal,
},
{
{
id = "volume_slider",
bar_shape = gears.shape.rounded_rect,
bar_height = dpi(10),
bar_color = color["Grey800"] .. "88",
bar_active_color = "#ffffff",
handle_color = "#ffffff",
handle_shape = gears.shape.circle,
handle_width = dpi(10),
handle_border_color = color["White"],
maximum = 100,
widget = wibox.widget.slider
},
id = "slider_layout",
forced_height = dpi(24),
widget = wibox.container.place
},
id = "icon_slider_layout",
spacing = dpi(0),
layout = wibox.layout.align.vertical
}, },
bg = color["Grey900"] .. '88', id = "osd_layout",
widget = wibox.container.background, layout = wibox.layout.align.vertical
ontop = true, },
visible = true, id = "container",
type = "notification", left = dpi(24),
forced_height = dpi(300), right = dpi(24),
forced_width = dpi(300), widget = wibox.container.margin
offset = dpi(5), },
} bg = color["Grey900"] .. '88',
widget = wibox.container.background,
ontop = true,
visible = true,
type = "notification",
forced_height = dpi(300),
forced_width = dpi(300),
offset = dpi(5),
}
local function update_osd() local function update_osd()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh volume", "./.config/awesome/src/scripts/vol.sh volume",
function(stdout) function(stdout)
local volume_level = stdout:gsub("\n", "") local volume_level = stdout:gsub("\n", ""):gsub("%%", "")
awesome.emit_signal("widget::volume") awesome.emit_signal("widget::volume")
volume_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text(volume_level .. "%") volume_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text(volume_level .. "%")
awesome.emit_signal( awesome.emit_signal(
"widget::volume:update",
volume_level
)
if awful.screen.focused().show_volume_osd then
awesome.emit_signal(
"module::volume_osd:show",
true
)
end
volume_level = tonumber(volume_level)
local icon = icondir .. "volume"
if volume_level < 1 then
icon = icon .. "-mute"
elseif volume_level >= 1 and volume_level < 34 then
icon = icon .. "-low"
elseif volume_level >= 34 and volume_level < 67 then
icon = icon .. "-medium"
elseif volume_level >= 67 then
icon = icon .. "-high"
end
volume_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icon .. ".svg")
end
)
end
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:connect_signal(
"property::value",
function()
update_osd()
end
)
local update_slider = function()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh mute",
function(stdout)
if stdout:match("yes") then
volume_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text("0%")
volume_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icondir .. "volume-mute" .. ".svg")
else
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh volume",
function(stdout2)
stdout2 = stdout2:gsub("\n", "")
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(stdout2))
update_osd()
end
)
end
end
)
end
-- Signals
awesome.connect_signal(
"module::slider:update",
function()
update_slider()
end
)
awesome.connect_signal(
"widget::volume:update", "widget::volume:update",
function(value) volume_level
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(value)) )
if awful.screen.focused().show_volume_osd then
awesome.emit_signal(
"module::volume_osd:show",
true
)
end
volume_level = tonumber(volume_level)
local icon = icondir .. "volume"
if volume_level < 1 then
icon = icon .. "-mute"
elseif volume_level >= 1 and volume_level < 34 then
icon = icon .. "-low"
elseif volume_level >= 34 and volume_level < 67 then
icon = icon .. "-medium"
elseif volume_level >= 67 then
icon = icon .. "-high"
end
volume_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icon .. ".svg")
end end
) )
end
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:connect_signal(
"property::value",
function()
update_osd()
end
)
local update_slider = function()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh mute",
function(stdout)
if stdout:match("yes") then
volume_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text("0%")
volume_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icondir .. "volume-mute" .. ".svg")
else
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh volume",
function(stdout2)
stdout2 = stdout2:gsub("%%", ""):gsub("\n", "")
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(stdout2))
update_osd()
end
)
end
end
)
end
-- Signals
awesome.connect_signal(
"module::slider:update",
function()
update_slider() update_slider()
end
)
local volume_container = awful.popup { awesome.connect_signal(
widget = wibox.container.background, "widget::volume:update",
ontop = true, function(value)
bg = color["Grey900"] .. "00", volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(value))
stretch = false, end
visible = false, )
screen = s,
placement = function(c) awful.placement.centered(c, { margins = { top = dpi(200) } }) end,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 15)
end
}
local hide_volume_osd = gears.timer { update_slider()
timeout = 2,
autostart = true,
callback = function()
volume_container.visible = false
end
}
volume_container:setup { local volume_container = awful.popup {
volume_osd_widget, widget = wibox.container.background,
layout = wibox.layout.fixed.horizontal ontop = true,
} bg = color["Grey900"] .. "00",
stretch = false,
awesome.connect_signal( visible = false,
"module::volume_osd:show", screen = s,
function() placement = function(c) awful.placement.centered(c, { margins = { top = dpi(200) } }) end,
if s == mouse.screen then shape = function(cr, width, height)
volume_container.visible = true gears.shape.rounded_rect(cr, width, height, 15)
end
end end
) }
volume_container:connect_signal( local hide_volume_osd = gears.timer {
"mouse::enter", timeout = 2,
function() autostart = true,
volume_container.visible = true callback = function()
hide_volume_osd:stop() volume_container.visible = false
end end
) }
volume_container:connect_signal( volume_container:setup {
"mouse::leave", volume_osd_widget,
function() layout = wibox.layout.fixed.horizontal
volume_container.visible = true }
hide_volume_osd:again()
end
)
awesome.connect_signal( awesome.connect_signal(
"widget::volume_osd:rerun", "module::volume_osd:show",
function() function()
if hide_volume_osd.started then if s == mouse.screen then
hide_volume_osd:again() volume_container.visible = true
else
hide_volume_osd:start()
end
end end
) end
)
volume_container:connect_signal(
"mouse::enter",
function()
volume_container.visible = true
hide_volume_osd:stop()
end
)
volume_container:connect_signal(
"mouse::leave",
function()
volume_container.visible = true
hide_volume_osd:again()
end
)
awesome.connect_signal(
"widget::volume_osd:rerun",
function()
if hide_volume_osd.started then
hide_volume_osd:again()
else
hide_volume_osd:start()
end
end
)
end end

View File

@@ -1,10 +1,11 @@
#!/bin/bash #!/bin/bash
SINK=$(LC_ALL=C pactl get-default-sink)
if [[ $1 == "volume" ]] if [[ $1 == "volume" ]]
then then
echo $(LC_ALL=C pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( 47 + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,') echo $(LC_ALL=C pactl get-sink-volume $SINK | awk '{print $5}')
elif [[ $1 == "mute" ]] elif [[ $1 == "mute" ]]
then then
echo $(LC_ALL=C pactl list sinks | grep '^[[:space:]]Mute:' | head -n $(( 47 + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,') echo $(LC_ALL=C pactl get-sink-mute $SINK)
fi fi

View File

@@ -16,108 +16,109 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/"
-- Returns the audio widget -- Returns the audio widget
return function() return function()
local audio_widget = wibox.widget { local audio_widget = wibox.widget {
{
{
{ {
{
{ {
{ id = "icon",
{ widget = wibox.widget.imagebox,
{ resize = false
id = "icon",
widget = wibox.widget.imagebox,
resize = false
},
id = "icon_layout",
widget = wibox.container.place
},
top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
},
spacing = dpi(10),
{
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "audio_layout",
layout = wibox.layout.fixed.horizontal
}, },
id = "container", id = "icon_layout",
left = dpi(8), widget = wibox.container.place
right = dpi(8), },
widget = wibox.container.margin top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
}, },
bg = color["Yellow200"], spacing = dpi(10),
fg = color["Grey900"], {
shape = function(cr, width, height) id = "label",
gears.shape.rounded_rect(cr, width, height, 5) align = "center",
end, valign = "center",
widget = wibox.container.background widget = wibox.widget.textbox
} },
id = "audio_layout",
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(8),
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Yellow200"],
fg = color["Grey900"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.container.background
}
local get_volume = function() local get_volume = function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh volume", "./.config/awesome/src/scripts/vol.sh volume",
function(stdout) function(stdout)
local icon = icondir .. "volume" local icon = icondir .. "volume"
stdout = stdout:gsub("%%", "") stdout = stdout:gsub("%%", "")
local volume = tonumber(stdout) or 0 local volume = tonumber(stdout) or 0
audio_widget.container.audio_layout.spacing = dpi(5) audio_widget.container.audio_layout.spacing = dpi(5)
audio_widget.container.audio_layout.label.visible = true audio_widget.container.audio_layout.label.visible = true
if volume < 1 then if volume < 1 then
icon = icon .. "-mute" icon = icon .. "-mute"
audio_widget.container.audio_layout.spacing = dpi(0) audio_widget.container.audio_layout.spacing = dpi(0)
audio_widget.container.audio_layout.label.visible = false audio_widget.container.audio_layout.label.visible = false
elseif volume >= 1 and volume < 34 then elseif volume >= 1 and volume < 34 then
icon = icon .. "-low" icon = icon .. "-low"
elseif volume >= 34 and volume < 67 then elseif volume >= 34 and volume < 67 then
icon = icon .. "-medium" icon = icon .. "-medium"
elseif volume >= 67 then elseif volume >= 67 then
icon = icon .. "-high" icon = icon .. "-high"
end end
audio_widget.container.audio_layout.label:set_text(volume .. "%") audio_widget.container.audio_layout.label:set_text(volume .. "%")
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Grey900"])) audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Grey900"]))
end
)
end
local check_muted = function()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh mute",
function(stdout)
if stdout:match("yes") then
audio_widget.container.audio_layout.label.visible = false
audio_widget.container:set_right(0)
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", color["Grey900"]))
else
audio_widget.container:set_right(10)
get_volume()
end
end
)
end
-- Signals
Hover_signal(audio_widget, color["Yellow200"])
audio_widget:connect_signal(
"button::press",
function()
awesome.emit_signal("widget::volume")
awesome.emit_signal("module::volume_osd:show", true)
awesome.emit_signal("module::slider:update")
awesome.emit_signal("widget::volume_osd:rerun")
end end
) )
end
awesome.connect_signal( local check_muted = function()
"widget::volume", awful.spawn.easy_async_with_shell(
function(c) "./.config/awesome/src/scripts/vol.sh mute",
check_muted() function(stdout)
if stdout:match("yes") then
audio_widget.container.audio_layout.label.visible = false
audio_widget.container:set_right(0)
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", color["Grey900"]))
else
audio_widget.container:set_right(10)
get_volume()
end
end end
) )
end
-- Signals
Hover_signal(audio_widget, color["Yellow200"])
audio_widget:connect_signal(
"button::press",
function()
awesome.emit_signal("widget::volume")
--awesome.emit_signal("module::volume_osd:show", true)
awesome.emit_signal("module::slider:update")
awesome.emit_signal("widget::volume_osd:rerun")
awesome.emit_signal("volume_controller::toggle")
end
)
awesome.connect_signal(
"widget::volume",
function(c)
check_muted() check_muted()
return audio_widget end
)
check_muted()
return audio_widget
end end

View File

@@ -0,0 +1,227 @@
---------------------------------
-- This is the CPU Info widget --
---------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local naughty = require("naughty")
local watch = awful.widget.watch
local wibox = require("wibox")
require("src.core.signals")
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
--TODO: Add tooltip with more CPU and per core information
return function(widget, clock_mode)
local cpu_usage_widget = wibox.widget {
{
{
{
{
{
id = "icon",
widget = wibox.widget.imagebox,
image = gears.color.recolor_image(icon_dir .. "cpu.svg", color["Grey900"]),
resize = false
},
id = "icon_layout",
widget = wibox.container.place
},
top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
},
spacing = dpi(10),
{
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "cpu_layout",
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(8),
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Blue200"],
fg = color["Grey900"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.container.background
}
local cpu_temp = wibox.widget {
{
{
{
{
{
id = "icon",
widget = wibox.widget.imagebox,
resize = false
},
id = "icon_layout",
widget = wibox.container.place
},
top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
},
spacing = dpi(10),
{
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "cpu_layout",
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(8),
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Green200"],
fg = color["Grey900"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.container.background
}
local cpu_clock = wibox.widget {
{
{
{
{
{
id = "icon",
widget = wibox.widget.imagebox,
image = icon_dir .. "cpu.svg",
resize = false
},
id = "icon_layout",
widget = wibox.container.place
},
top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
},
spacing = dpi(10),
{
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "cpu_layout",
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(8),
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Purple200"],
fg = color["Grey900"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.container.background
}
local total_prev = 0
local idle_prev = 0
watch(
[[ cat "/proc/stat" | grep '^cpu ' ]],
3,
function(_, stdout)
local user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice =
stdout:match("(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s")
local total = user + nice + system + idle + iowait + irq + softirq + steal
local diff_idle = idle - idle_prev
local diff_total = total - total_prev
local diff_usage = (1000 * (diff_total - diff_idle) / diff_total + 5) / 10
cpu_usage_widget.container.cpu_layout.label.text = tostring(math.floor(diff_usage)) .. "%"
total_prev = total
idle_prev = idle
collectgarbage("collect")
end
)
watch(
[[ bash -c "sensors | grep 'Package id 0:' | awk '{print $4}'" ]],
3,
function(_, stdout)
local temp_icon
local temp_color
local temp_num = tonumber(stdout:match("%d+"))
if temp_num < 50 then
temp_color = color["Green200"]
temp_icon = icon_dir .. "thermometer-low.svg"
elseif temp_num >= 50 and temp_num < 80 then
temp_color = color["Orange200"]
temp_icon = icon_dir .. "thermometer.svg"
elseif temp_num >= 80 then
temp_color = color["Red200"]
temp_icon = icon_dir .. "thermometer-high.svg"
end
Hover_signal(cpu_temp, temp_color)
cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
cpu_temp:set_bg(temp_color)
cpu_temp.container.cpu_layout.label.text = math.floor(temp_num) .. "°C"
end
)
watch(
[[ bash -c "cat /proc/cpuinfo | grep "MHz" | awk '{print int($4)}'" ]],
3,
function(_, stdout)
local cpu_freq = {}
for value in stdout:gmatch("%d+") do
table.insert(cpu_freq, value)
end
local average = 0
if clock_mode == "average" then
for i = 1, #cpu_freq do
average = average + cpu_freq[i]
end
average = math.floor(average / #cpu_freq)
cpu_clock.container.cpu_layout.label.text = tonumber(average) .. "Mhz"
elseif clock_mode then
cpu_clock.container.cpu_layout.label.text = tonumber(cpu_freq[clock_mode]) .. "Mhz"
end
end
)
Hover_signal(cpu_usage_widget, color["Blue200"])
Hover_signal(cpu_clock, color["Purple200"])
if widget == "usage" then
return cpu_usage_widget
elseif widget == "temp" then
return cpu_temp
elseif widget == "freq" then
return cpu_clock
end
end

View File

@@ -0,0 +1,143 @@
---------------------------------
-- This is the CPU Info widget --
---------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local naughty = require("naughty")
local watch = awful.widget.watch
local wibox = require("wibox")
require("src.core.signals")
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
return function(widget)
local gpu_usage_widget = wibox.widget {
{
{
{
{
{
id = "icon",
widget = wibox.widget.imagebox,
image = gears.color.recolor_image(icon_dir .. "gpu.svg", color["Grey900"]),
resize = false
},
id = "icon_layout",
widget = wibox.container.place
},
top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
},
spacing = dpi(10),
{
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "gpu_layout",
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(8),
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Green200"],
fg = color["Grey900"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.container.background
}
Hover_signal(gpu_usage_widget, color["Green200"])
local gpu_temp_widget = wibox.widget {
{
{
{
{
{
id = "icon",
widget = wibox.widget.imagebox,
image = gears.color.recolor_image(icon_dir .. "cpu.svg", color["Grey900"]),
resize = false
},
id = "icon_layout",
widget = wibox.container.place
},
top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
},
spacing = dpi(10),
{
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "gpu_layout",
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(8),
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Blue200"],
fg = color["Grey900"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.container.background
}
-- GPU Utilization
watch(
[[ bash -c "nvidia-smi -q -d UTILIZATION | grep Gpu | awk '{print $3}'"]],
3,
function(_, stdout)
gpu_usage_widget.container.gpu_layout.label.text = stdout:gsub("\n", "") .. "%"
end
)
-- GPU Temperature
watch(
[[ bash -c "nvidia-smi -q -d TEMPERATURE | grep 'GPU Current Temp' | awk '{print $5}'"]],
3,
function(_, stdout)
local temp_icon
local temp_color
local temp_num = tonumber(stdout)
if temp_num < 50 then
temp_color = color["Green200"]
temp_icon = icon_dir .. "thermometer-low.svg"
elseif temp_num >= 50 and temp_num < 80 then
temp_color = color["Orange200"]
temp_icon = icon_dir .. "thermometer.svg"
elseif temp_num >= 80 then
temp_color = color["Red200"]
temp_icon = icon_dir .. "thermometer-high.svg"
end
Hover_signal(gpu_temp_widget, temp_color)
gpu_temp_widget.container.gpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
gpu_temp_widget:set_bg(temp_color)
gpu_temp_widget.container.gpu_layout.label.text = tostring(temp_num) .. "°C"
end
)
if widget == "usage" then
return gpu_usage_widget
elseif widget == "temp" then
return gpu_temp_widget
end
end

View File

@@ -0,0 +1,73 @@
---------------------------------
-- This is the RAM Info widget --
---------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local naughty = require("naughty")
local watch = awful.widget.watch
local wibox = require("wibox")
require("src.core.signals")
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
return function()
local ram_widget = wibox.widget {
{
{
{
{
{
id = "icon",
widget = wibox.widget.imagebox,
image = gears.color.recolor_image(icon_dir .. "ram.svg", color["Grey900"]),
resize = false
},
id = "icon_layout",
widget = wibox.container.place
},
top = dpi(2),
widget = wibox.container.margin,
id = "icon_margin"
},
spacing = dpi(10),
{
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
id = "ram_layout",
layout = wibox.layout.fixed.horizontal
},
id = "container",
left = dpi(8),
right = dpi(8),
widget = wibox.container.margin
},
bg = color["Red200"],
fg = color["Grey900"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.container.background
}
Hover_signal(ram_widget, color["Red200"])
watch(
[[ bash -c "cat /proc/meminfo| grep Mem | awk '{print $2}'" ]],
3,
function(_, stdout)
local MemTotal, MemFree, MemAvailable = stdout:match("(%d+)\n(%d+)\n(%d+)\n")
ram_widget.container.ram_layout.label.text = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) .. "/" .. string.format("%.1f", (MemTotal / 1024 / 1024)) .. "GB"):gsub(",", ".")
end
)
return ram_widget
end