rewrote a lot of stuff especially the bluetooth module. fixed some errors
This commit is contained in:
@@ -10,6 +10,10 @@ local wibox = require("wibox")
|
||||
|
||||
local rubato = require("src.lib.rubato")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
|
||||
|
||||
@@ -36,7 +40,7 @@ return function(s)
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
})
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"notification_center_activation::toggle",
|
||||
function(screen, hide)
|
||||
if screen == s then
|
||||
@@ -121,7 +125,7 @@ return function(s)
|
||||
fit = function(_, width, height)
|
||||
return width, height
|
||||
end,
|
||||
draw = toggle_animation(0, Theme_config.notification_center.dnd.disabled),
|
||||
draw = toggle_animation(0),
|
||||
},
|
||||
id = "background",
|
||||
},
|
||||
@@ -326,7 +330,7 @@ return function(s)
|
||||
)
|
||||
|
||||
-- Update the notification center popup and check if there are no notifications
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"notification_center:update::needed",
|
||||
function()
|
||||
if #nl == 0 then
|
||||
@@ -352,11 +356,11 @@ return function(s)
|
||||
notification_center.visible = false
|
||||
end
|
||||
|
||||
awesome.connect_signal("notification_center::block_mouse_events", function()
|
||||
capi.awesome.connect_signal("notification_center::block_mouse_events", function()
|
||||
notification_center:disconnect_signal("mouse::leave", mouse_leave)
|
||||
end)
|
||||
|
||||
awesome.connect_signal("notification_center::unblock_mouse_events", function()
|
||||
capi.awesome.connect_signal("notification_center::unblock_mouse_events", function()
|
||||
notification_center:connect_signal("mouse::leave", mouse_leave)
|
||||
end)
|
||||
|
||||
@@ -374,7 +378,7 @@ return function(s)
|
||||
for i = 0, size do
|
||||
nl[i] = nil
|
||||
end
|
||||
awesome.emit_signal("notification_center:update::needed")
|
||||
capi.awesome.emit_signal("notification_center:update::needed")
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
@@ -9,6 +9,10 @@ local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local naughty = require("naughty")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
|
||||
|
||||
@@ -226,7 +230,7 @@ function nl.create_notification(n)
|
||||
for i, b in pairs(nl.notification_list) do
|
||||
if b.pk == notification.pk then
|
||||
table.remove(nl.notification_list, math.tointeger(i))
|
||||
awesome.emit_signal("notification_center:update::needed")
|
||||
capi.awesome.emit_signal("notification_center:update::needed")
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -257,7 +261,7 @@ naughty.connect_signal(
|
||||
"request::display",
|
||||
function(n)
|
||||
nl.create_notification(n)
|
||||
awesome.emit_signal("notification_center:update::needed")
|
||||
capi.awesome.emit_signal("notification_center:update::needed")
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
|
||||
|
||||
@@ -18,7 +23,7 @@ return function(s)
|
||||
local function button_hover_effect(widget, svg, color, color2)
|
||||
local mouse_enter = function()
|
||||
widget.image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. svg, color2))
|
||||
local w = mouse.current_wibox
|
||||
local w = capi.mouse.current_wibox
|
||||
if w then
|
||||
w.cursor = "hand1"
|
||||
end
|
||||
@@ -26,8 +31,8 @@ return function(s)
|
||||
|
||||
local mouse_leave = function()
|
||||
widget.image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. svg, color))
|
||||
mouse.cursor = "left_ptr"
|
||||
local w = mouse.current_wibox
|
||||
capi.mouse.cursor = "left_ptr"
|
||||
local w = capi.mouse.current_wibox
|
||||
if w then
|
||||
w.cursor = "left_ptr"
|
||||
end
|
||||
@@ -488,7 +493,7 @@ return function(s)
|
||||
}
|
||||
|
||||
-- get_spotify_metadata() on awesome reload
|
||||
awesome.connect_signal("startup", function()
|
||||
capi.awesome.connect_signal("startup", function()
|
||||
get_spotify_metadata(true)
|
||||
end)
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@ local wibox = require("wibox")
|
||||
|
||||
local rubato = require("src.lib.rubato")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/"
|
||||
|
||||
@@ -91,14 +95,14 @@ return function()
|
||||
}
|
||||
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::cpu_usage",
|
||||
function(cpu_usage)
|
||||
tooltip.text = "CPU Usage: " .. cpu_usage .. "%"
|
||||
@@ -169,13 +173,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::cpu_temp",
|
||||
function(cpu_temp)
|
||||
local temp_icon
|
||||
@@ -254,13 +258,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::ram_widget",
|
||||
function(MemTotal, _, MemAvailable)
|
||||
if not MemTotal or not MemAvailable then
|
||||
@@ -333,13 +337,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::gpu_usage",
|
||||
function(gpu_usage)
|
||||
tooltip.text = "GPU Usage: " .. gpu_usage .. "%"
|
||||
@@ -410,13 +414,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::gpu_temp",
|
||||
function(gpu_temp)
|
||||
local temp_icon
|
||||
@@ -505,13 +509,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"audio::get",
|
||||
function(muted, volume)
|
||||
local icon = icondir .. "audio/volume"
|
||||
@@ -602,13 +606,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"microphone::get",
|
||||
function(muted, volume)
|
||||
if not volume then
|
||||
@@ -658,7 +662,7 @@ return function()
|
||||
{
|
||||
{ --Icon
|
||||
id = "icon1",
|
||||
image = gears.color.recolor_image(icondir .. "brightness/brightness-high.svg" .. ".svg",
|
||||
image = gears.color.recolor_image(icondir .. "brightness/brightness-high.svg",
|
||||
Theme_config.notification_center.status_bar.backlight_color),
|
||||
halign = "center",
|
||||
valign = "center",
|
||||
@@ -692,19 +696,27 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
"update::backlight",
|
||||
function(backlight, backlight_icon)
|
||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(backlight_icon,
|
||||
Theme_config.notification_center.status_bar.backlight_color)
|
||||
tooltip.text = "Backlight: " .. backlight .. "%"
|
||||
rubato_timer.target = backlight
|
||||
capi.awesome.connect_signal(
|
||||
"brightness::get",
|
||||
function(brightness)
|
||||
local icon = icondir .. "brightness"
|
||||
if brightness >= 0 and brightness < 34 then
|
||||
icon = icon .. "-low"
|
||||
elseif brightness >= 34 and brightness < 67 then
|
||||
icon = icon .. "-medium"
|
||||
elseif brightness >= 67 then
|
||||
icon = icon .. "-high"
|
||||
end
|
||||
w:get_children_by_id("icon1")[1]:set_image(gears.color.recolor_image(icon .. ".svg",
|
||||
Theme_config.notification_center.status_bar.backlight_color))
|
||||
tooltip.text = "Backlight: " .. brightness .. "%"
|
||||
rubato_timer.target = brightness
|
||||
end
|
||||
)
|
||||
elseif widget == "battery" then
|
||||
@@ -771,13 +783,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::battery_widget",
|
||||
function(battery, battery_icon)
|
||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(battery_icon,
|
||||
|
||||
Reference in New Issue
Block a user