desktop, calendar, various other modules

This commit is contained in:
Rene Kievits
2022-11-22 16:59:55 +01:00
parent 210682e955
commit c6341f84e7
74 changed files with 5587 additions and 985 deletions

View File

@@ -14,23 +14,6 @@ local capi = {
return function(s, widgets)
local top_center = awful.popup {
screen = s,
widget = wibox.container.background,
ontop = false,
bg = Theme_config.center_bar.bg,
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, dpi(6))
end
}
top_center:struts {
top = dpi(55)
}
local function prepare_widgets(w)
local layout = {
forced_height = dpi(50),
@@ -72,55 +55,53 @@ return function(s, widgets)
return layout
end
top_center:setup {
nil,
prepare_widgets(widgets),
nil,
layout = wibox.layout.fixed.horizontal
local top_center = awful.popup {
screen = s,
widget = prepare_widgets(widgets),
ontop = false,
bg = Theme_config.center_bar.bg,
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, dpi(6))
end
}
capi.client.connect_signal(
"manage",
function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
end
)
top_center:struts {
top = dpi(55)
}
capi.client.connect_signal(
"unmanage",
function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
capi.client.connect_signal("manage", function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
)
end)
capi.client.connect_signal(
"property::selected",
function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
capi.client.connect_signal("unmanage", function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
)
end)
capi.awesome.connect_signal(
"refresh",
function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
capi.client.connect_signal("property::selected", function(c)
if #s.selected_tag:clients() < 1 then
top_center.visible = false
else
top_center.visible = true
end
)
end)
capi.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

View File

@@ -18,7 +18,7 @@ local json = require("src.lib.json-lua.json-lua")
local icondir = gears.filesystem.get_configuration_dir() .. "src/assets/icons/context_menu/"
local cm = require("src.modules.context_menu")
local cm = require("src.modules.context_menu.init")
return function(screen)
@@ -76,7 +76,7 @@ return function(screen)
for _, action in ipairs(program.actions) do
table.insert(action_entries, {
name = Gio.DesktopAppInfo.get_action_name(DAI, action) or "",
icon = action.icon or icondir .. "entry.svg",
icon = gears.color.recolor_image(action.icon or icondir .. "entry.svg", Theme_config.dock.cm_icon),
callback = function()
Gio.DesktopAppInfo.launch_action(DAI, action)
end
@@ -85,7 +85,7 @@ return function(screen)
table.insert(action_entries, {
name = "Remove from Dock",
icon = icondir .. "entry.svg",
icon = gears.color.recolor_image(icondir .. "entry.svg", Theme_config.dock.cm_icon),
callback = function()
local data = io.open("/home/crylia/.config/awesome/src/config/dock.json", "r")
if not data then
@@ -111,9 +111,41 @@ return function(screen)
end
})
local context_menu = cm({
entries = action_entries
})
local context_menu = cm {
widget_template = wibox.widget {
{
{
{
{
widget = wibox.widget.imagebox,
resize = true,
valign = "center",
halign = "center",
id = "icon_role",
},
widget = wibox.container.constraint,
stragety = "exact",
width = dpi(24),
height = dpi(24),
id = "const"
},
{
widget = wibox.widget.textbox,
valign = "center",
halign = "left",
id = "text_role"
},
spacing = dpi(10),
layout = wibox.layout.fixed.horizontal
},
margins = dpi(5),
widget = wibox.container.margin
},
widget = wibox.container.background,
},
entries = action_entries,
spacing = dpi(10),
}
dock_element:buttons(gears.table.join(
awful.button({
@@ -131,10 +163,7 @@ return function(screen)
return
end
-- add offset so mouse is above widget, this is so the mouse::leave event triggers always
context_menu.x = capi.mouse.coords().x - 10
context_menu.y = capi.mouse.coords().y + 10 - context_menu.height
context_menu.visible = not context_menu.visible
cm_open = context_menu.visible
context_menu:toggle()
end
})
))

View File

@@ -25,7 +25,7 @@ return function(s)
elseif widget == "Cpu Usage" then
table.insert(widget_table, require("src.widgets.cpu_info")("usage"))
elseif widget == "Date" then
table.insert(widget_table, require("src.widgets.date")())
table.insert(widget_table, require("src.widgets.date")(s))
elseif widget == "Gpu Temperature" then
table.insert(widget_table, require("src.widgets.gpu_info")("temp"))
elseif widget == "Gpu Usage" then
@@ -52,8 +52,8 @@ return function(s)
return widget_table
end
if User_config.widgets then
for index, screen in ipairs(User_config.widgets) do
if User_config.crylia_bar then
for index, screen in ipairs(User_config.crylia_bar) do
if index == s.index then
if screen.left_bar then
require("src.modules.crylia_bar.left_bar")(s, get_widgets(screen.left_bar))

View File

@@ -9,25 +9,6 @@ local wibox = require("wibox")
return function(s, w)
local top_left = awful.popup {
screen = s,
widget = {
},
ontop = false,
bg = Theme_config.left_bar.bg,
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, dpi(6))
end
}
top_left:struts {
top = dpi(55)
}
local function prepare_widgets(widgets)
local layout = {
forced_height = dpi(50),
@@ -69,10 +50,22 @@ return function(s, w)
return layout
end
top_left:setup {
prepare_widgets(w),
nil,
nil,
layout = wibox.layout.fixed.horizontal
local top_left = awful.popup {
screen = s,
widget = prepare_widgets(w),
ontop = false,
bg = Theme_config.left_bar.bg,
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, dpi(6))
end
}
top_left:struts {
top = dpi(55)
}
Global_config.top_struts = dpi(55)
end

View File

@@ -9,22 +9,6 @@ local wibox = require("wibox")
return function(s, w)
local top_right = awful.popup {
widget = wibox.container.background,
ontop = false,
bg = Theme_config.right_bar.bg,
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, dpi(6))
end
}
top_right:struts {
top = dpi(55)
}
local function prepare_widgets(widgets)
local layout = {
forced_height = dpi(50),
@@ -66,10 +50,21 @@ return function(s, w)
return layout
end
top_right:setup {
nil,
nil,
prepare_widgets(w),
layout = wibox.layout.align.horizontal
local top_right = awful.popup {
widget = prepare_widgets(w),
ontop = false,
bg = Theme_config.right_bar.bg,
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, dpi(6))
end
}
top_right:struts {
top = dpi(55)
}
Global_config.top_struts = top_right
end