diff --git a/awesome/crylia_bar/center_bar.lua b/awesome/crylia_bar/center_bar.lua
index 91c902d..c986b0f 100644
--- a/awesome/crylia_bar/center_bar.lua
+++ b/awesome/crylia_bar/center_bar.lua
@@ -8,75 +8,115 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
-return function(s, widget)
+return function(s, widgets)
- local top_center = awful.popup {
- screen = s,
- widget = wibox.container.background,
- ontop = false,
- bg = color["Grey900"],
- visible = true,
- maximum_width = dpi(500),
- placement = function(c) awful.placement.top(c, { margins = dpi(10) }) end,
- shape = function(cr, width, height)
- gears.shape.rounded_rect(cr, width, height, 5)
- end
+ local top_center = awful.popup {
+ screen = s,
+ widget = wibox.container.background,
+ ontop = false,
+ bg = color["Grey900"],
+ visible = true,
+ maximum_width = dpi(500),
+ placement = function(c) awful.placement.top(c, { margins = dpi(10) }) end,
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, 5)
+ 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 {
- nil,
- {
- widget,
- margins = dpi(6),
- widget = wibox.container.margin
- },
- nil,
- forced_height = 45,
- layout = wibox.layout.align.horizontal
- }
+ top_center:setup {
+ nil,
+ prepare_widgets(widgets),
+ nil,
+ layout = wibox.layout.fixed.horizontal
+ }
- client.connect_signal(
- "manage",
- function(c)
- if #s.selected_tag:clients() < 1 then
- top_center.visible = false
- else
- top_center.visible = true
- end
- end
- )
+ client.connect_signal(
+ "manage",
+ function(c)
+ if #s.selected_tag:clients() < 1 then
+ top_center.visible = false
+ else
+ top_center.visible = true
+ end
+ end
+ )
- client.connect_signal(
- "unmanage",
- function(c)
- if #s.selected_tag:clients() < 1 then
- top_center.visible = false
- else
- top_center.visible = true
- end
- end
- )
+ client.connect_signal(
+ "unmanage",
+ function(c)
+ if #s.selected_tag:clients() < 1 then
+ top_center.visible = false
+ else
+ top_center.visible = true
+ end
+ end
+ )
- client.connect_signal(
- "tag::switched",
- function(c)
- if #s.selected_tag:clients() < 1 then
- top_center.visible = false
- else
- top_center.visible = true
- end
- end
- )
+ client.connect_signal(
+ "tag::switched",
+ function(c)
+ if #s.selected_tag:clients() < 1 then
+ top_center.visible = false
+ else
+ top_center.visible = true
+ end
+ end
+ )
- awesome.connect_signal(
- "refresh",
- function(c)
- if #s.selected_tag:clients() < 1 then
- top_center.visible = false
- else
- top_center.visible = true
- end
- end
- )
+ awesome.connect_signal(
+ "refresh",
+ function(c)
+ if #s.selected_tag:clients() < 1 then
+ top_center.visible = false
+ else
+ top_center.visible = true
+ end
+ end
+ )
end
diff --git a/awesome/crylia_bar/dock.lua b/awesome/crylia_bar/dock.lua
index 4011f33..089ce1c 100644
--- a/awesome/crylia_bar/dock.lua
+++ b/awesome/crylia_bar/dock.lua
@@ -10,285 +10,289 @@ local wibox = require("wibox")
return function(screen, programs)
- local function create_dock_element(class, program, name, is_steam, size)
- if program == nil or class == nil then
- 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
+ local function create_dock_element(class, program, name, is_steam, size)
+ if program == nil or class == nil then
+ return
end
+ is_steam = is_steam or false
- local dock = awful.popup {
- 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,
+ 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, 15)
- end
- }
-
- local fakedock = awful.popup {
+ gears.shape.rounded_rect(cr, width, height, 10)
+ end,
+ bg = color["Grey900"],
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,
+ id = "background"
+ },
+ top = dpi(5),
+ left = dpi(5),
+ right = dpi(5),
+ widget = wibox.container.margin
}
- 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
+ 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
- local dock_elements = get_dock_elements(programs)
+ Hover_signal(dock_element.background, color["Grey800"], color["White"])
- 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
+ dock_element:connect_signal(
+ "button::press",
+ function()
+ if is_steam then
+ awful.spawn("steam steam://rungameid/" .. program)
+ else
+ awful.spawn(program)
+ end
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
- 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
+ awful.tooltip {
+ objects = { dock_element },
+ text = name,
+ mode = "outside",
+ preferred_alignments = "middle",
+ margins = dpi(10)
}
- local function check_for_dock_hide(s)
- local naughty = require("naughty")
- if #s.selected_tag:clients() < 1 then
- dock.visible = true
- return
+ return dock_element
+ end
+
+ local dock = awful.popup {
+ 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
- if s == mouse.screen then
- --[[ if mouse.current_widget then
+ 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)
+ 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
dock.visible = true
return
end
end ]]
- local visible = false
- for j, c in ipairs(s.selected_tag:clients()) do
+ local visible = false
+ for j, c in ipairs(s.selected_tag:clients()) do
- --naughty.notify({ title = tostring(c.class) })
- if c.maximized or c.fullscreen then
- dock.visible = false
- return
- end
- local y = c:geometry().y
- local h = c.height
- if (y + h) >= s.geometry.height - user_vars.dock_icon_size - 35 then
- dock.visible = false
- return
- else
- dock.visible = true
- end
- --[[ if visible then
+ --naughty.notify({ title = tostring(c.class) })
+ if c.maximized or c.fullscreen then
+ dock.visible = false
+ return
+ end
+ local y = c:geometry().y
+ local h = c.height
+ if (y + h) >= s.geometry.height - user_vars.dock_icon_size - 35 then
+ dock.visible = false
+ return
+ else
+ dock.visible = true
+ end
+ --[[ if visible then
dock.visible = visible
return
end ]]
- end
- else
- dock.visible = false
- end
+ end
+ else
+ dock.visible = false
end
+ end
- local dock_intelligent_hide = gears.timer {
- timeout = 1,
- autostart = true,
- call_now = true,
- callback = function()
- check_for_dock_hide(screen)
- end
- }
+ local dock_intelligent_hide = gears.timer {
+ timeout = 1,
+ autostart = true,
+ call_now = true,
+ callback = function()
+ check_for_dock_hide(screen)
+ end
+ }
- fakedock:connect_signal(
- "mouse::enter",
- function()
- dock_intelligent_hide:stop()
- dock.visible = true
- end
- )
-
- client.connect_signal(
- "manage",
- 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
- )
+ fakedock:connect_signal(
+ "mouse::enter",
+ function()
+ for index, c in ipairs(screen.clients) do
+ if not c.fullscreen then
+ dock_intelligent_hide:stop()
+ dock.visible = true
+ end
+ end
+ end
+ )
+ client.connect_signal(
+ "manage",
+ function()
+ check_for_dock_hide(screen)
dock:setup {
- get_dock_elements(programs),
- create_incicator_widget(programs),
- layout = wibox.layout.fixed.vertical
+ 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
+ )
+
+ dock:setup {
+ get_dock_elements(programs),
+ create_incicator_widget(programs),
+ layout = wibox.layout.fixed.vertical
+ }
end
diff --git a/awesome/crylia_bar/init.lua b/awesome/crylia_bar/init.lua
index 39a99e5..e24d5f0 100644
--- a/awesome/crylia_bar/init.lua
+++ b/awesome/crylia_bar/init.lua
@@ -8,56 +8,55 @@ awful.screen.connect_for_each_screen(
-- For each screen this function is called once
-- 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.
- function(s)
- -- Create 9 tags
- awful.layout.layouts = user_vars.layouts
- awful.tag(
- { "1", "2", "3", "4", "5", "6", "7", "8", "9" },
- s,
- user_vars.layouts[1]
- )
+ function(s)
+ -- Create 9 tags
+ awful.layout.layouts = user_vars.layouts
+ awful.tag(
+ { "1", "2", "3", "4", "5", "6", "7", "8", "9" },
+ s,
+ user_vars.layouts[1]
+ )
- require("src.modules.powermenu")(s)
- -- TODO: rewrite calendar osd, maybe write an own inplementation
- -- require("src.modules.calendar_osd")(s)
- require("src.modules.volume_osd")(s)
- require("src.modules.brightness_osd")(s)
- require("src.modules.titlebar")
+ require("src.modules.powermenu")(s)
+ -- TODO: rewrite calendar osd, maybe write an own inplementation
+ -- require("src.modules.calendar_osd")(s)
+ require("src.modules.volume_osd")(s)
+ require("src.modules.brightness_osd")(s)
+ require("src.modules.titlebar")
+ require("src.modules.volume_controller")(s)
- -- Widgets
- s.battery = require("src.widgets.battery")()
- s.network = require("src.widgets.network")()
- s.audio = require("src.widgets.audio")()
- s.date = require("src.widgets.date")()
- s.clock = require("src.widgets.clock")()
- s.bluetooth = require("src.widgets.bluetooth")()
- s.layoutlist = require("src.widgets.layout_list")()
- s.powerbutton = require("src.widgets.power")()
- s.kblayout = require("src.widgets.kblayout")(s)
- s.taglist = require("src.widgets.taglist")(s)
- s.tasklist = require("src.widgets.tasklist")(s)
- s.systray = require("src.widgets.systray")(s)
+ -- Widgets
+ s.battery = require("src.widgets.battery")()
+ s.network = require("src.widgets.network")()
+ s.audio = require("src.widgets.audio")()
+ s.date = require("src.widgets.date")()
+ s.clock = require("src.widgets.clock")()
+ s.bluetooth = require("src.widgets.bluetooth")()
+ s.layoutlist = require("src.widgets.layout_list")()
+ s.powerbutton = require("src.widgets.power")()
+ s.kblayout = require("src.widgets.kblayout")(s)
+ s.taglist = require("src.widgets.taglist")(s)
+ s.tasklist = require("src.widgets.tasklist")(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
- -- the modules/widgets per screen.
- -- uncomment this example and dont forget to remove/comment the other code below
- --[[ 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.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
+ if s.index == 2 then
+ require("crylia_bar.left_bar")(s, { s.layoutlist, s.taglist })
+ require("crylia_bar.center_bar")(s, { s.tasklist })
+ require("crylia_bar.right_bar")(s, { s.ram_info, s.audio, s.kblayout, s.network, s.date, s.clock, s.powerbutton })
+ end
+end
)
diff --git a/awesome/crylia_bar/left_bar.lua b/awesome/crylia_bar/left_bar.lua
index 1529eca..93f2031 100644
--- a/awesome/crylia_bar/left_bar.lua
+++ b/awesome/crylia_bar/left_bar.lua
@@ -10,54 +10,68 @@ local wibox = require("wibox")
return function(s, widgets)
- local top_left = awful.popup {
- screen = s,
- widget = wibox.container.background,
- ontop = false,
- bg = color["Grey900"],
- visible = true,
- maximum_width = dpi(650),
- placement = function(c) awful.placement.top_left(c, { margins = dpi(10) }) end,
- shape = function(cr, width, height)
- gears.shape.rounded_rect(cr, width, height, 5)
- end
- }
+ local top_left = awful.popup {
+ screen = s,
+ widget = wibox.container.background,
+ ontop = false,
+ bg = color["Grey900"],
+ visible = true,
+ maximum_width = dpi(650),
+ placement = function(c) awful.placement.top_left(c, { margins = dpi(10) }) end,
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, 5)
+ end
+ }
- top_left:struts {
- top = 55
- }
+ top_left:struts {
+ top = 55
+ }
- top_left:setup {
- {
- {
- widgets[1],
- 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
+ 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_left:setup {
+ prepare_widgets(widgets),
+ nil,
+ nil,
+ layout = wibox.layout.fixed.horizontal
+ }
end
diff --git a/awesome/crylia_bar/right_bar.lua b/awesome/crylia_bar/right_bar.lua
index 3c232db..3e4ec2e 100644
--- a/awesome/crylia_bar/right_bar.lua
+++ b/awesome/crylia_bar/right_bar.lua
@@ -10,89 +10,67 @@ local wibox = require("wibox")
return function(s, widgets)
- local top_right = awful.popup {
- widget = wibox.container.background,
- ontop = false,
- bg = color["Grey900"],
- visible = true,
- screen = s,
- placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end,
- shape = function(cr, width, height)
- gears.shape.rounded_rect(cr, width, height, 5)
- end
- }
+ local top_right = awful.popup {
+ widget = wibox.container.background,
+ ontop = false,
+ bg = color["Grey900"],
+ visible = true,
+ screen = s,
+ placement = function(c) awful.placement.top_right(c, { margins = dpi(10) }) end,
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, 5)
+ end
+ }
- top_right:setup {
- nil,
- nil,
- {
- {
- widgets[1],
- 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(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
+ top_right: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_right:setup {
+ nil,
+ nil,
+ prepare_widgets(widgets),
+ layout = wibox.layout.align.horizontal
+ }
end
diff --git a/awesome/src/assets/icons/audio/headphones.svg b/awesome/src/assets/icons/audio/headphones.svg
new file mode 100644
index 0000000..49d9ff5
--- /dev/null
+++ b/awesome/src/assets/icons/audio/headphones.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/awesome/src/assets/icons/audio/menu-down.svg b/awesome/src/assets/icons/audio/menu-down.svg
new file mode 100644
index 0000000..50b8625
--- /dev/null
+++ b/awesome/src/assets/icons/audio/menu-down.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/awesome/src/assets/icons/audio/menu-up.svg b/awesome/src/assets/icons/audio/menu-up.svg
new file mode 100644
index 0000000..5fb8642
--- /dev/null
+++ b/awesome/src/assets/icons/audio/menu-up.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/awesome/src/assets/icons/audio/microphone-off.svg b/awesome/src/assets/icons/audio/microphone-off.svg
new file mode 100644
index 0000000..7e5b853
--- /dev/null
+++ b/awesome/src/assets/icons/audio/microphone-off.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/awesome/src/assets/icons/audio/microphone.svg b/awesome/src/assets/icons/audio/microphone.svg
new file mode 100644
index 0000000..fbf0784
--- /dev/null
+++ b/awesome/src/assets/icons/audio/microphone.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/awesome/src/assets/icons/cpu/cpu.svg b/awesome/src/assets/icons/cpu/cpu.svg
new file mode 100644
index 0000000..fcbef7d
--- /dev/null
+++ b/awesome/src/assets/icons/cpu/cpu.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/awesome/src/assets/icons/cpu/disk.svg b/awesome/src/assets/icons/cpu/disk.svg
new file mode 100644
index 0000000..7390ce1
--- /dev/null
+++ b/awesome/src/assets/icons/cpu/disk.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/awesome/src/assets/icons/cpu/gpu.svg b/awesome/src/assets/icons/cpu/gpu.svg
new file mode 100644
index 0000000..e9294dd
--- /dev/null
+++ b/awesome/src/assets/icons/cpu/gpu.svg
@@ -0,0 +1,5 @@
+
+
+
diff --git a/awesome/src/assets/icons/cpu/ram.svg b/awesome/src/assets/icons/cpu/ram.svg
new file mode 100644
index 0000000..14503d8
--- /dev/null
+++ b/awesome/src/assets/icons/cpu/ram.svg
@@ -0,0 +1,6 @@
+
+
diff --git a/awesome/src/assets/icons/cpu/thermometer-high.svg b/awesome/src/assets/icons/cpu/thermometer-high.svg
new file mode 100644
index 0000000..3f7ea67
--- /dev/null
+++ b/awesome/src/assets/icons/cpu/thermometer-high.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/awesome/src/assets/icons/cpu/thermometer-low.svg b/awesome/src/assets/icons/cpu/thermometer-low.svg
new file mode 100644
index 0000000..6a5754b
--- /dev/null
+++ b/awesome/src/assets/icons/cpu/thermometer-low.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/awesome/src/assets/icons/cpu/thermometer.svg b/awesome/src/assets/icons/cpu/thermometer.svg
new file mode 100644
index 0000000..008696d
--- /dev/null
+++ b/awesome/src/assets/icons/cpu/thermometer.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/awesome/src/assets/rules.txt b/awesome/src/assets/rules.txt
index e69de29..def3b54 100644
--- a/awesome/src/assets/rules.txt
+++ b/awesome/src/assets/rules.txt
@@ -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;
\ No newline at end of file
diff --git a/awesome/src/modules/volume_osd.lua b/awesome/src/modules/volume_osd.lua
index 020537e..8189791 100644
--- a/awesome/src/modules/volume_osd.lua
+++ b/awesome/src/modules/volume_osd.lua
@@ -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
diff --git a/awesome/src/scripts/vol.sh b/awesome/src/scripts/vol.sh
index 1d449aa..861450f 100755
--- a/awesome/src/scripts/vol.sh
+++ b/awesome/src/scripts/vol.sh
@@ -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
-
diff --git a/awesome/src/widgets/audio.lua b/awesome/src/widgets/audio.lua
index 0837807..4933ac3 100644
--- a/awesome/src/widgets/audio.lua
+++ b/awesome/src/widgets/audio.lua
@@ -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
diff --git a/awesome/src/widgets/cpu_info.lua b/awesome/src/widgets/cpu_info.lua
new file mode 100644
index 0000000..266f784
--- /dev/null
+++ b/awesome/src/widgets/cpu_info.lua
@@ -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
diff --git a/awesome/src/widgets/gpu_info.lua b/awesome/src/widgets/gpu_info.lua
new file mode 100644
index 0000000..7000494
--- /dev/null
+++ b/awesome/src/widgets/gpu_info.lua
@@ -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
diff --git a/awesome/src/widgets/ram_info.lua b/awesome/src/widgets/ram_info.lua
new file mode 100644
index 0000000..bcd6ee9
--- /dev/null
+++ b/awesome/src/widgets/ram_info.lua
@@ -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