rewrote a lot of stuff especially the bluetooth module. fixed some errors

This commit is contained in:
Rene Kievits
2022-09-21 21:10:17 +02:00
parent 3d8b240ef0
commit b5c6dc31f7
59 changed files with 1138 additions and 334 deletions

View File

@@ -1,3 +1,4 @@
---@diagnostic disable: lowercase-global
-----------------------------------------------------------------------------------------
-- █████╗ ██╗ ██╗███████╗███████╗ ██████╗ ███╗ ███╗███████╗██╗ ██╗███╗ ███╗ --
-- ██╔══██╗██║ ██║██╔════╝██╔════╝██╔═══██╗████╗ ████║██╔════╝██║ ██║████╗ ████║ --
@@ -7,6 +8,15 @@
-- ╚═╝ ╚═╝ ╚══╝╚══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ --
-----------------------------------------------------------------------------------------
-- Initialising, order is important!
awesome = awesome
client = client
mouse = mouse
mousegrabber = mousegrabber
root = root
screen = screen
tag = tag
require("src.theme.user_config")
require("src.theme.theme_config")
require("src.tools.gio_icon_lookup")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 318 KiB

View File

@@ -4,6 +4,11 @@ local gears = require("gears")
local globalkeys = require("src.bindings.global_keys")
local modkey = User_config.modkey
local capi = {
client = client,
root = root
}
for i = 1, 9 do
globalkeys = gears.table.join(globalkeys,
@@ -17,7 +22,7 @@ for i = 1, 9 do
if tag then
tag:view_only()
end
client.emit_signal("tag::switched")
capi.client.emit_signal("tag::switched")
end,
{ description = "View Tag " .. i, group = "Tag" }
),
@@ -40,10 +45,10 @@ for i = 1, 9 do
"#" .. i + 9,
function()
local screen = awful.screen.focused()
if client.focus then
if capi.client.focus then
local tag = screen.tags[i]
if tag then
client.focus:move_to_tag(tag)
capi.client.focus:move_to_tag(tag)
end
end
end,
@@ -64,4 +69,4 @@ for i = 1, 9 do
)
)
end
root.keys(globalkeys)
capi.root.keys(globalkeys)

View File

