fix audio (hopefully last time), added new widgets(cpu/gpu/ram info), reworked the bars a bit, more stuff and fixes
1
awesome/src/assets/icons/audio/headphones.svg
Normal 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 |
1
awesome/src/assets/icons/audio/menu-down.svg
Normal 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 |
1
awesome/src/assets/icons/audio/menu-up.svg
Normal 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 |
1
awesome/src/assets/icons/audio/microphone-off.svg
Normal 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 |
1
awesome/src/assets/icons/audio/microphone.svg
Normal 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 |
1
awesome/src/assets/icons/cpu/cpu.svg
Normal 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 |
1
awesome/src/assets/icons/cpu/disk.svg
Normal 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 |
5
awesome/src/assets/icons/cpu/gpu.svg
Normal 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 |
6
awesome/src/assets/icons/cpu/ram.svg
Normal 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 |
1
awesome/src/assets/icons/cpu/thermometer-high.svg
Normal 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 |
1
awesome/src/assets/icons/cpu/thermometer-low.svg
Normal 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 |
1
awesome/src/assets/icons/cpu/thermometer.svg
Normal 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 |
@@ -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;
|
||||
@@ -15,229 +15,229 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/"
|
||||
-- Returns the volume_osd
|
||||
return function(s)
|
||||
|
||||
local volume_osd_widget = wibox.widget {
|
||||
local volume_osd_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
nil,
|
||||
{
|
||||
{
|
||||
{
|
||||
nil,
|
||||
{
|
||||
nil,
|
||||
{
|
||||
id = "icon",
|
||||
forced_height = dpi(220),
|
||||
image = icondir .. "volume-high.svg",
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
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
|
||||
nil,
|
||||
{
|
||||
id = "icon",
|
||||
forced_height = dpi(220),
|
||||
image = icondir .. "volume-high.svg",
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
nil,
|
||||
expand = "none",
|
||||
id = "icon_margin2",
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(24),
|
||||
right = dpi(24),
|
||||
widget = wibox.container.margin
|
||||
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
|
||||
},
|
||||
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),
|
||||
}
|
||||
id = "osd_layout",
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(24),
|
||||
right = dpi(24),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
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()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"./.config/awesome/src/scripts/vol.sh volume",
|
||||
function(stdout)
|
||||
local volume_level = stdout:gsub("\n", "")
|
||||
awesome.emit_signal("widget::volume")
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text(volume_level .. "%")
|
||||
local function update_osd()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"./.config/awesome/src/scripts/vol.sh volume",
|
||||
function(stdout)
|
||||
local volume_level = stdout:gsub("\n", ""):gsub("%%", "")
|
||||
awesome.emit_signal("widget::volume")
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text(volume_level .. "%")
|
||||
|
||||
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(
|
||||
awesome.emit_signal(
|
||||
"widget::volume:update",
|
||||
function(value)
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(value))
|
||||
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("%%", ""):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
|
||||
)
|
||||
|
||||
local volume_container = awful.popup {
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
bg = color["Grey900"] .. "00",
|
||||
stretch = false,
|
||||
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
|
||||
}
|
||||
awesome.connect_signal(
|
||||
"widget::volume:update",
|
||||
function(value)
|
||||
volume_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.volume_slider:set_value(tonumber(value))
|
||||
end
|
||||
)
|
||||
|
||||
local hide_volume_osd = gears.timer {
|
||||
timeout = 2,
|
||||
autostart = true,
|
||||
callback = function()
|
||||
volume_container.visible = false
|
||||
end
|
||||
}
|
||||
update_slider()
|
||||
|
||||
volume_container:setup {
|
||||
volume_osd_widget,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::volume_osd:show",
|
||||
function()
|
||||
if s == mouse.screen then
|
||||
volume_container.visible = true
|
||||
end
|
||||
local volume_container = awful.popup {
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
bg = color["Grey900"] .. "00",
|
||||
stretch = false,
|
||||
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
|
||||
)
|
||||
}
|
||||
|
||||
volume_container:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
volume_container.visible = true
|
||||
hide_volume_osd:stop()
|
||||
local hide_volume_osd = gears.timer {
|
||||
timeout = 2,
|
||||
autostart = true,
|
||||
callback = function()
|
||||
volume_container.visible = false
|
||||
end
|
||||
)
|
||||
}
|
||||
|
||||
volume_container:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
volume_container.visible = true
|
||||
hide_volume_osd:again()
|
||||
end
|
||||
)
|
||||
volume_container:setup {
|
||||
volume_osd_widget,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::volume_osd:rerun",
|
||||
function()
|
||||
if hide_volume_osd.started then
|
||||
hide_volume_osd:again()
|
||||
else
|
||||
hide_volume_osd:start()
|
||||
end
|
||||
awesome.connect_signal(
|
||||
"module::volume_osd:show",
|
||||
function()
|
||||
if s == mouse.screen then
|
||||
volume_container.visible = true
|
||||
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
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
SINK=$(LC_ALL=C pactl get-default-sink)
|
||||
|
||||
if [[ $1 == "volume" ]]
|
||||
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" ]]
|
||||
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
|
||||
|
||||
|
||||
@@ -16,108 +16,109 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/"
|
||||
-- Returns the audio widget
|
||||
return function()
|
||||
|
||||
local audio_widget = wibox.widget {
|
||||
local audio_widget = 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 = "audio_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
id = "icon",
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin,
|
||||
id = "icon_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
|
||||
}
|
||||
spacing = dpi(10),
|
||||
{
|
||||
id = "label",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
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()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"./.config/awesome/src/scripts/vol.sh volume",
|
||||
function(stdout)
|
||||
local icon = icondir .. "volume"
|
||||
stdout = stdout:gsub("%%", "")
|
||||
local volume = tonumber(stdout) or 0
|
||||
audio_widget.container.audio_layout.spacing = dpi(5)
|
||||
audio_widget.container.audio_layout.label.visible = true
|
||||
if volume < 1 then
|
||||
icon = icon .. "-mute"
|
||||
audio_widget.container.audio_layout.spacing = dpi(0)
|
||||
audio_widget.container.audio_layout.label.visible = false
|
||||
elseif volume >= 1 and volume < 34 then
|
||||
icon = icon .. "-low"
|
||||
elseif volume >= 34 and volume < 67 then
|
||||
icon = icon .. "-medium"
|
||||
elseif volume >= 67 then
|
||||
icon = icon .. "-high"
|
||||
end
|
||||
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"]))
|
||||
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")
|
||||
local get_volume = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"./.config/awesome/src/scripts/vol.sh volume",
|
||||
function(stdout)
|
||||
local icon = icondir .. "volume"
|
||||
stdout = stdout:gsub("%%", "")
|
||||
local volume = tonumber(stdout) or 0
|
||||
audio_widget.container.audio_layout.spacing = dpi(5)
|
||||
audio_widget.container.audio_layout.label.visible = true
|
||||
if volume < 1 then
|
||||
icon = icon .. "-mute"
|
||||
audio_widget.container.audio_layout.spacing = dpi(0)
|
||||
audio_widget.container.audio_layout.label.visible = false
|
||||
elseif volume >= 1 and volume < 34 then
|
||||
icon = icon .. "-low"
|
||||
elseif volume >= 34 and volume < 67 then
|
||||
icon = icon .. "-medium"
|
||||
elseif volume >= 67 then
|
||||
icon = icon .. "-high"
|
||||
end
|
||||
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"]))
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::volume",
|
||||
function(c)
|
||||
check_muted()
|
||||
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")
|
||||
awesome.emit_signal("volume_controller::toggle")
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::volume",
|
||||
function(c)
|
||||
check_muted()
|
||||
return audio_widget
|
||||
end
|
||||
)
|
||||
|
||||
check_muted()
|
||||
return audio_widget
|
||||
end
|
||||
|
||||
227
awesome/src/widgets/cpu_info.lua
Normal 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
|
||||
143
awesome/src/widgets/gpu_info.lua
Normal 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
|
||||
73
awesome/src/widgets/ram_info.lua
Normal 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
|
||||