@@ -2,6 +2,10 @@
local awful = require("awful")
local gears = require("gears")
local capi = {
client = client
}
local modkey = User_config.modkey
return gears.table.join(
@@ -41,7 +45,7 @@ return gears.table.join(
{ modkey },
"#57",
function(c)
if c == client.focus then
if c == capi.client.focus then
c.minimized = true
else
c.minimized = false

View File

@@ -2,7 +2,11 @@
local gears = require("gears")
local awful = require("awful")
root.buttons = gears.table.join(
local capi = {
root = root
}
capi.root.buttons = gears.table.join(
awful.button({}, 4, awful.tag.viewnext),
awful.button({}, 5, awful.tag.viewprev)
)

View File

@@ -6,6 +6,12 @@ local ruled = require("ruled")
local json = require("src.lib.json-lua.json-lua")
local capi = {
awesome = awesome,
mousegrabber = mousegrabber,
mouse = mouse,
}
local modkey = User_config.modkey
awful.keygrabber {
@@ -14,7 +20,7 @@ awful.keygrabber {
modifiers = { "Mod1" },
key = "Tab",
on_press = function()
awesome.emit_signal("window_switcher::select_next")
capi.awesome.emit_signal("window_switcher::select_next")
end
}
},
@@ -29,11 +35,11 @@ awful.keygrabber {
stop_key = "Mod1",
stop_event = "release",
start_callback = function()
awesome.emit_signal("toggle_window_switcher")
capi.awesome.emit_signal("toggle_window_switcher")
end,
stop_callback = function()
awesome.emit_signal("window_switcher::raise")
awesome.emit_signal("toggle_window_switcher")
capi.awesome.emit_signal("window_switcher::raise")
capi.awesome.emit_signal("toggle_window_switcher")
end,
export_keybindings = true,
}
@@ -129,7 +135,7 @@ return gears.table.join(
awful.key(
{ modkey, "Control" },
"#27",
awesome.restart,
capi.awesome.restart,
{ description = "Reload awesome", group = "Awesome" }
),
awful.key(
@@ -184,7 +190,7 @@ return gears.table.join(
{ modkey },
"#40",
function()
awesome.emit_signal("application_launcher::show")
capi.awesome.emit_signal("application_launcher::show")
end,
{ descripton = "Application launcher", group = "Application" }
),
@@ -200,7 +206,7 @@ return gears.table.join(
{ modkey, "Shift" },
"#26",
function()
awesome.emit_signal("module::powermenu:show")
capi.awesome.emit_signal("module::powermenu:show")
end,
{ descripton = "Session options", group = "System" }
),
@@ -217,7 +223,7 @@ return gears.table.join(
"XF86AudioLowerVolume",
function(c)
awful.spawn.easy_async_with_shell("pactl set-sink-volume @DEFAULT_SINK@ -2%", function()
awesome.emit_signal("widget::volume_osd:rerun")
capi.awesome.emit_signal("widget::volume_osd:rerun")
end)
end,
{ description = "Lower volume", group = "System" }
@@ -227,7 +233,7 @@ return gears.table.join(
"XF86AudioRaiseVolume",
function(c)
awful.spawn.easy_async_with_shell("pactl set-sink-volume @DEFAULT_SINK@ +2%", function()
awesome.emit_signal("widget::volume_osd:rerun")
capi.awesome.emit_signal("widget::volume_osd:rerun")
end)
end,
{ description = "Increase volume", group = "System" }
@@ -237,7 +243,7 @@ return gears.table.join(
"XF86AudioMute",
function(c)
awful.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")
awesome.emit_signal("widget::volume_osd:rerun")
capi.awesome.emit_signal("widget::volume_osd:rerun")
end,
{ description = "Mute volume", group = "System" }
),
@@ -248,9 +254,9 @@ return gears.table.join(
awful.spawn.easy_async_with_shell(
"pkexec xfpm-power-backlight-helper --get-brightness",
function(stdout)
awful.spawn("pkexec xfpm-power-backlight-helper --set-brightness " ..
tostring(tonumber(stdout) + BACKLIGHT_SEPS))
awesome.emit_signal("brightness::update")
awful.spawn(awful.util.getdir("config") ..
"src/scripts/backlight.sh set " .. tostring(tonumber(stdout) + BACKLIGHT_SEPS))
capi.awesome.emit_signal("brightness::update")
end
)
end,
@@ -263,10 +269,9 @@ return gears.table.join(
awful.spawn.easy_async_with_shell(
"pkexec xfpm-power-backlight-helper --get-brightness",
function(stdout)
awful.spawn(
"pkexec xfpm-power-backlight-helper --set-brightness " ..
tostring(tonumber(stdout) - BACKLIGHT_SEPS))
awesome.emit_signal("brightness::update")
awful.spawn(awful.util.getdir("config") ..
"src/scripts/backlight.sh set " .. tostring(tonumber(stdout) - BACKLIGHT_SEPS))
capi.awesome.emit_signal("brightness::update")
end
)
end,
@@ -300,7 +305,7 @@ return gears.table.join(
{ modkey },
"#65",
function()
awesome.emit_signal("kblayout::toggle")
capi.awesome.emit_signal("kblayout::toggle")
end,
{ description = "Toggle keyboard layout", group = "System" }
),
@@ -308,7 +313,7 @@ return gears.table.join(
{ modkey },
"#22",
function()
mousegrabber.run(
capi.mousegrabber.run(
function(m)
if m.buttons[1] then
@@ -319,7 +324,7 @@ return gears.table.join(
if type(data_table) ~= "table" then return end
local c = mouse.current_client
local c = capi.mouse.current_client
if not c then return end
local client_data = {
@@ -351,7 +356,7 @@ return gears.table.join(
if not handler then return end
handler:write(json:encode(data_table))
handler:close()
mousegrabber.stop()
capi.mousegrabber.stop()
end
return true
end,
@@ -363,7 +368,7 @@ return gears.table.join(
{ modkey, "Shift" },
"#22",
function()
mousegrabber.run(
capi.mousegrabber.run(
function(m)
if m.buttons[1] then
@@ -374,7 +379,7 @@ return gears.table.join(
if type(data_table) ~= "table" then return end
local c = mouse.current_client
local c = capi.mouse.current_client
if not c then return end
local client_data = {
@@ -403,7 +408,7 @@ return gears.table.join(
if not handler then return end
handler:write(json:encode(data_table))
handler:close()
mousegrabber.stop()
capi.mousegrabber.stop()
end
return true
end,

View File

@@ -4,15 +4,19 @@
-- Awesome Libs
local naughty = require("naughty")
if awesome.startup_errors then
local capi = {
awesome = awesome,
}
if capi.awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors })
text = capi.awesome.startup_errors })
end
do
local in_error = false
awesome.connect_signal(
capi.awesome.connect_signal(
"debug::error",
function(err)
if in_error then

View File

@@ -11,6 +11,11 @@ local wibox = require("wibox")
local rubato = require("src.lib.rubato")
local capi = {
client = client,
screen = screen,
}
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
naughty.config.defaults.ontop = true
@@ -389,7 +394,7 @@ naughty.connect_signal(
end
-- Raise the client on click
if key == 1 then
for _, client in ipairs(client.get()) do
for _, client in ipairs(capi.client.get()) do
if client.name:match(n.app_name) then
if not client:isvisible() and client.first_tag then
client.first_tag:view_only()
@@ -406,7 +411,7 @@ naughty.connect_signal(
notification = n,
timeout = 5,
type = "notification",
screen = screen.primary,
screen = capi.screen.primary,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end,

View File

@@ -6,24 +6,32 @@ local gears = require("gears")
local color = require("src.lib.color")
local rubato = require("src.lib.rubato")
screen.connect_signal(
local capi = {
awesome = awesome,
mouse = mouse,
screen = screen,
client = client,
tag = tag
}
capi.screen.connect_signal(
"added",
function()
awesome.restart()
capi.awesome.restart()
end
)
screen.connect_signal(
capi.screen.connect_signal(
"removed",
function()
awesome.restart()
capi.awesome.restart()
end
)
client.connect_signal(
capi.client.connect_signal(
"manage",
function(c)
if awesome.startup and not c.size_hints.user_porition and not c.size_hints.program_position then
if capi.awesome.startup and not c.size_hints.user_porition and not c.size_hints.program_position then
awful.placement.no_offscreen(c)
end
c.shape = function(cr, width, height)
@@ -42,7 +50,7 @@ client.connect_signal(
end
)
client.connect_signal(
capi.client.connect_signal(
'unmanage',
function(c)
if #awful.screen.focused().clients > 0 then
@@ -57,7 +65,7 @@ client.connect_signal(
end
)
tag.connect_signal(
capi.tag.connect_signal(
'property::selected',
function(c)
if #awful.screen.focused().clients > 0 then
@@ -257,7 +265,7 @@ function Hover_signal(widget, bg_override, fg_override, border_override, icon_ov
if icon and widget.icon and icon_override and icon_override_hover then
widget.icon.image = gears.color.recolor_image(icon, icon_override_hover)
end
local w = mouse.current_wibox
local w = capi.mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = "hand1"

View File

@@ -5,24 +5,31 @@
-- Awesome Libs
local awful = require("awful")
local Gio = require("lgi").Gio
local gfilesystem = require("gears").filesystem
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local capi = {
awesome = awesome,
mouse = mouse,
}
local json = require("src.lib.json-lua.json-lua")
local cm = require("src.modules.context_menu")
local icondir = awful.util.getdir("config") .. "src/assets/icons/context_menu/"
return function()
return function(s)
local application_grid = wibox.widget {
homogenous = true,
expand = false,
spacing = dpi(10),
id = "grid",
forced_num_cols = 8,
-- 200 is the application element width + 10 spacing
forced_num_cols = math.floor((capi.mouse.screen.geometry.width / 100 * 60) / (200)),
forced_num_rows = 7,
orientation = "vertical",
layout = wibox.layout.grid
@@ -107,7 +114,7 @@ return function()
name = "Execute as sudo",
icon = gears.color.recolor_image(icondir .. "launch.svg", Theme_config.context_menu.icon_color),
callback = function()
awesome.emit_signal("application_launcher::show")
capi.awesome.emit_signal("application_launcher::show")
awful.spawn("/home/crylia/.config/awesome/src/scripts/start_as_admin.sh " .. app_widget.exec)
end
},
@@ -115,6 +122,11 @@ return function()
name = "Pin to dock",
icon = gears.color.recolor_image(icondir .. "pin.svg", Theme_config.context_menu.icon_color),
callback = function()
local dir = awful.util.getdir("config") .. "src/config"
gfilesystem.make_directories(dir)
if not gfilesystem.file_readable(dir) then
os.execute("touch " .. dir .. "/dock.json")
end
local handler = io.open("/home/crylia/.config/awesome/src/config/dock.json", "r")
if not handler then
return
@@ -141,14 +153,14 @@ return function()
end
handler:write(dock_encoded)
handler:close()
awesome.emit_signal("dock::changed")
capi.awesome.emit_signal("dock::changed")
end
},
{
name = "Add to desktop",
icon = gears.color.recolor_image(icondir .. "desktop.svg", Theme_config.context_menu.icon_color),
callback = function()
awesome.emit_signal("application_launcher::show")
capi.awesome.emit_signal("application_launcher::show")
--!TODO: Add to desktop
end
}
@@ -163,7 +175,7 @@ return function()
button = 1,
on_release = function()
Gio.AppInfo.launch_uris_async(app)
awesome.emit_signal("application_launcher::show")
capi.awesome.emit_signal("application_launcher::show")
end
}),
awful.button({
@@ -174,8 +186,8 @@ return function()
return
end
-- add offset so mouse is above widget, this is so the mouse::leave event triggers always
context_menu.x = mouse.coords().x - 10
context_menu.y = mouse.coords().y - 10
context_menu.x = capi.mouse.coords().x - 10
context_menu.y = capi.mouse.coords().y - 10
context_menu.visible = not context_menu.visible
end
})
@@ -214,7 +226,7 @@ return function()
local pos = application_grid:get_widget_position(application)
-- Check if the curser is currently at the same position as the application
awesome.connect_signal(
capi.awesome.connect_signal(
"update::selected",
function()
if curser.y == pos.row and curser.x == pos.col then
@@ -224,7 +236,7 @@ return function()
end
end
)
awesome.emit_signal("update::selected")
capi.awesome.emit_signal("update::selected")
end
end
@@ -233,18 +245,18 @@ return function()
application_grid = get_applications(filter)
awesome.connect_signal(
capi.awesome.connect_signal(
"application::left",
function()
curser.x = curser.x - 1
if curser.x < 1 then
curser.x = 1
end
awesome.emit_signal("update::selected")
capi.awesome.emit_signal("update::selected")
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"application::right",
function()
curser.x = curser.x + 1
@@ -252,22 +264,22 @@ return function()
if curser.x > grid_cols then
curser.x = grid_cols
end
awesome.emit_signal("update::selected")
capi.awesome.emit_signal("update::selected")
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"application::up",
function()
curser.y = curser.y - 1
if curser.y < 1 then
curser.y = 1
end
awesome.emit_signal("update::selected")
capi.awesome.emit_signal("update::selected")
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"application::down",
function()
curser.y = curser.y + 1
@@ -275,21 +287,21 @@ return function()
if curser.y > grid_rows then
curser.y = grid_rows
end
awesome.emit_signal("update::selected")
capi.awesome.emit_signal("update::selected")
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"update::application_list",
function(f)
application_grid = get_applications(f)
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"application_launcher::execute",
function()
awesome.emit_signal("searchbar::stop")
capi.awesome.emit_signal("searchbar::stop")
local selected_widget = application_grid:get_widgets_at(curser.y, curser.x)[1]
Gio.AppInfo.launch_uris_async(Gio.AppInfo.create_from_commandline(selected_widget.exec, nil, 0))

View File

@@ -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,
}
local application_grid = require("src.modules.application_launcher.application")()
local searchbar = require("src.modules.application_launcher.searchbar")()
@@ -32,7 +37,7 @@ return function(s)
widget = wibox.container.margin
},
height = s.geometry.height / 100 * 60,
width = s.geometry.width / 100 * 60,
--width = s.geometry.width / 100 * 60,
strategy = "exact",
widget = wibox.container.constraint
}
@@ -57,17 +62,17 @@ return function(s)
layout = wibox.layout.fixed.vertical
}
awesome.connect_signal(
capi.awesome.connect_signal(
"application_launcher::show",
function()
if mouse.screen == s then
if capi.mouse.screen == s then
application_container.visible = not application_container.visible
if application_container.visible == false then
awesome.emit_signal("searchbar::stop")
capi.awesome.emit_signal("searchbar::stop")
end
end
if application_container.visible then
awesome.emit_signal("searchbar::start")
capi.awesome.emit_signal("searchbar::start")
end
end
)

View File

@@ -6,13 +6,15 @@
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local gfs = gears.filesystem
local gtable = gears.table
local gdebug = gears.debug
local gstring = gears.string
local keygrabber = require("awful.keygrabber")
local wibox = require("wibox")
local capi = {
awesome = awesome,
mouse = mouse,
}
local icondir = awful.util.getdir("config") .. "src/assets/icons/application_launcher/searchbar/"
local kgrabber
@@ -71,7 +73,7 @@ return function()
local old_wibox, old_cursor
local mouse_enter = function()
local w = mouse.current_wibox
local w = capi.mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = "xterm"
@@ -135,16 +137,16 @@ return function()
local function update()
search_text:set_markup(promt_text_with_cursor(text_string, cur_pos))
--Send the string over to the application to filter applications
awesome.emit_signal("update::application_list", text_string)
capi.awesome.emit_signal("update::application_list", text_string)
end
update()
kgrabber = keygrabber.run(
function(modifiers, key, event)
awesome.connect_signal("searchbar::stop", function()
capi.awesome.connect_signal("searchbar::stop", function()
keygrabber.stop(kgrabber)
awesome.emit_signal("application_launcher::kgrabber_start")
capi.awesome.emit_signal("application_launcher::kgrabber_start")
end)
local mod = {}
@@ -162,7 +164,7 @@ return function()
keygrabber.stop(kgrabber)
search_text:set_markup(promt_text_with_cursor("", 1))
text_string = ""
awesome.emit_signal("application_launcher::show")
capi.awesome.emit_signal("application_launcher::show")
elseif (not mod.Control and key == "Return") or
(not mod.Control and key == "KP_Enter") then
keygrabber.stop(kgrabber)
@@ -170,8 +172,8 @@ return function()
searchbar.s_background.fg = Theme_config.application_launcher.searchbar.fg_hint
search_text:set_markup(promt_text_with_cursor("", 1))
text_string = ""
awesome.emit_signal("application_launcher::execute")
awesome.emit_signal("application_launcher::show")
capi.awesome.emit_signal("application_launcher::execute")
capi.awesome.emit_signal("application_launcher::show")
end
if mod.Control then
@@ -195,15 +197,15 @@ return function()
-- Move cursor to the left
elseif key == "Left" then
--cur_pos = cur_pos - 1
awesome.emit_signal("application::left")
capi.awesome.emit_signal("application::left")
-- Move cursor to the right
elseif key == "Right" then
--cur_pos = cur_pos + 1
awesome.emit_signal("application::right")
capi.awesome.emit_signal("application::right")
elseif key == "Up" then
awesome.emit_signal("application::up")
capi.awesome.emit_signal("application::up")
elseif key == "Down" then
awesome.emit_signal("application::down")
capi.awesome.emit_signal("application::down")
else
--Add key at cursor position
if key:wlen() == 1 then
@@ -234,7 +236,7 @@ return function()
end)
))
awesome.connect_signal(
capi.awesome.connect_signal(
"searchbar::start",
function()
if not awful.keygrabber.is_running then

View File

@@ -0,0 +1,187 @@
--------------------------------------
-- This is the bluetooth controller --
--------------------------------------
-- Awesome Libs
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local gobject = require("gears").object
local gtable = require("gears").table
local gcolor = require("gears").color
local gshape = require("gears").shape
local wibox = require("wibox")
local capi = {
awesome = awesome,
}
local icondir = awful.util.getdir("config") .. "src/assets/icons/bluetooth/"
local device = { mt = {} }
function device:connect()
self.device:Connect()
self.widget:get_children_by_id("con")[1].image = gcolor.recolor_image(icondir .. "link.svg",
Theme_config.bluetooth_controller.icon_color_dark)
capi.awesome.emit_signal("bluetooth::disconnect", device)
end
function device:disconnect()
self.device:Disconnect()
self.widget:get_children_by_id("con")[1].image = gcolor.recolor_image(icondir .. "link-off.svg",
Theme_config.bluetooth_controller.icon_color_dark)
capi.awesome.emit_signal("bluetooth::connect", device)
end
function device.new(args)
args = args or {}
args.device = args.device or {}
args.battery = args.battery or {}
local ret = gobject { enable_properties = true, enable_auto_signals = true }
gtable.crush(ret, device, true)
if args.device then
ret.device = args.device
end
if args.battery then
ret.battery = args.battery
end
local icon = device.Icon or "bluetooth-on"
local device_widget = wibox.widget {
{
{
{
{
{
image = gcolor.recolor_image(
icondir .. icon .. ".svg", Theme_config.bluetooth_controller.icon_color),
id = "icon",
resize = false,
valign = "center",
halign = "center",
forced_width = dpi(24),
forced_height = dpi(24),
widget = wibox.widget.imagebox
},
id = "icon_container",
strategy = "max",
width = dpi(24),
height = dpi(24),
widget = wibox.container.constraint
},
{
{
{
text = ret.device.Alias or ret.device.Name,
id = "alias",
widget = wibox.widget.textbox
},
{
text = "Connecting...",
id = "connecting",
visible = false,
font = User_config.font.specify .. ", regular 10",
widget = wibox.widget.textbox
},
id = "alias_container",
layout = wibox.layout.fixed.horizontal
},
width = dpi(260),
height = dpi(40),
strategy = "max",
widget = wibox.container.constraint
},
spacing = dpi(10),
layout = wibox.layout.fixed.horizontal
},
{ -- Spacing
forced_width = dpi(10),
widget = wibox.container.background
},
{
{
{
{
{
id = "con",
resize = false,
valign = "center",
halign = "center",
forced_width = dpi(24),
forced_height = dpi(24),
widget = wibox.widget.imagebox
},
id = "place",
strategy = "max",
width = dpi(24),
height = dpi(24),
widget = wibox.container.constraint
},
id = "margin",
margins = dpi(2),
widget = wibox.container.margin
},
id = "backgr",
shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(4))
end,
bg = Theme_config.bluetooth_controller.con_button_color,
widget = wibox.container.background
},
id = "margin0",
margin = dpi(5),
widget = wibox.container.margin
},
id = "device_layout",
layout = wibox.layout.align.horizontal
},
id = "device_margin",
margins = dpi(5),
widget = wibox.container.margin
},
bg = Theme_config.bluetooth_controller.device_bg,
fg = Theme_config.bluetooth_controller.device_fg,
border_color = Theme_config.bluetooth_controller.device_border_color,
border_width = Theme_config.bluetooth_controller.device_border_width,
id = "background",
shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(4))
end,
device = ret.device,
widget = wibox.container.background
}
if ret.device.Connected then
device_widget:get_children_by_id("con")[1].image = gcolor.recolor_image(icondir .. "link.svg",
Theme_config.bluetooth_controller.icon_color_dark)
else
device_widget:get_children_by_id("con")[1].image = gcolor.recolor_image(icondir .. "link-off.svg",
Theme_config.bluetooth_controller.icon_color_dark)
end
device_widget:buttons(
gtable.join(
awful.button({}, 1, function()
if ret.device.Connected then
ret:disconnect()
else
ret:connect()
end
end)
)
)
Hover_signal(device_widget)
ret.widget = device_widget
return ret
end
function device.mt.__call(...)
return device.new(...)
end
return setmetatable(device, device.mt)

View File

@@ -0,0 +1,366 @@
--------------------------------------
-- This is the bluetooth controller --
--------------------------------------
-- Awesome Libs
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local gobject = require("gears").object
local gtable = require("gears").table
local gcolor = require("gears").color
local gshape = require("gears").shape
local wibox = require("wibox")
local bt_device = require("src.modules.bluetooth.device")
local rubato = require("src.lib.rubato")
local icondir = awful.util.getdir("config") .. "src/assets/icons/bluetooth/"
local capi = {
awesome = awesome,
mouse = mouse,
mousegrabber = mousegrabber,
}
local bluetooth = { mt = {} }
bluetooth.devices = {
paired = { layout = wibox.layout.fixed.vertical },
discovered = { layout = wibox.layout.fixed.vertical }
}
function bluetooth:get_devices()
return self.devices
end
local function add_device(self, device, battery)
--Check if the device is already in the list
for _, status in pairs(self.devices) do
for _, dev in ipairs(status) do
if dev.device.Address == device.Address then
return
end
end
end
if device.Paired then
table.insert(self.devices.paired, bt_device.new { device = device, battery = battery }.widget)
else
table.insert(self.devices.discovered, bt_device.new { device = device, battery = battery }.widget)
end
end
function bluetooth.remove_device(self, device)
end
function bluetooth.new(args)
args = args or {}
local ret = gobject { enable_properties = true, enable_auto_signals = true }
gtable.crush(ret, bluetooth, true)
local bluetooth_container = wibox.widget {
{
{
{
{
{
{
{
{
resize = false,
image = gcolor.recolor_image(icondir .. "menu-down.svg",
Theme_config.bluetooth_controller.connected_icon_color),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
id = "icon"
},
id = "center",
halign = "center",
valign = "center",
widget = wibox.container.place,
},
{
{
text = "Paired Devices",
widget = wibox.widget.textbox,
id = "device_name"
},
margins = dpi(5),
widget = wibox.container.margin
},
id = "connected",
layout = wibox.layout.fixed.horizontal
},
id = "connected_bg",
bg = Theme_config.bluetooth_controller.connected_bg,
fg = Theme_config.bluetooth_controller.connected_fg,
shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
},
id = "connected_margin",
widget = wibox.container.margin
},
{
id = "connected_list",
{
{
{
step = dpi(50),
spacing = dpi(10),
layout = require("src.lib.overflow_widget.overflow").vertical,
scrollbar_width = 0,
id = "connected_device_list"
},
id = "margin",
margins = dpi(10),
widget = wibox.container.margin
},
id = "place",
height = dpi(200),
strategy = "max",
widget = wibox.container.constraint
},
border_color = Theme_config.bluetooth_controller.con_device_border_color,
border_width = Theme_config.bluetooth_controller.con_device_border_width,
shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background,
forced_height = 0
},
{
{
{
{
{
resize = false,
image = gcolor.recolor_image(icondir .. "menu-down.svg",
Theme_config.bluetooth_controller.discovered_icon_color),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
id = "icon",
},
id = "center",
halign = "center",
valign = "center",
widget = wibox.container.place,
},
{
{
text = "Nearby Devices",
widget = wibox.widget.textbox,
id = "device_name"
},
margins = dpi(5),
widget = wibox.container.margin
},
id = "discovered",
layout = wibox.layout.fixed.horizontal
},
id = "discovered_bg",
bg = Theme_config.bluetooth_controller.discovered_bg,
fg = Theme_config.bluetooth_controller.discovered_fg,
shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(4))
end,
widget = wibox.container.background
},
id = "discovered_margin",
top = dpi(10),
widget = wibox.container.margin
},
{
id = "discovered_list",
{
{
{
id = "discovered_device_list",
spacing = dpi(10),
step = dpi(50),
layout = require("src.lib.overflow_widget.overflow").vertical,
scrollbar_width = 0,
},
id = "margin",
margins = dpi(10),
widget = wibox.container.margin
},
id = "place",
height = dpi(200),
strategy = "max",
widget = wibox.container.constraint
},
border_color = Theme_config.bluetooth_controller.con_device_border_color,
border_width = Theme_config.bluetooth_controller.con_device_border_width,
shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, false, false, true, true, dpi(4))
end,
widget = wibox.container.background,
forced_height = 0
},
id = "layout1",
layout = wibox.layout.fixed.vertical
},
id = "margin",
margins = dpi(15),
widget = wibox.container.margin
},
shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(8))
end,
border_color = Theme_config.bluetooth_controller.container_border_color,
border_width = Theme_config.bluetooth_controller.container_border_width,
bg = Theme_config.bluetooth_controller.container_bg,
id = "background",
widget = wibox.container.background
},
width = dpi(400),
strategy = "exact",
widget = wibox.container.constraint
}
capi.awesome.connect_signal(
"bluetooth::device_changed",
function(device, battery)
add_device(ret, device, battery)
bluetooth_container:get_children_by_id("connected_device_list")[1].children = ret:get_devices().paired
bluetooth_container:get_children_by_id("discovered_device_list")[1].children = ret:get_devices().discovered
end
)
local connected_margin = bluetooth_container:get_children_by_id("connected_margin")[1]
local connected_list = bluetooth_container:get_children_by_id("connected_list")[1]
local connected_bg = bluetooth_container:get_children_by_id("connected_bg")[1]
local connected = bluetooth_container:get_children_by_id("connected")[1].center
connected_margin:connect_signal(
"button::press",
function()
capi.awesome.emit_signal("bluetooth::scan")
local rubato_timer = rubato.timed {
duration = 0.2,
pos = connected_list.forced_height,
easing = rubato.linear,
subscribed = function(v)
connected_list.forced_height = v
end
}
if connected_list.forced_height == 0 then
local size = (#ret:get_devices().paired * 60) + 1
if size < 210 then
rubato_timer.target = dpi(size)
end
connected_margin.connected_bg.shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
connected.icon:set_image(gcolor.recolor_image(icondir .. "menu-up.svg",
Theme_config.bluetooth_controller.connected_icon_color))
else
rubato_timer.target = 0
connected_bg.shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, 4)
end
connected.icon:set_image(gcolor.recolor_image(icondir .. "menu-down.svg",
Theme_config.bluetooth_controller.connected_icon_color))
end
end
)
local discovered_margin = bluetooth_container:get_children_by_id("discovered_margin")[1]
local discovered_list = bluetooth_container:get_children_by_id("discovered_list")[1]
local discovered_bg = bluetooth_container:get_children_by_id("discovered_bg")[1]
local discovered = bluetooth_container:get_children_by_id("discovered")[1].center
discovered_margin:connect_signal(
"button::press",
function()
capi.awesome.emit_signal("bluetooth::scan")
local rubato_timer = rubato.timed {
duration = 0.2,
pos = discovered_list.forced_height,
easing = rubato.linear,
subscribed = function(v)
discovered_list.forced_height = v
end
}
if discovered_list.forced_height == 0 then
local size = (#ret:get_devices().discovered * 60) + 1
if size < 210 then
rubato_timer.target = dpi(size)
end
discovered_margin.discovered_bg.shape = function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
discovered.icon:set_image(gcolor.recolor_image(icondir .. "menu-up.svg",
Theme_config.bluetooth_controller.discovered_icon_color))
else
rubato_timer.target = 0
discovered_bg.shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, 4)
end
discovered.icon:set_image(gcolor.recolor_image(icondir .. "menu-down.svg",
Theme_config.bluetooth_controller.discovered_icon_color))
end
end
)
ret.widget = awful.popup {
widget = bluetooth_container,
ontop = true,
bg = Theme_config.bluetooth_controller.container_bg,
stretch = false,
visible = false,
screen = args.screen,
placement = function(c) awful.placement.align(c,
{ position = "top_right", margins = { right = dpi(360), top = dpi(60) } })
end,
shape = function(cr, width, height)
gshape.rounded_rect(cr, width, height, dpi(12))
end
}
awesome.connect_signal(
"bluetooth_controller::toggle",
function()
if ret.widget.screen == capi.mouse.screen then
ret.widget.visible = not ret.widget.visible
end
end
)
ret.widget:connect_signal(
"mouse::leave",
function()
capi.mousegrabber.run(
function()
capi.awesome.emit_signal("bluetooth_controller::toggle", args.screen)
capi.mousegrabber.stop()
return true
end,
"arrow"
)
end
)
ret.widget:connect_signal(
"mouse::enter",
function()
capi.mousegrabber.stop()
end
)
end
function bluetooth.mt:__call(...)
return bluetooth.new(...)
end
return setmetatable(bluetooth, bluetooth.mt)

View File

@@ -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/brightness/"
@@ -69,9 +74,10 @@ return function(s)
widget = wibox.container.background
}
awesome.connect_signal(
capi.awesome.connect_signal(
"brightness::get",
function(brightness)
print(brightness)
brightness_osd_widget:get_children_by_id("progressbar1")[1].value = brightness
local icon = icondir .. "brightness"
@@ -112,10 +118,10 @@ return function(s)
layout = wibox.layout.fixed.horizontal
}
awesome.connect_signal(
capi.awesome.connect_signal(
"brightness::rerun",
function()
if mouse.screen == s then
if capi.mouse.screen == s then
brightness_container.visible = true
if hide_brightness_osd.started then
hide_brightness_osd:again()

View File

@@ -9,6 +9,11 @@ local gears = require("gears")
local wibox = require("wibox")
local ical_parser = require("src.tools.ical_parser")
local capi = {
awesome = awesome,
mouse = mouse,
}
local icondir = awful.util.getdir("config") .. "src/assets/icons/calendar/"
--- Month name lookup table
@@ -124,7 +129,7 @@ local function get_weeks_in_month(month, year)
end
---Gets the last month and accounts for year changes
---@param d date date object
---@param d table date object
---@return table|nil date returns a date object
local function get_last_month(d)
if not (d) then return end
@@ -410,7 +415,7 @@ return function(s)
---Main function to create the calendar widget
---Probably needs some refractor at some point since it's a bit messy
---@return widget calendar_widget
---@return wibox.widget calendar_widget
local function create_calendar()
calendar_matrix:reset()
@@ -562,12 +567,12 @@ return function(s)
day:connect_signal("day::update_selected", function()
if column == selected_day.col and 1 == selected_day.row then
awesome.emit_signal("day::reset_border")
capi.awesome.emit_signal("day::reset_border")
day.background.border_color = Theme_config.calendar.day.today_border_color
end
end)
awesome.connect_signal("day::reset_border", function()
capi.awesome.connect_signal("day::reset_border", function()
day.background.border_color = Theme_config.calendar.day.border_color
end)
@@ -663,12 +668,12 @@ return function(s)
day:connect_signal("day::update_selected", function()
if col == selected_day.col and row == selected_day.row then
awesome.emit_signal("day::reset_border")
capi.awesome.emit_signal("day::reset_border")
day.background.border_color = Theme_config.calendar.day.today_border_color
end
end)
awesome.connect_signal("day::reset_border", function()
capi.awesome.connect_signal("day::reset_border", function()
day.background.border_color = Theme_config.calendar.day.border_color
end)
@@ -773,12 +778,12 @@ return function(s)
day:connect_signal("day::update_selected", function()
if i == selected_day.col and months[date.month].weeks == selected_day.row then
awesome.emit_signal("day::reset_border")
capi.awesome.emit_signal("day::reset_border")
day.background.border_color = Theme_config.calendar.day.today_border_color
end
end)
awesome.connect_signal("day::reset_border", function()
capi.awesome.connect_signal("day::reset_border", function()
day.background.border_color = Theme_config.calendar.day.border_color
end)
calendar_matrix:add_widget_at(day, months[date.month].weeks, months[date.month].last_day + i)
@@ -1073,8 +1078,8 @@ return function(s)
)
--- Toggle calendar visibility
awesome.connect_signal("calendar::toggle", function(widget)
if s == mouse.screen then
capi.awesome.connect_signal("calendar::toggle", function(widget)
if s == capi.mouse.screen then
cal_popup.x = 3765
cal_popup.y = 60
cal_popup.visible = not cal_popup.visible

View File

@@ -7,6 +7,11 @@ local gshape = require("gears.shape")
local gcolor = require("gears.color")
local wibox = require("wibox")
local capi = {
awesome = awesome,
mouse = mouse,
}
local ical_parser = require("src.tools.ical_parser")()
--local task_info = require("src.modules.calendar.task_info")
@@ -481,8 +486,8 @@ function calendar:create_calendar_widget()
ontop = true,
visible = true,
bg = "#00000000",
x = mouse.coords().x,
y = mouse.coords().y,
x = capi.mouse.coords().x,
y = capi.mouse.coords().y,
screen = self.screen
}
@@ -901,8 +906,10 @@ function calendar.new(args)
ontop = true,
bg = "#00000000",
visible = false,
x = 3750,
y = 60
placement = function(c) awful.placement.align(c,
{ position = "top_right", margins = { right = dpi(10), top = dpi(65) } })
end
}
calendar_widget:get_children_by_id("add_ical")[1]:buttons(
@@ -991,8 +998,8 @@ function calendar.new(args)
)
)
awesome.connect_signal("calendar::toggle", function()
if mouse.screen == args.screen then
capi.awesome.connect_signal("calendar::toggle", function()
if capi.mouse.screen == args.screen then
ret.widget.visible = not ret.widget.visible
end
end)

View File

@@ -7,6 +7,10 @@ local gshape = require("gears.shape")
local gobject = require("gears.object")
local wibox = require("wibox")
local capi = {
mouse = mouse,
}
local icondir = awful.util.getdir("config") .. "src/assets/icons/calendar/"
local task_info = { mt = {} }
@@ -111,8 +115,8 @@ function task_info.new(args)
ontop = true,
visible = true,
bg = "#00000000",
x = mouse.coords().x,
y = mouse.coords().y,
x = capi.mouse.coords().x,
y = capi.mouse.coords().y,
screen = args.screen
}

View File

@@ -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,
}
return function(args)
if not args then
return
@@ -65,7 +70,7 @@ return function(args)
modifiers = {},
button = 1,
on_release = function()
awesome.emit_signal("context_menu::hide")
capi.awesome.emit_signal("context_menu::hide")
entry.callback()
end
})
@@ -91,18 +96,18 @@ return function(args)
border_width = Theme_config.context_menu.border_width,
border_color = Theme_config.context_menu.border_color,
shape = Theme_config.context_menu.shape,
x = mouse.coords().x,
y = mouse.coords().y,
x = capi.mouse.coords().x,
y = capi.mouse.coords().y,
visible = false,
ontop = true,
placement = awful.placement.no_offscreen,
}
menu:connect_signal("mouse::leave", function()
awesome.emit_signal("context_menu::hide")
capi.awesome.emit_signal("context_menu::hide")
end)
awesome.connect_signal(
capi.awesome.connect_signal(
"context_menu::hide",
function()
menu.visible = false

View File

@@ -7,6 +7,11 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local capi = {
awesome = awesome,
client = client,
}
return function(s, widgets)
local top_center = awful.popup {
@@ -74,7 +79,7 @@ return function(s, widgets)
layout = wibox.layout.fixed.horizontal
}
client.connect_signal(
capi.client.connect_signal(
"manage",
function(c)
if #s.selected_tag:clients() < 1 then
@@ -85,7 +90,7 @@ return function(s, widgets)
end
)
client.connect_signal(
capi.client.connect_signal(
"unmanage",
function(c)
if #s.selected_tag:clients() < 1 then
@@ -96,7 +101,7 @@ return function(s, widgets)
end
)
client.connect_signal(
capi.client.connect_signal(
"property::selected",
function(c)
if #s.selected_tag:clients() < 1 then
@@ -107,7 +112,7 @@ return function(s, widgets)
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"refresh",
function(c)
if #s.selected_tag:clients() < 1 then

View File

@@ -8,6 +8,12 @@ local Gio = require("lgi").Gio
local gears = require("gears")
local wibox = require("wibox")
local capi = {
awesome = awesome,
client = client,
mouse = mouse,
}
local json = require("src.lib.json-lua.json-lua")
local icondir = awful.util.getdir("config") .. "src/assets/icons/context_menu/"
@@ -65,7 +71,7 @@ return function(screen)
Hover_signal(dock_element.background, Theme_config.dock.element_focused_bg .. "dd")
local DAI = Gio.DesktopAppInfo.new_from_filename(program.desktop_file)
if not DAI then return end
local action_entries = {}
for _, action in ipairs(program.actions) do
table.insert(action_entries, {
@@ -101,7 +107,7 @@ return function(screen)
end
data:write(json:encode(dock))
data:close()
awesome.emit_signal("dock::changed")
capi.awesome.emit_signal("dock::changed")
end
})
@@ -125,19 +131,19 @@ return function(screen)
return
end
-- add offset so mouse is above widget, this is so the mouse::leave event triggers always
context_menu.x = mouse.coords().x - 10
context_menu.y = mouse.coords().y + 10 - context_menu.height
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
end
})
))
awesome.connect_signal(
capi.awesome.connect_signal(
"context_menu::hide",
function()
cm_open = false
awesome.emit_signal("dock::check_for_dock_hide")
capi.awesome.emit_signal("dock::check_for_dock_hide")
end
)
@@ -168,14 +174,14 @@ return function(screen)
for _, pr in ipairs(prog) do
local indicators = { layout = wibox.layout.flex.horizontal, spacing = dpi(5) }
local col = Theme_config.dock.indicator_bg
for _, c in ipairs(client.get()) do
for _, c in ipairs(capi.client.get()) do
local icon_name = string.lower(pr.icon)
if not c or not c.valid then return end
if not c.class then c.class = "" end
local class = string.lower(c.class)
local cls = c.class or ""
local class = string.lower(cls)
icon_name = string.match(icon_name, ".*/(.*)%.[svg|png]")
if class == icon_name or class:match(icon_name) or icon_name:match(class) then
if c == client.focus then
if c == capi.client.focus then
col = Theme_config.dock.indicator_focused_bg
elseif c.urgent then
col = Theme_config.dock.indicator_urgent_bg
@@ -307,17 +313,17 @@ return function(screen)
dock.visible = false
if client.fullscreen then
fakedock.visible = false
awesome.emit_signal("notification_center_activation::toggle", s, false)
capi.awesome.emit_signal("notification_center_activation::toggle", s, false)
end
elseif not client.fullscreen then
fakedock.visible = true
awesome.emit_signal("notification_center_activation::toggle", s, true)
capi.awesome.emit_signal("notification_center_activation::toggle", s, true)
end
end
if s == mouse.screen then
if s == capi.mouse.screen then
local minimized = false
for _, c in ipairs(clients_on_tag) do
if c.minimized then
@@ -370,7 +376,7 @@ return function(screen)
end
)
client.connect_signal(
capi.client.connect_signal(
"manage",
function()
check_for_dock_hide(screen)
@@ -387,7 +393,7 @@ return function(screen)
end
)
client.connect_signal(
capi.client.connect_signal(
"property::minimized",
function()
check_for_dock_hide(screen)
@@ -404,7 +410,7 @@ return function(screen)
end
)
client.connect_signal(
capi.client.connect_signal(
"unmanage",
function()
check_for_dock_hide(screen)
@@ -421,7 +427,7 @@ return function(screen)
end
)
client.connect_signal(
capi.client.connect_signal(
"focus",
function()
check_for_dock_hide(screen)
@@ -438,7 +444,7 @@ return function(screen)
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"dock::changed",
function()
get_dock_elements()
@@ -455,7 +461,7 @@ return function(screen)
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"dock::check_for_dock_hide",
function()
dock_intelligent_hide:again()

View File

@@ -20,7 +20,7 @@ awful.screen.connect_for_each_screen(
require("src.modules.powermenu")(s)
require("src.modules.volume_osd")(s)
require("src.modules.brightness_osd")(s)
require("src.modules.bluetooth_controller")(s)
require("src.modules.bluetooth.init") { screen = s }
require("src.modules.titlebar")
require("src.modules.volume_controller")(s)
require("src.modules.crylia_bar.init")(s)

View File

@@ -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
)

View File

@@ -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
)

View File

@@ -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)

View File

@@ -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,

View File

@@ -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/powermenu/"
@@ -117,26 +122,26 @@ return function(s)
-- Create the power menu actions
local suspend_command = function()
awful.spawn("systemctl suspend")
awesome.emit_signal("module::powermenu:hide")
capi.awesome.emit_signal("module::powermenu:hide")
end
local logout_command = function()
awesome.quit()
capi.awesome.quit()
end
local lock_command = function()
awful.spawn("dm-tool lock")
awesome.emit_signal("module::powermenu:hide")
capi.awesome.emit_signal("module::powermenu:hide")
end
local shutdown_command = function()
awful.spawn("shutdown now")
awesome.emit_signal("module::powermenu:hide")
capi.awesome.emit_signal("module::powermenu:hide")
end
local reboot_command = function()
awful.spawn("reboot")
awesome.emit_signal("module::powermenu:hide")
capi.awesome.emit_signal("module::powermenu:hide")
end
-- Create the buttons with their command and name etc
@@ -206,7 +211,7 @@ return function(s)
{},
3,
function()
awesome.emit_signal("module::powermenu:hide")
capi.awesome.emit_signal("module::powermenu:hide")
end
)
)
@@ -218,23 +223,23 @@ return function(s)
stop_event = 'release',
keypressed_callback = function(self, mod, key, command)
if key == 'Escape' then
awesome.emit_signal("module::powermenu:hide")
capi.awesome.emit_signal("module::powermenu:hide")
end
end
}
-- Signals
awesome.connect_signal(
capi.awesome.connect_signal(
"module::powermenu:show",
function()
if s == mouse.screen then
if s == capi.mouse.screen then
powermenu_container.visible = true
powermenu_keygrabber:start()
end
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"module::powermenu:hide",
function()
powermenu_keygrabber:stop()

View File

@@ -8,8 +8,10 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local color = require("src.lib.color")
local rubato = require("src.lib.rubato")
local capi = {
awesome = awesome,
client = client
}
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/titlebar/"
@@ -404,7 +406,7 @@ local create_titlebar_dialog_modal = function(c, size, position)
)
end
client.connect_signal(
capi.client.connect_signal(
"request::titlebars",
function(c)
if c.type == "dialog" then
@@ -425,7 +427,7 @@ client.connect_signal(
end
)
client.connect_signal(
capi.client.connect_signal(
"property::floating",
function(c)
if c.floating and not (c.maximized or c.fullscreen) then

View File

@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local capi = {
awesome = awesome,
mousegrabber = mousegrabber,
}
local rubato = require("src.lib.rubato")
-- Icon directory path
@@ -55,12 +60,12 @@ return function(s)
if key == 1 then
if node then
awful.spawn("./.config/awesome/src/scripts/vol.sh set_sink " .. node)
awesome.emit_signal("update::bg_sink", node)
capi.awesome.emit_signal("update::bg_sink", node)
end
end
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"update::bg_sink",
function(new_node)
if node == new_node then
@@ -97,7 +102,7 @@ return function(s)
end
end
)
awesome.emit_signal("update::bg_sink", node)
capi.awesome.emit_signal("update::bg_sink", node)
else
device:connect_signal(
"button::press",
@@ -105,12 +110,12 @@ return function(s)
if key == 1 then
if node then
awful.spawn("./.config/awesome/src/scripts/mic.sh set_source " .. node)
awesome.emit_signal("update::bg_source", node)
capi.awesome.emit_signal("update::bg_source", node)
end
end
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"update::bg_source",
function(new_node)
if node == new_node then
@@ -147,7 +152,7 @@ return function(s)
end
end
)
awesome.emit_signal("update::bg_source", node)
capi.awesome.emit_signal("update::bg_source", node)
end
return device
end
@@ -595,14 +600,15 @@ return function(s)
)
end
awesome.connect_signal(
capi.awesome.connect_signal(
"audio::device_changed",
function()
get_input_devices()
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"microphone::device_changed",
function()
get_source_devices()
@@ -610,7 +616,8 @@ return function(s)
)
-- Set the volume and icon
awesome.connect_signal(
capi.awesome.connect_signal(
"audio::get",
function(muted, volume)
if muted then
@@ -642,12 +649,12 @@ return function(s)
)
-- Get microphone volume
awesome.connect_signal(
capi.awesome.connect_signal(
"microphone::get",
function(muted, volume)
if muted then
--volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(0))
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir
.. "microphone-off.svg", Theme_config.volume_controller.microphone_fg))
else
volume = tonumber(volume)
@@ -670,10 +677,10 @@ return function(s)
volume_controller_container:connect_signal(
"mouse::leave",
function()
mousegrabber.run(
capi.mousegrabber.run(
function()
awesome.emit_signal("volume_controller::toggle", s)
mousegrabber.stop()
capi.awesome.emit_signal("volume_controller::toggle", s)
capi.mousegrabber.stop()
return true
end,
"arrow"
@@ -684,7 +691,7 @@ return function(s)
volume_controller_container:connect_signal(
"mouse::enter",
function()
mousegrabber.stop()
capi.mousegrabber.stop()
end
)
@@ -694,8 +701,8 @@ return function(s)
autostart = false,
stop_event = 'release',
keypressed_callback = function()
awesome.emit_signal("volume_controller::toggle", s)
mousegrabber.stop()
capi.awesome.emit_signal("volume_controller::toggle", s)
capi.mousegrabber.stop()
end
}
@@ -706,7 +713,7 @@ return function(s)
}
-- Toggle container visibility
awesome.connect_signal(
capi.awesome.connect_signal(
"volume_controller::toggle",
function(scr)
if scr == s then

View File

@@ -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/audio/"
@@ -70,7 +75,7 @@ return function(s)
widget = wibox.container.background
}
awesome.connect_signal(
capi.awesome.connect_signal(
"audio::get",
function(muted, volume)
if muted then
@@ -126,10 +131,10 @@ return function(s)
layout = wibox.layout.fixed.horizontal
}
awesome.connect_signal(
capi.awesome.connect_signal(
"widget::volume_osd:rerun",
function()
if mouse.screen == s then
if capi.mouse.screen == s then
volume_container.visible = true
if hide_volume_osd.started then
hide_volume_osd:again()

View File

@@ -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,
}
local window_elements = require("src.modules.window_switcher.window_elements")()
return function(s)
@@ -38,10 +43,10 @@ return function(s)
layout = wibox.layout.fixed.vertical
}
awesome.connect_signal(
capi.awesome.connect_signal(
"toggle_window_switcher",
function()
if mouse.screen == s then
if capi.mouse.screen == s then
window_switcher_container.visible = not window_switcher_container.visible
end
end

View File

@@ -11,6 +11,11 @@ local wibox = require("wibox")
local color = require("src.lib.color")
local rubato = require("src.lib.rubato")
local capi = {
awesome = awesome,
client = client,
}
return function()
local elements = wibox.widget {
@@ -26,11 +31,11 @@ return function()
elements:reset()
local clients = client.get()
local clients = capi.client.get()
local clients_sorted = {}
if client.focus then
clients_sorted[1] = client.focus
if capi.client.focus then
clients_sorted[1] = capi.client.focus
end
for _, client in ipairs(clients) do
@@ -213,35 +218,35 @@ return function()
elements = create_elements()
awesome.connect_signal(
capi.awesome.connect_signal(
"window_switcher::select_next",
function()
elements = create_elements("next")
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"window_switcher::raise",
function()
elements = create_elements("raise")
end
)
client.connect_signal(
capi.client.connect_signal(
"manage",
function()
elements = create_elements()
end
)
client.connect_signal(
capi.client.connect_signal(
"unmanage",
function()
elements = create_elements()
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"window_switcher::update",
function()
elements = create_elements()

View File

@@ -10,6 +10,10 @@ local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
local capi = {
screen = screen,
}
require("src.theme.user_config")
require("src.theme.theme_config")
@@ -54,7 +58,7 @@ Theme.awesome_subicon = Theme_path .. "../assets/icons/ArchLogo.png"
-- Wallpaper
beautiful.wallpaper = User_config.wallpaper
screen.connect_signal(
capi.screen.connect_signal(
'request::wallpaper',
function(s)
if beautiful.wallpaper then

View File

@@ -18,10 +18,7 @@ User_config = {
]] --
autostart = {
"picom --experimental-backends",
"xfce4-power-manager",
"light-locker --lock-on-suspend --lock-on-lid &",
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1",
"setxkbmap -option caps:swapescape",
"xfce4-power-manager"
},
--[[
@@ -76,7 +73,7 @@ User_config = {
--[[
Your filemanager. Will be opened with <super> + <e>
]] --
file_manager = "thunar",
file_manager = "nautilus",
--[[
The font that will be used on all widgets/modules etc.
@@ -89,10 +86,11 @@ User_config = {
extrabold = "JetBrainsMono Nerd Font, ExtraBold 14",
specify = "JetBrainsMono Nerd Font"
}
]] font = {
regular = "JetBrainsMono Nerd Font, 14",
bold = "JetBrainsMono Nerd Font, bold 14",
extrabold = "JetBrainsMono Nerd Font, ExtraBold 14",
]]
font = {
regular = "JetBrainsMono Nerd Font, " .. dpi(16),
bold = "JetBrainsMono Nerd Font, bold " .. dpi(16),
extrabold = "JetBrainsMono Nerd Font, ExtraBold " .. dpi(16),
specify = "JetBrainsMono Nerd Font"
},
@@ -191,7 +189,9 @@ User_config = {
"microphone",
"volume",
"gpu_temp",
"gpu_usage"
"gpu_usage",
"battery",
"backlight"
},
--[[
@@ -210,7 +210,8 @@ User_config = {
"Spotify"
}
]] --
titlebar_exception = {},
titlebar_exception = {
},
--[[
The titlebar position can be "left" (default) or "top"
@@ -232,10 +233,11 @@ User_config = {
weather_api_key = "your_api_key",
weather_city_id = "your_city_id",
unit = "metric" or "imperial"
]] weather_secrets = {
key = "e71b00168ca7219563dde4514a425b14",
city_id = "2864118",
unit = "metric"
]]
weather_secrets = {
key = "",
city_id = "",
unit = ""
},
--[[
@@ -274,10 +276,9 @@ User_config = {
"Tasklist"
},
right_bar = {
"Gpu Usage",
"Gpu Temperature",
"Cpu Usage",
"Cpu Temperature",
"Battery",
"Network",
"Bluetooth",
"Audio",
"Keyboard Layout",
"Date",

View File

@@ -2,7 +2,10 @@ local awful = require("awful")
local gears = require("gears")
local dbus_proxy = require("dbus_proxy")
local lgi = require("lgi")
local naughty = require("naughty")
local capi = {
awesome = awesome,
}
return function()
@@ -28,12 +31,13 @@ return function()
interface = "org.freedesktop.DBus.Properties",
path = object_path
}
awesome.emit_signal("bluetooth::scan")
if device.Name ~= nil or device.Alias ~= nil then
capi.awesome.emit_signal("bluetooth::scan")
if (device.Name ~= nil) or (device.Alias ~= nil) then
device_properties:connect_signal(function()
awesome.emit_signal("bluetooth::device_changed", device, battery)
capi.awesome.emit_signal("bluetooth::device_changed", device, battery)
end, "PropertiesChanged")
awesome.emit_signal("bluetooth::device_changed", device, battery)
capi.awesome.emit_signal("bluetooth::device_changed", device, battery)
end
end
end
@@ -73,7 +77,7 @@ return function()
ObjectManager:connect_signal(
function(interface)
awesome.emit_signal("device_removed", interface)
capi.awesome.emit_signal("device_removed", interface)
end,
"InterfacesRemoved"
)
@@ -81,13 +85,13 @@ return function()
Adapter:connect_signal(
function(data)
if data.Powered ~= nil then
awesome.emit_signal("state", data.Powered)
capi.awesome.emit_signal("state", data.Powered)
end
end,
"PropertiesChanged"
)
awesome.connect_signal(
capi.awesome.connect_signal(
"bluetooth::scan",
function()
Adapter:StartDiscovery()
@@ -105,7 +109,7 @@ return function()
"PropertiesChanged"
)
awesome.connect_signal("toggle_bluetooth",
capi.awesome.connect_signal("toggle_bluetooth",
function()
local is_powered = Adapter.Powered
Adapter:Set(
@@ -114,7 +118,7 @@ return function()
lgi.GLib.Variant("b", not is_powered)
)
Adapter.Powered = { signature = "b", value = not is_powered }
awesome.emit_signal("state", Adapter.Powered)
capi.awesome.emit_signal("state", Adapter.Powered)
end)
gears.timer.delayed_call(
@@ -125,7 +129,7 @@ return function()
get_device_info(object_path)
end
awesome.emit_signal("state", Adapter.Powered)
capi.awesome.emit_signal("state", Adapter.Powered)
end
)
end

View File

@@ -15,8 +15,9 @@ Gtk.IconTheme.set_custom_theme(gtk_theme, User_config.icon_theme)
---Gets the icon path from an AppInfo gicon.
---@param app Gio.AppInfo
---@return string path
---@return string|nil path
function Get_gicon_path(app)
if not app then return end
local icon_info = gtk_theme:lookup_by_gicon(app, 64, 0)
if icon_info then
local path = icon_info:get_filename()

View File

@@ -1,5 +1,9 @@
local awful = require("awful")
local capi = {
awesome = awesome,
}
--[[ local lgi = require("lgi")
local pulseaudio = require("lua_libpulse_glib")
local ppretty = require("pl.ppretty")
@@ -24,13 +28,13 @@ awful.spawn.with_line_callback(
stdout = function(line)
-- Volume changed
if line:match("on sink") or line:match("on source") then
awesome.emit_signal("audio::volume_changed")
awesome.emit_signal("microphone::volume_changed")
capi.awesome.emit_signal("audio::volume_changed")
capi.awesome.emit_signal("microphone::volume_changed")
end
-- Device added/removed
if line:match("on server") then
awesome.emit_signal("audio::device_changed")
awesome.emit_signal("microphone::device_changed")
capi.awesome.emit_signal("audio::device_changed")
capi.awesome.emit_signal("microphone::device_changed")
end
end,
output_done = function()
@@ -40,14 +44,14 @@ awful.spawn.with_line_callback(
}
)
awesome.connect_signal(
capi.awesome.connect_signal(
"exit",
function()
awful.spawn.with_shell("pkill pactl && pkill grep")
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"audio::volume_changed",
function()
awful.spawn.easy_async_with_shell(
@@ -66,7 +70,7 @@ awesome.connect_signal(
if stdout == "" or stdout == nil then
return
end
awesome.emit_signal("audio::get", muted, stdout2:gsub("%%", ""):gsub("\n", "") or 0)
capi.awesome.emit_signal("audio::get", muted, stdout2:gsub("%%", ""):gsub("\n", "") or 0)
end
)
end
@@ -74,7 +78,7 @@ awesome.connect_signal(
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"microphone::volume_changed",
function()
awful.spawn.easy_async_with_shell(
@@ -90,7 +94,7 @@ awesome.connect_signal(
if stdout2 == nil or stdout2 == "awful" then
return
end
awesome.emit_signal("microphone::get", muted, stdout2:gsub("%%", ""):gsub("\n", "") or 0)
capi.awesome.emit_signal("microphone::get", muted, stdout2:gsub("%%", ""):gsub("\n", "") or 0)
end
)
end
@@ -98,7 +102,7 @@ awesome.connect_signal(
end
)
awesome.emit_signal("audio::volume_changed")
awesome.emit_signal("microphone::volume_changed")
awesome.emit_signal("audio::device_changed")
awesome.emit_signal("microphone::device_changed")
capi.awesome.emit_signal("audio::volume_changed")
capi.awesome.emit_signal("microphone::volume_changed")
capi.awesome.emit_signal("audio::device_changed")
capi.awesome.emit_signal("microphone::device_changed")

View File

@@ -1,25 +1,32 @@
local awful = require("awful")
local capi = {
awesome = awesome,
}
BACKLIGHT_MAX_BRIGHTNESS = 0
BACKLIGHT_SEPS = 0
awful.spawn.easy_async_with_shell(
"pkexec xfpm-power-backlight-helper --get-max-brightness",
function(stdout)
BACKLIGHT_MAX_BRIGHTNESS = tonumber(stdout)
BACKLIGHT_SEPS = BACKLIGHT_MAX_BRIGHTNESS / 100
BACKLIGHT_SEPS = BACKLIGHT_MAX_BRIGHTNESS / 100 * 2
BACKLIGHT_SEPS = math.floor(BACKLIGHT_SEPS)
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"brightness::update",
function()
awful.spawn.easy_async_with_shell(
"pkexec xfpm-power-backlight-helper --get-brightness",
function(value)
awesome.emit_signal("brightness::get", math.floor((tonumber(value) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100))
awesome.emit_signal("brightness::rerun")
capi.awesome.emit_signal("brightness::get",
math.floor((tonumber(value) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100))
capi.awesome.emit_signal("brightness::rerun")
end
)
end
)
capi.awesome.emit_signal("brightness::update")

View File

@@ -1,6 +1,10 @@
local awful = require("awful")
local watch = awful.widget.watch
local capi = {
awesome = awesome,
}
watch(
[[ bash -c "cat /proc/cpuinfo | grep "MHz" | awk '{print int($4)}'" ]],
3,
@@ -18,9 +22,9 @@ watch(
average = average + cpu_freq[i]
end
average = math.floor(average / #cpu_freq)
awesome.emit_signal("update::cpu_freq_average", average)
capi.awesome.emit_signal("update::cpu_freq_average", average)
elseif User_config.clock_mode then
awesome.emit_signal("update::cpu_freq_core", cpu_freq[User_config.clock_mode])
capi.awesome.emit_signal("update::cpu_freq_core", cpu_freq[User_config.clock_mode])
end
end
)

View File

@@ -1,6 +1,10 @@
local awful = require("awful")
local watch = awful.widget.watch
local capi = {
awesome = awesome,
}
watch(
[[ bash -c "sensors | grep 'Package id 0:' | awk '{print $4}'" ]],
3,
@@ -11,14 +15,14 @@ watch(
"paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp)",
function(stdout2)
temp = math.floor((tonumber(stdout2:match("x86_pkg_temp(.%d+)")) / 1000) + 0.5)
awesome.emit_signal(
capi.awesome.emit_signal(
"update::cpu_temp",
temp
)
end
)
else
awesome.emit_signal(
capi.awesome.emit_signal(
"update::cpu_temp",
temp
)

View File

@@ -1,6 +1,10 @@
local awful = require("awful")
local watch = awful.widget.watch
local capi = {
awesome = awesome,
}
local total_prev = 0
local idle_prev = 0
@@ -18,7 +22,7 @@ watch(
local diff_total = total - total_prev
local diff_usage = math.floor(((1000 * (diff_total - diff_idle) / diff_total + 5) / 10) + 0.5)
awesome.emit_signal("update::cpu_usage", diff_usage)
capi.awesome.emit_signal("update::cpu_usage", diff_usage)
total_prev = total
idle_prev = idle

View File

@@ -1,10 +1,14 @@
local awful = require("awful")
local watch = awful.widget.watch
local capi = {
awesome = awesome,
}
watch(
[[ bash -c "nvidia-smi -q -d TEMPERATURE | grep 'GPU Current Temp' | awk '{print $5}'"]],
3,
function(_, stdout)
awesome.emit_signal("update::gpu_temp", stdout:match("%d+"):gsub("\n", ""))
capi.awesome.emit_signal("update::gpu_temp", stdout:match("%d+"):gsub("\n", ""))
end
)

View File

@@ -1,11 +1,15 @@
local awful = require("awful")
local watch = awful.widget.watch
local capi = {
awesome = awesome,
}
watch(
[[ bash -c "nvidia-smi -q -d UTILIZATION | grep Gpu | awk '{print $3}'"]],
3,
function(_, stdout)
stdout = stdout:match("%d+")
awesome.emit_signal("update::gpu_usage", stdout)
capi.awesome.emit_signal("update::gpu_usage", stdout)
end
)

View File

@@ -9,7 +9,6 @@ local awful = require("awful")
local gobject = require("gears.object")
local gtable = require("gears.table")
local gtimer = require("gears.timer")
local helpers = require("helpers")
local dbus_proxy = require("services.dbus_proxy")
local network = {}

View File

@@ -5,6 +5,10 @@ local gtable = require("gears.table")
local gtimer = require("gears.timer")
local gstring = require("gears.string")
local capi = {
awesome = awesome
}
local playerctl = { mt = {} }
playerctl._private = {}
@@ -76,7 +80,7 @@ local function emit_metadata_callback(self, title, artist, art_url, album, new,
if not art_url or art_url == "" then
else
awesome.emit_signal("playerctl::title_artist_album", title, artist, "", player_name)
capi.awesome.emit_signal("playerctl::title_artist_album", title, artist, "", player_name)
self:emit_signal("metadata", title, artist, "", album, new, player_name)
end
end
@@ -145,10 +149,10 @@ local function playback_status_callback(self, player, status)
if status == "PLAYING" then
self:emit_signal("playerctl::playback_status", true, player.player_name)
awesome.emit_signal("playerctl::playback_status", true, player.player_name)
capi.awesome.emit_signal("playerctl::playback_status", true, player.player_name)
else
self:emit_signal("playerctl::playback_status", false, player.player_name)
awesome.emit_signal("playerctl::playback_status", false, player.player_name)
capi.awesome.emit_signal("playerctl::playback_status", false, player.player_name)
end
end
end
@@ -308,7 +312,7 @@ local function start_manager(self)
_self._private.metadata_timer:stop()
_self._private.pos_timer:stop()
_self:emit_signal("playerctl::noplayers")
awesome.emit_signal("playerctl::noplayers")
capi.awesome.emit_signal("playerctl::noplayers")
elseif player == _self._private.active_player then
_self._private.active_player = self.players[1]
get_current_player(_self, _self._private.active_player)

View File

@@ -1,11 +1,15 @@
local awful = require("awful")
local watch = awful.widget.watch
local capi = {
awesome = awesome,
}
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")
awesome.emit_signal("update::ram_widget", MemTotal, MemFree, MemAvailable)
capi.awesome.emit_signal("update::ram_widget", MemTotal, MemFree, MemAvailable)
end
)

View File

@@ -7,6 +7,10 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local capi = {
awesome = awesome,
}
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/"
@@ -55,7 +59,7 @@ return function(s)
widget = wibox.container.background
}
awesome.connect_signal(
capi.awesome.connect_signal(
"audio::get",
function(muted, volume)
if muted then
@@ -95,8 +99,8 @@ return function(s)
audio_widget:connect_signal(
"button::press",
function()
awesome.emit_signal("volume_controller::toggle", s)
awesome.emit_signal("volume_controller::toggle:keygrabber")
capi.awesome.emit_signal("volume_controller::toggle", s)
capi.awesome.emit_signal("volume_controller::toggle:keygrabber")
end
)

View File

@@ -11,7 +11,9 @@ local naughty = require("naughty")
local upower_glib = lgi.require("UPowerGlib")
local wibox = require("wibox")
require("src.core.signals")
local capi = {
awesome = awesome,
}
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/battery/"
@@ -195,7 +197,7 @@ return function(battery_kind)
battery_widget:get_children_by_id("icon")[1].image = gears.surface.load_uncached(gears.color.recolor_image(icondir ..
icon .. '.svg', Theme_config.battery.fg))
awesome.emit_signal("update::battery_widget", battery_percentage, icondir .. icon .. ".svg")
capi.awesome.emit_signal("update::battery_widget", battery_percentage, icondir .. icon .. ".svg")
end

View File

@@ -8,6 +8,10 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local capi = {
awesome = awesome,
}
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/bluetooth/"
@@ -42,7 +46,7 @@ return function(s)
-- Hover signal to change color when mouse is over
Hover_signal(bluetooth_widget)
awesome.connect_signal("state", function(state)
capi.awesome.connect_signal("state", function(state)
if state then
bluetooth_widget:get_children_by_id("icon")[1]:set_image(gears.color.recolor_image(icondir .. "bluetooth-on.svg",
Theme_config.bluetooth.fg))
@@ -56,9 +60,9 @@ return function(s)
"button::press",
function(_, _, _, key)
if key == 1 then
awesome.emit_signal("bluetooth_controller::toggle", s)
capi.awesome.emit_signal("bluetooth_controller::toggle", s)
else
awesome.emit_signal("toggle_bluetooth")
capi.awesome.emit_signal("toggle_bluetooth")
end
end
)

View File

@@ -11,6 +11,10 @@ local wibox = require("wibox")
local color = require("src.lib.color")
local rubato = require("src.lib.rubato")
local capi = {
awesome = awesome,
}
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
--TODO: Add tooltip with more CPU and per core information
@@ -145,7 +149,7 @@ return function(widget, _)
widget = wibox.container.background
}
awesome.connect_signal(
capi.awesome.connect_signal(
"update::cpu_usage",
function(usage)
cpu_usage_widget.container.cpu_layout.label.text = usage .. "%"
@@ -172,7 +176,7 @@ return function(widget, _)
r_timed_cpu_bg.target, g_timed_cpu_bg.target, b_timed_cpu_bg.target = color.utils.hex_to_rgba(newbg)
end
awesome.connect_signal(
capi.awesome.connect_signal(
"update::cpu_temp",
function(temp)
local temp_icon
@@ -191,18 +195,18 @@ return function(widget, _)
cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
set_bg(temp_color)
cpu_temp.container.cpu_layout.label.text = math.floor(temp) .. "°C"
awesome.emit_signal("update::cpu_temp_widget", temp, temp_icon)
capi.awesome.emit_signal("update::cpu_temp_widget", temp, temp_icon)
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"update::cpu_freq_average",
function(average)
cpu_clock.container.cpu_layout.label.text = average .. "Mhz"
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"update::cpu_freq_core",
function(freq)
cpu_clock.container.cpu_layout.label.text = freq .. "Mhz"

View File

@@ -9,6 +9,10 @@ local gears = require("gears")
local wibox = require("wibox")
require("src.core.signals")
local capi = {
awesome = awesome,
}
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/date/"
@@ -65,7 +69,7 @@ return function()
date_widget:buttons {
gears.table.join(
awful.button({}, 1, function()
awesome.emit_signal("calendar::toggle", date_widget)
capi.awesome.emit_signal("calendar::toggle", date_widget)
end)
)
}

View File

@@ -11,6 +11,10 @@ local wibox = require("wibox")
local color = require("src.lib.color")
local rubato = require("src.lib.rubato")
local capi = {
awesome = awesome,
}
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
return function(widget)
@@ -104,7 +108,7 @@ return function(widget)
Hover_signal(gpu_usage_widget)
-- GPU Utilization
awesome.connect_signal(
capi.awesome.connect_signal(
"update::gpu_usage",
function(stdout)
gpu_usage_widget.container.gpu_layout.label.text = stdout:gsub("\n", "") .. "%"
@@ -134,7 +138,7 @@ return function(widget)
end
-- GPU Temperature
awesome.connect_signal(
capi.awesome.connect_signal(
"update::gpu_temp",
function(stdout)

View File

@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local capi = {
awesome = awesome,
mousegrabber = mousegrabber,
}
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/kblayout/"
@@ -61,7 +66,7 @@ return function(s)
function(stdout)
local layout = stdout:gsub("\n", "")
kblayout_widget.container.kblayout_layout.label.text = layout
awesome.emit_signal("update::background:kblayout")
capi.awesome.emit_signal("update::background:kblayout")
end
)
end
@@ -216,7 +221,7 @@ return function(s)
Hover_signal(kb_layout_item)
awesome.connect_signal(
capi.awesome.connect_signal(
"update::background:kblayout",
function()
awful.spawn.easy_async_with_shell(
@@ -244,8 +249,8 @@ return function(s)
awful.spawn.easy_async_with_shell(
"setxkbmap " .. keymap,
function()
awesome.emit_signal("kblayout::hide:kbmenu")
mousegrabber.stop()
capi.awesome.emit_signal("kblayout::hide:kbmenu")
capi.mousegrabber.stop()
get_kblayout()
end
)
@@ -294,11 +299,11 @@ return function(s)
kb_menu_widget:connect_signal(
"mouse::leave",
function()
mousegrabber.run(
capi.mousegrabber.run(
function()
kblayout_widget.bg = Theme_config.kblayout.bg
awesome.emit_signal("kblayout::hide:kbmenu")
mousegrabber.stop()
capi.awesome.emit_signal("kblayout::hide:kbmenu")
capi.mousegrabber.stop()
return true
end,
"arrow"
@@ -344,7 +349,7 @@ return function(s)
)
end
awesome.connect_signal(
capi.awesome.connect_signal(
"kblayout::toggle",
function()
toggle_kb_layout()
@@ -358,15 +363,15 @@ return function(s)
autostart = false,
stop_event = 'release',
keypressed_callback = function(self, mod, key, command)
awesome.emit_signal("kblayout::hide:kbmenu")
mousegrabber.stop()
capi.awesome.emit_signal("kblayout::hide:kbmenu")
capi.mousegrabber.stop()
end
}
kblayout_widget:connect_signal(
"button::press",
function()
mousegrabber.stop()
capi.mousegrabber.stop()
if kb_menu_widget.visible then
kb_menu_widget.visible = false
kblayout_keygrabber:stop()
@@ -377,7 +382,7 @@ return function(s)
end
)
awesome.connect_signal(
capi.awesome.connect_signal(
"kblayout::hide:kbmenu",
function()
kb_menu_widget.visible = false

View File

@@ -9,6 +9,10 @@ local gears = require("gears")
local naughty = require("naughty")
local wibox = require("wibox")
local capi = {
awesome = awesome,
}
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/network/"
@@ -159,7 +163,7 @@ return function()
local icon = "wifi-strength"
if not stdout:match("Connected but no internet") then
if startup or reconnect_startup then
awesome.emit_signal("system::network_connected")
capi.awesome.emit_signal("system::network_connected")
end
icon = icon .. '-' .. tostring(strength)
update_wireless_data(true)
@@ -219,7 +223,7 @@ return function()
else
update_tooltip("You are connected to:\nEthernet Interface <b>" .. interfaces.lan_interface .. "</b>")
if startup or reconnect_startup then
awesome.emit_signal("system::network_connected")
capi.awesome.emit_signal("system::network_connected")
notify_connected()
update_startup()
end

View File

@@ -8,6 +8,10 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local capi = {
awesome = awesome,
}
-- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/power/"
@@ -55,7 +59,7 @@ return function()
power_widget:connect_signal(
"button::release",
function()
awesome.emit_signal("module::powermenu:show")
capi.awesome.emit_signal("module::powermenu:show")
end
)

View File

@@ -9,6 +9,10 @@ local gears = require("gears")
local watch = awful.widget.watch
local wibox = require("wibox")
local capi = {
awesome = awesome,
}
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
return function()
@@ -57,7 +61,7 @@ return function()
Hover_signal(ram_widget)
awesome.connect_signal(
capi.awesome.connect_signal(
"update::ram_widget",
function(MemTotal, MemFree, MemAvailable)
local ram_string = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) ..

View File

@@ -7,6 +7,10 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local capi = {
awesome = awesome,
}
Theme.bg_systray = Theme_config.systray.bg
Theme.systray_icon_spacing = dpi(10)
@@ -29,8 +33,8 @@ return function(s)
bg = Theme_config.systray.bg
}
awesome.connect_signal("systray::update", function()
local num_entries = awesome.systray()
capi.awesome.connect_signal("systray::update", function()
local num_entries = capi.awesome.systray()
if num_entries == 0 then
systray.container.st:set_margins(0)

View File

@@ -8,8 +8,11 @@ local awful = require("awful")
local gears = require("gears")
local dpi = require("beautiful").xresources.apply_dpi
local color = require("src.lib.color")
local rubato = require("src.lib.rubato")
local capi = {
client = client,
}
local modkey = User_config.modkey
local list_update = function(widget, buttons, _, _, objects)
widget:reset()
@@ -142,8 +145,8 @@ return function(s)
{ modkey },
1,
function(t)
if client.focus then
client.focus:move_to_tag(t)
if capi.client.focus then
capi.client.focus:move_to_tag(t)
end
end
),
@@ -151,8 +154,8 @@ return function(s)
{},
3,
function(t)
if client.focus then
client.focus:toggle_tag(t)
if capi.client.focus then
capi.client.focus:toggle_tag(t)
end
end
),
@@ -160,8 +163,8 @@ return function(s)
{ modkey },
3,
function(t)
if client.focus then
client.focus:toggle_tag(t)
if capi.client.focus then
capi.client.focus:toggle_tag(t)
end
end
),

View File

@@ -8,8 +8,9 @@ local wibox = require('wibox')
local dpi = require('beautiful').xresources.apply_dpi
local gears = require('gears')
local color = require("src.lib.color")
local rubato = require("src.lib.rubato")
local capi = {
client = client,
}
local list_update = function(widget, buttons, label, _, objects)
widget:reset()
@@ -94,7 +95,7 @@ local list_update = function(widget, buttons, label, _, objects)
local text, _ = label(object, task_widget.container.layout_it.title)
if object == client.focus then
if object == capi.client.focus then
if text == nil or text == '' then
task_widget.container.layout_it.title:set_margins(0)
else
@@ -136,7 +137,7 @@ return function(s)
{},
1,
function(c)
if c == client.focus then
if c == capi.client.focus then
c.minimized = true
else
c.minimized = false