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

View File

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

View File

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

View File

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

View File

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

View File

@@ -6,24 +6,32 @@ local gears = require("gears")
local color = require("src.lib.color") local color = require("src.lib.color")
local rubato = require("src.lib.rubato") 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", "added",
function() function()
awesome.restart() capi.awesome.restart()
end end
) )
screen.connect_signal( capi.screen.connect_signal(
"removed", "removed",
function() function()
awesome.restart() capi.awesome.restart()
end end
) )
client.connect_signal( capi.client.connect_signal(
"manage", "manage",
function(c) 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) awful.placement.no_offscreen(c)
end end
c.shape = function(cr, width, height) c.shape = function(cr, width, height)
@@ -42,7 +50,7 @@ client.connect_signal(
end end
) )
client.connect_signal( capi.client.connect_signal(
'unmanage', 'unmanage',
function(c) function(c)
if #awful.screen.focused().clients > 0 then if #awful.screen.focused().clients > 0 then
@@ -57,7 +65,7 @@ client.connect_signal(
end end
) )
tag.connect_signal( capi.tag.connect_signal(
'property::selected', 'property::selected',
function(c) function(c)
if #awful.screen.focused().clients > 0 then 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 if icon and widget.icon and icon_override and icon_override_hover then
widget.icon.image = gears.color.recolor_image(icon, icon_override_hover) widget.icon.image = gears.color.recolor_image(icon, icon_override_hover)
end end
local w = mouse.current_wibox local w = capi.mouse.current_wibox
if w then if w then
old_cursor, old_wibox = w.cursor, w old_cursor, old_wibox = w.cursor, w
w.cursor = "hand1" w.cursor = "hand1"

View File

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

View File

@@ -6,13 +6,15 @@
local awful = require("awful") local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears") local gears = require("gears")
local gfs = gears.filesystem
local gtable = gears.table
local gdebug = gears.debug
local gstring = gears.string local gstring = gears.string
local keygrabber = require("awful.keygrabber") local keygrabber = require("awful.keygrabber")
local wibox = require("wibox") local wibox = require("wibox")
local capi = {
awesome = awesome,
mouse = mouse,
}
local icondir = awful.util.getdir("config") .. "src/assets/icons/application_launcher/searchbar/" local icondir = awful.util.getdir("config") .. "src/assets/icons/application_launcher/searchbar/"
local kgrabber local kgrabber
@@ -71,7 +73,7 @@ return function()
local old_wibox, old_cursor local old_wibox, old_cursor
local mouse_enter = function() local mouse_enter = function()
local w = mouse.current_wibox local w = capi.mouse.current_wibox
if w then if w then
old_cursor, old_wibox = w.cursor, w old_cursor, old_wibox = w.cursor, w
w.cursor = "xterm" w.cursor = "xterm"
@@ -135,16 +137,16 @@ return function()
local function update() local function update()
search_text:set_markup(promt_text_with_cursor(text_string, cur_pos)) search_text:set_markup(promt_text_with_cursor(text_string, cur_pos))
--Send the string over to the application to filter applications --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 end
update() update()
kgrabber = keygrabber.run( kgrabber = keygrabber.run(
function(modifiers, key, event) function(modifiers, key, event)
awesome.connect_signal("searchbar::stop", function() capi.awesome.connect_signal("searchbar::stop", function()
keygrabber.stop(kgrabber) keygrabber.stop(kgrabber)
awesome.emit_signal("application_launcher::kgrabber_start") capi.awesome.emit_signal("application_launcher::kgrabber_start")
end) end)
local mod = {} local mod = {}
@@ -162,7 +164,7 @@ return function()
keygrabber.stop(kgrabber) keygrabber.stop(kgrabber)
search_text:set_markup(promt_text_with_cursor("", 1)) search_text:set_markup(promt_text_with_cursor("", 1))
text_string = "" text_string = ""
awesome.emit_signal("application_launcher::show") capi.awesome.emit_signal("application_launcher::show")
elseif (not mod.Control and key == "Return") or elseif (not mod.Control and key == "Return") or
(not mod.Control and key == "KP_Enter") then (not mod.Control and key == "KP_Enter") then
keygrabber.stop(kgrabber) keygrabber.stop(kgrabber)
@@ -170,8 +172,8 @@ return function()
searchbar.s_background.fg = Theme_config.application_launcher.searchbar.fg_hint searchbar.s_background.fg = Theme_config.application_launcher.searchbar.fg_hint
search_text:set_markup(promt_text_with_cursor("", 1)) search_text:set_markup(promt_text_with_cursor("", 1))
text_string = "" text_string = ""
awesome.emit_signal("application_launcher::execute") capi.awesome.emit_signal("application_launcher::execute")
awesome.emit_signal("application_launcher::show") capi.awesome.emit_signal("application_launcher::show")
end end
if mod.Control then if mod.Control then
@@ -195,15 +197,15 @@ return function()
-- Move cursor to the left -- Move cursor to the left
elseif key == "Left" then elseif key == "Left" then
--cur_pos = cur_pos - 1 --cur_pos = cur_pos - 1
awesome.emit_signal("application::left") capi.awesome.emit_signal("application::left")
-- Move cursor to the right -- Move cursor to the right
elseif key == "Right" then elseif key == "Right" then
--cur_pos = cur_pos + 1 --cur_pos = cur_pos + 1
awesome.emit_signal("application::right") capi.awesome.emit_signal("application::right")
elseif key == "Up" then elseif key == "Up" then
awesome.emit_signal("application::up") capi.awesome.emit_signal("application::up")
elseif key == "Down" then elseif key == "Down" then
awesome.emit_signal("application::down") capi.awesome.emit_signal("application::down")
else else
--Add key at cursor position --Add key at cursor position
if key:wlen() == 1 then if key:wlen() == 1 then
@@ -234,7 +236,7 @@ return function()
end) end)
)) ))
awesome.connect_signal( capi.awesome.connect_signal(
"searchbar::start", "searchbar::start",
function() function()
if not awful.keygrabber.is_running then 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 gears = require("gears")
local wibox = require("wibox") local wibox = require("wibox")
local capi = {
awesome = awesome,
mouse = mouse,
}
-- Icon directory path -- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/brightness/" local icondir = awful.util.getdir("config") .. "src/assets/icons/brightness/"
@@ -69,9 +74,10 @@ return function(s)
widget = wibox.container.background widget = wibox.container.background
} }
awesome.connect_signal( capi.awesome.connect_signal(
"brightness::get", "brightness::get",
function(brightness) function(brightness)
print(brightness)
brightness_osd_widget:get_children_by_id("progressbar1")[1].value = brightness brightness_osd_widget:get_children_by_id("progressbar1")[1].value = brightness
local icon = icondir .. "brightness" local icon = icondir .. "brightness"
@@ -112,10 +118,10 @@ return function(s)
layout = wibox.layout.fixed.horizontal layout = wibox.layout.fixed.horizontal
} }
awesome.connect_signal( capi.awesome.connect_signal(
"brightness::rerun", "brightness::rerun",
function() function()
if mouse.screen == s then if capi.mouse.screen == s then
brightness_container.visible = true brightness_container.visible = true
if hide_brightness_osd.started then if hide_brightness_osd.started then
hide_brightness_osd:again() hide_brightness_osd:again()

View File

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

View File

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

View File

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

View File

@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears") local gears = require("gears")
local wibox = require("wibox") local wibox = require("wibox")
local capi = {
awesome = awesome,
mouse = mouse,
}
return function(args) return function(args)
if not args then if not args then
return return
@@ -65,7 +70,7 @@ return function(args)
modifiers = {}, modifiers = {},
button = 1, button = 1,
on_release = function() on_release = function()
awesome.emit_signal("context_menu::hide") capi.awesome.emit_signal("context_menu::hide")
entry.callback() entry.callback()
end end
}) })
@@ -91,18 +96,18 @@ return function(args)
border_width = Theme_config.context_menu.border_width, border_width = Theme_config.context_menu.border_width,
border_color = Theme_config.context_menu.border_color, border_color = Theme_config.context_menu.border_color,
shape = Theme_config.context_menu.shape, shape = Theme_config.context_menu.shape,
x = mouse.coords().x, x = capi.mouse.coords().x,
y = mouse.coords().y, y = capi.mouse.coords().y,
visible = false, visible = false,
ontop = true, ontop = true,
placement = awful.placement.no_offscreen, placement = awful.placement.no_offscreen,
} }
menu:connect_signal("mouse::leave", function() menu:connect_signal("mouse::leave", function()
awesome.emit_signal("context_menu::hide") capi.awesome.emit_signal("context_menu::hide")
end) end)
awesome.connect_signal( capi.awesome.connect_signal(
"context_menu::hide", "context_menu::hide",
function() function()
menu.visible = false menu.visible = false

View File

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

View File

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

View File

@@ -20,7 +20,7 @@ awful.screen.connect_for_each_screen(
require("src.modules.powermenu")(s) require("src.modules.powermenu")(s)
require("src.modules.volume_osd")(s) require("src.modules.volume_osd")(s)
require("src.modules.brightness_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.titlebar")
require("src.modules.volume_controller")(s) require("src.modules.volume_controller")(s)
require("src.modules.crylia_bar.init")(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 rubato = require("src.lib.rubato")
local capi = {
awesome = awesome,
}
-- Icon directory path -- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/" local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
@@ -36,7 +40,7 @@ return function(s)
layout = wibox.layout.fixed.horizontal layout = wibox.layout.fixed.horizontal
}) })
awesome.connect_signal( capi.awesome.connect_signal(
"notification_center_activation::toggle", "notification_center_activation::toggle",
function(screen, hide) function(screen, hide)
if screen == s then if screen == s then
@@ -121,7 +125,7 @@ return function(s)
fit = function(_, width, height) fit = function(_, width, height)
return width, height return width, height
end, end,
draw = toggle_animation(0, Theme_config.notification_center.dnd.disabled), draw = toggle_animation(0),
}, },
id = "background", id = "background",
}, },
@@ -326,7 +330,7 @@ return function(s)
) )
-- Update the notification center popup and check if there are no notifications -- Update the notification center popup and check if there are no notifications
awesome.connect_signal( capi.awesome.connect_signal(
"notification_center:update::needed", "notification_center:update::needed",
function() function()
if #nl == 0 then if #nl == 0 then
@@ -352,11 +356,11 @@ return function(s)
notification_center.visible = false notification_center.visible = false
end 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) notification_center:disconnect_signal("mouse::leave", mouse_leave)
end) 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) notification_center:connect_signal("mouse::leave", mouse_leave)
end) end)
@@ -374,7 +378,7 @@ return function(s)
for i = 0, size do for i = 0, size do
nl[i] = nil nl[i] = nil
end end
awesome.emit_signal("notification_center:update::needed") capi.awesome.emit_signal("notification_center:update::needed")
end end
) )

View File

@@ -9,6 +9,10 @@ local gears = require("gears")
local wibox = require("wibox") local wibox = require("wibox")
local naughty = require("naughty") local naughty = require("naughty")
local capi = {
awesome = awesome,
}
-- Icon directory path -- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/" 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 for i, b in pairs(nl.notification_list) do
if b.pk == notification.pk then if b.pk == notification.pk then
table.remove(nl.notification_list, math.tointeger(i)) table.remove(nl.notification_list, math.tointeger(i))
awesome.emit_signal("notification_center:update::needed") capi.awesome.emit_signal("notification_center:update::needed")
break break
end end
end end
@@ -257,7 +261,7 @@ naughty.connect_signal(
"request::display", "request::display",
function(n) function(n)
nl.create_notification(n) nl.create_notification(n)
awesome.emit_signal("notification_center:update::needed") capi.awesome.emit_signal("notification_center:update::needed")
end end
) )

View File

@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears") local gears = require("gears")
local wibox = require("wibox") local wibox = require("wibox")
local capi = {
awesome = awesome,
mouse = mouse,
}
-- Icon directory path -- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/" 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 function button_hover_effect(widget, svg, color, color2)
local mouse_enter = function() local mouse_enter = function()
widget.image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. svg, color2)) 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 if w then
w.cursor = "hand1" w.cursor = "hand1"
end end
@@ -26,8 +31,8 @@ return function(s)
local mouse_leave = function() local mouse_leave = function()
widget.image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. svg, color)) widget.image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. svg, color))
mouse.cursor = "left_ptr" capi.mouse.cursor = "left_ptr"
local w = mouse.current_wibox local w = capi.mouse.current_wibox
if w then if w then
w.cursor = "left_ptr" w.cursor = "left_ptr"
end end
@@ -488,7 +493,7 @@ return function(s)
} }
-- get_spotify_metadata() on awesome reload -- get_spotify_metadata() on awesome reload
awesome.connect_signal("startup", function() capi.awesome.connect_signal("startup", function()
get_spotify_metadata(true) get_spotify_metadata(true)
end) end)

View File

@@ -10,6 +10,10 @@ local wibox = require("wibox")
local rubato = require("src.lib.rubato") local rubato = require("src.lib.rubato")
local capi = {
awesome = awesome,
}
-- Icon directory path -- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/" local icondir = awful.util.getdir("config") .. "src/assets/icons/"
@@ -91,14 +95,14 @@ return function()
} }
w:connect_signal("mouse::enter", 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) end)
w:connect_signal("mouse::leave", function() w:connect_signal("mouse::leave", function()
awesome.emit_signal("notification_center::unblock_mouse_events") capi.awesome.emit_signal("notification_center::unblock_mouse_events")
end) end)
awesome.connect_signal( capi.awesome.connect_signal(
"update::cpu_usage", "update::cpu_usage",
function(cpu_usage) function(cpu_usage)
tooltip.text = "CPU Usage: " .. cpu_usage .. "%" tooltip.text = "CPU Usage: " .. cpu_usage .. "%"
@@ -169,13 +173,13 @@ return function()
margins = dpi(10) margins = dpi(10)
} }
w:connect_signal("mouse::enter", 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) end)
w:connect_signal("mouse::leave", function() w:connect_signal("mouse::leave", function()
awesome.emit_signal("notification_center::unblock_mouse_events") capi.awesome.emit_signal("notification_center::unblock_mouse_events")
end) end)
awesome.connect_signal( capi.awesome.connect_signal(
"update::cpu_temp", "update::cpu_temp",
function(cpu_temp) function(cpu_temp)
local temp_icon local temp_icon
@@ -254,13 +258,13 @@ return function()
margins = dpi(10) margins = dpi(10)
} }
w:connect_signal("mouse::enter", 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) end)
w:connect_signal("mouse::leave", function() w:connect_signal("mouse::leave", function()
awesome.emit_signal("notification_center::unblock_mouse_events") capi.awesome.emit_signal("notification_center::unblock_mouse_events")
end) end)
awesome.connect_signal( capi.awesome.connect_signal(
"update::ram_widget", "update::ram_widget",
function(MemTotal, _, MemAvailable) function(MemTotal, _, MemAvailable)
if not MemTotal or not MemAvailable then if not MemTotal or not MemAvailable then
@@ -333,13 +337,13 @@ return function()
margins = dpi(10) margins = dpi(10)
} }
w:connect_signal("mouse::enter", 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) end)
w:connect_signal("mouse::leave", function() w:connect_signal("mouse::leave", function()
awesome.emit_signal("notification_center::unblock_mouse_events") capi.awesome.emit_signal("notification_center::unblock_mouse_events")
end) end)
awesome.connect_signal( capi.awesome.connect_signal(
"update::gpu_usage", "update::gpu_usage",
function(gpu_usage) function(gpu_usage)
tooltip.text = "GPU Usage: " .. gpu_usage .. "%" tooltip.text = "GPU Usage: " .. gpu_usage .. "%"
@@ -410,13 +414,13 @@ return function()
margins = dpi(10) margins = dpi(10)
} }
w:connect_signal("mouse::enter", 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) end)
w:connect_signal("mouse::leave", function() w:connect_signal("mouse::leave", function()
awesome.emit_signal("notification_center::unblock_mouse_events") capi.awesome.emit_signal("notification_center::unblock_mouse_events")
end) end)
awesome.connect_signal( capi.awesome.connect_signal(
"update::gpu_temp", "update::gpu_temp",
function(gpu_temp) function(gpu_temp)
local temp_icon local temp_icon
@@ -505,13 +509,13 @@ return function()
margins = dpi(10) margins = dpi(10)
} }
w:connect_signal("mouse::enter", 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) end)
w:connect_signal("mouse::leave", function() w:connect_signal("mouse::leave", function()
awesome.emit_signal("notification_center::unblock_mouse_events") capi.awesome.emit_signal("notification_center::unblock_mouse_events")
end) end)
awesome.connect_signal( capi.awesome.connect_signal(
"audio::get", "audio::get",
function(muted, volume) function(muted, volume)
local icon = icondir .. "audio/volume" local icon = icondir .. "audio/volume"
@@ -602,13 +606,13 @@ return function()
margins = dpi(10) margins = dpi(10)
} }
w:connect_signal("mouse::enter", 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) end)
w:connect_signal("mouse::leave", function() w:connect_signal("mouse::leave", function()
awesome.emit_signal("notification_center::unblock_mouse_events") capi.awesome.emit_signal("notification_center::unblock_mouse_events")
end) end)
awesome.connect_signal( capi.awesome.connect_signal(
"microphone::get", "microphone::get",
function(muted, volume) function(muted, volume)
if not volume then if not volume then
@@ -658,7 +662,7 @@ return function()
{ {
{ --Icon { --Icon
id = "icon1", 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), Theme_config.notification_center.status_bar.backlight_color),
halign = "center", halign = "center",
valign = "center", valign = "center",
@@ -692,19 +696,27 @@ return function()
margins = dpi(10) margins = dpi(10)
} }
w:connect_signal("mouse::enter", 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) end)
w:connect_signal("mouse::leave", function() w:connect_signal("mouse::leave", function()
awesome.emit_signal("notification_center::unblock_mouse_events") capi.awesome.emit_signal("notification_center::unblock_mouse_events")
end) end)
awesome.connect_signal( capi.awesome.connect_signal(
"update::backlight", "brightness::get",
function(backlight, backlight_icon) function(brightness)
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(backlight_icon, local icon = icondir .. "brightness"
Theme_config.notification_center.status_bar.backlight_color) if brightness >= 0 and brightness < 34 then
tooltip.text = "Backlight: " .. backlight .. "%" icon = icon .. "-low"
rubato_timer.target = backlight 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 end
) )
elseif widget == "battery" then elseif widget == "battery" then
@@ -771,13 +783,13 @@ return function()
margins = dpi(10) margins = dpi(10)
} }
w:connect_signal("mouse::enter", 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) end)
w:connect_signal("mouse::leave", function() w:connect_signal("mouse::leave", function()
awesome.emit_signal("notification_center::unblock_mouse_events") capi.awesome.emit_signal("notification_center::unblock_mouse_events")
end) end)
awesome.connect_signal( capi.awesome.connect_signal(
"update::battery_widget", "update::battery_widget",
function(battery, battery_icon) function(battery, battery_icon)
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(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 gears = require("gears")
local wibox = require("wibox") local wibox = require("wibox")
local capi = {
awesome = awesome,
mouse = mouse,
}
-- Icon directory path -- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/powermenu/" local icondir = awful.util.getdir("config") .. "src/assets/icons/powermenu/"
@@ -117,26 +122,26 @@ return function(s)
-- Create the power menu actions -- Create the power menu actions
local suspend_command = function() local suspend_command = function()
awful.spawn("systemctl suspend") awful.spawn("systemctl suspend")
awesome.emit_signal("module::powermenu:hide") capi.awesome.emit_signal("module::powermenu:hide")
end end
local logout_command = function() local logout_command = function()
awesome.quit() capi.awesome.quit()
end end
local lock_command = function() local lock_command = function()
awful.spawn("dm-tool lock") awful.spawn("dm-tool lock")
awesome.emit_signal("module::powermenu:hide") capi.awesome.emit_signal("module::powermenu:hide")
end end
local shutdown_command = function() local shutdown_command = function()
awful.spawn("shutdown now") awful.spawn("shutdown now")
awesome.emit_signal("module::powermenu:hide") capi.awesome.emit_signal("module::powermenu:hide")
end end
local reboot_command = function() local reboot_command = function()
awful.spawn("reboot") awful.spawn("reboot")
awesome.emit_signal("module::powermenu:hide") capi.awesome.emit_signal("module::powermenu:hide")
end end
-- Create the buttons with their command and name etc -- Create the buttons with their command and name etc
@@ -206,7 +211,7 @@ return function(s)
{}, {},
3, 3,
function() function()
awesome.emit_signal("module::powermenu:hide") capi.awesome.emit_signal("module::powermenu:hide")
end end
) )
) )
@@ -218,23 +223,23 @@ return function(s)
stop_event = 'release', stop_event = 'release',
keypressed_callback = function(self, mod, key, command) keypressed_callback = function(self, mod, key, command)
if key == 'Escape' then if key == 'Escape' then
awesome.emit_signal("module::powermenu:hide") capi.awesome.emit_signal("module::powermenu:hide")
end end
end end
} }
-- Signals -- Signals
awesome.connect_signal( capi.awesome.connect_signal(
"module::powermenu:show", "module::powermenu:show",
function() function()
if s == mouse.screen then if s == capi.mouse.screen then
powermenu_container.visible = true powermenu_container.visible = true
powermenu_keygrabber:start() powermenu_keygrabber:start()
end end
end end
) )
awesome.connect_signal( capi.awesome.connect_signal(
"module::powermenu:hide", "module::powermenu:hide",
function() function()
powermenu_keygrabber:stop() powermenu_keygrabber:stop()

View File

@@ -8,8 +8,10 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears") local gears = require("gears")
local wibox = require("wibox") local wibox = require("wibox")
local color = require("src.lib.color") local capi = {
local rubato = require("src.lib.rubato") awesome = awesome,
client = client
}
-- Icon directory path -- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/titlebar/" local icondir = awful.util.getdir("config") .. "src/assets/icons/titlebar/"
@@ -404,7 +406,7 @@ local create_titlebar_dialog_modal = function(c, size, position)
) )
end end
client.connect_signal( capi.client.connect_signal(
"request::titlebars", "request::titlebars",
function(c) function(c)
if c.type == "dialog" then if c.type == "dialog" then
@@ -425,7 +427,7 @@ client.connect_signal(
end end
) )
client.connect_signal( capi.client.connect_signal(
"property::floating", "property::floating",
function(c) function(c)
if c.floating and not (c.maximized or c.fullscreen) then 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 gears = require("gears")
local wibox = require("wibox") local wibox = require("wibox")
local capi = {
awesome = awesome,
mousegrabber = mousegrabber,
}
local rubato = require("src.lib.rubato") local rubato = require("src.lib.rubato")
-- Icon directory path -- Icon directory path
@@ -55,12 +60,12 @@ return function(s)
if key == 1 then if key == 1 then
if node then if node then
awful.spawn("./.config/awesome/src/scripts/vol.sh set_sink " .. node) 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 end
end end
) )
awesome.connect_signal( capi.awesome.connect_signal(
"update::bg_sink", "update::bg_sink",
function(new_node) function(new_node)
if node == new_node then if node == new_node then
@@ -97,7 +102,7 @@ return function(s)
end end
end end
) )
awesome.emit_signal("update::bg_sink", node) capi.awesome.emit_signal("update::bg_sink", node)
else else
device:connect_signal( device:connect_signal(
"button::press", "button::press",
@@ -105,12 +110,12 @@ return function(s)
if key == 1 then if key == 1 then
if node then if node then
awful.spawn("./.config/awesome/src/scripts/mic.sh set_source " .. node) 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 end
end end
) )
awesome.connect_signal( capi.awesome.connect_signal(
"update::bg_source", "update::bg_source",
function(new_node) function(new_node)
if node == new_node then if node == new_node then
@@ -147,7 +152,7 @@ return function(s)
end end
end end
) )
awesome.emit_signal("update::bg_source", node) capi.awesome.emit_signal("update::bg_source", node)
end end
return device return device
end end
@@ -595,14 +600,15 @@ return function(s)
) )
end end
awesome.connect_signal( capi.awesome.connect_signal(
"audio::device_changed", "audio::device_changed",
function() function()
get_input_devices() get_input_devices()
end end
) )
awesome.connect_signal( capi.awesome.connect_signal(
"microphone::device_changed", "microphone::device_changed",
function() function()
get_source_devices() get_source_devices()
@@ -610,7 +616,8 @@ return function(s)
) )
-- Set the volume and icon -- Set the volume and icon
awesome.connect_signal( capi.awesome.connect_signal(
"audio::get", "audio::get",
function(muted, volume) function(muted, volume)
if muted then if muted then
@@ -642,12 +649,12 @@ return function(s)
) )
-- Get microphone volume -- Get microphone volume
awesome.connect_signal( capi.awesome.connect_signal(
"microphone::get", "microphone::get",
function(muted, volume) function(muted, volume)
if muted then 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].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)) .. "microphone-off.svg", Theme_config.volume_controller.microphone_fg))
else else
volume = tonumber(volume) volume = tonumber(volume)
@@ -670,10 +677,10 @@ return function(s)
volume_controller_container:connect_signal( volume_controller_container:connect_signal(
"mouse::leave", "mouse::leave",
function() function()
mousegrabber.run( capi.mousegrabber.run(
function() function()
awesome.emit_signal("volume_controller::toggle", s) capi.awesome.emit_signal("volume_controller::toggle", s)
mousegrabber.stop() capi.mousegrabber.stop()
return true return true
end, end,
"arrow" "arrow"
@@ -684,7 +691,7 @@ return function(s)
volume_controller_container:connect_signal( volume_controller_container:connect_signal(
"mouse::enter", "mouse::enter",
function() function()
mousegrabber.stop() capi.mousegrabber.stop()
end end
) )
@@ -694,8 +701,8 @@ return function(s)
autostart = false, autostart = false,
stop_event = 'release', stop_event = 'release',
keypressed_callback = function() keypressed_callback = function()
awesome.emit_signal("volume_controller::toggle", s) capi.awesome.emit_signal("volume_controller::toggle", s)
mousegrabber.stop() capi.mousegrabber.stop()
end end
} }
@@ -706,7 +713,7 @@ return function(s)
} }
-- Toggle container visibility -- Toggle container visibility
awesome.connect_signal( capi.awesome.connect_signal(
"volume_controller::toggle", "volume_controller::toggle",
function(scr) function(scr)
if scr == s then if scr == s then

View File

@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears") local gears = require("gears")
local wibox = require("wibox") local wibox = require("wibox")
local capi = {
awesome = awesome,
mouse = mouse,
}
-- Icon directory path -- Icon directory path
local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/" local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/"
@@ -70,7 +75,7 @@ return function(s)
widget = wibox.container.background widget = wibox.container.background
} }
awesome.connect_signal( capi.awesome.connect_signal(
"audio::get", "audio::get",
function(muted, volume) function(muted, volume)
if muted then if muted then
@@ -126,10 +131,10 @@ return function(s)
layout = wibox.layout.fixed.horizontal layout = wibox.layout.fixed.horizontal
} }
awesome.connect_signal( capi.awesome.connect_signal(
"widget::volume_osd:rerun", "widget::volume_osd:rerun",
function() function()
if mouse.screen == s then if capi.mouse.screen == s then
volume_container.visible = true volume_container.visible = true
if hide_volume_osd.started then if hide_volume_osd.started then
hide_volume_osd:again() hide_volume_osd:again()

View File

@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears") local gears = require("gears")
local wibox = require("wibox") local wibox = require("wibox")
local capi = {
awesome = awesome,
mouse = mouse,
}
local window_elements = require("src.modules.window_switcher.window_elements")() local window_elements = require("src.modules.window_switcher.window_elements")()
return function(s) return function(s)
@@ -38,10 +43,10 @@ return function(s)
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
} }
awesome.connect_signal( capi.awesome.connect_signal(
"toggle_window_switcher", "toggle_window_switcher",
function() function()
if mouse.screen == s then if capi.mouse.screen == s then
window_switcher_container.visible = not window_switcher_container.visible window_switcher_container.visible = not window_switcher_container.visible
end end
end end

View File

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

View File

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

View File

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

View File

@@ -2,7 +2,10 @@ local awful = require("awful")
local gears = require("gears") local gears = require("gears")
local dbus_proxy = require("dbus_proxy") local dbus_proxy = require("dbus_proxy")
local lgi = require("lgi") local lgi = require("lgi")
local naughty = require("naughty")
local capi = {
awesome = awesome,
}
return function() return function()
@@ -28,12 +31,13 @@ return function()
interface = "org.freedesktop.DBus.Properties", interface = "org.freedesktop.DBus.Properties",
path = object_path 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() device_properties:connect_signal(function()
awesome.emit_signal("bluetooth::device_changed", device, battery) capi.awesome.emit_signal("bluetooth::device_changed", device, battery)
end, "PropertiesChanged") end, "PropertiesChanged")
awesome.emit_signal("bluetooth::device_changed", device, battery) capi.awesome.emit_signal("bluetooth::device_changed", device, battery)
end end
end end
end end
@@ -73,7 +77,7 @@ return function()
ObjectManager:connect_signal( ObjectManager:connect_signal(
function(interface) function(interface)
awesome.emit_signal("device_removed", interface) capi.awesome.emit_signal("device_removed", interface)
end, end,
"InterfacesRemoved" "InterfacesRemoved"
) )
@@ -81,13 +85,13 @@ return function()
Adapter:connect_signal( Adapter:connect_signal(
function(data) function(data)
if data.Powered ~= nil then if data.Powered ~= nil then
awesome.emit_signal("state", data.Powered) capi.awesome.emit_signal("state", data.Powered)
end end
end, end,
"PropertiesChanged" "PropertiesChanged"
) )
awesome.connect_signal( capi.awesome.connect_signal(
"bluetooth::scan", "bluetooth::scan",
function() function()
Adapter:StartDiscovery() Adapter:StartDiscovery()
@@ -105,7 +109,7 @@ return function()
"PropertiesChanged" "PropertiesChanged"
) )
awesome.connect_signal("toggle_bluetooth", capi.awesome.connect_signal("toggle_bluetooth",
function() function()
local is_powered = Adapter.Powered local is_powered = Adapter.Powered
Adapter:Set( Adapter:Set(
@@ -114,7 +118,7 @@ return function()
lgi.GLib.Variant("b", not is_powered) lgi.GLib.Variant("b", not is_powered)
) )
Adapter.Powered = { signature = "b", value = 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) end)
gears.timer.delayed_call( gears.timer.delayed_call(
@@ -125,7 +129,7 @@ return function()
get_device_info(object_path) get_device_info(object_path)
end end
awesome.emit_signal("state", Adapter.Powered) capi.awesome.emit_signal("state", Adapter.Powered)
end end
) )
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. ---Gets the icon path from an AppInfo gicon.
---@param app Gio.AppInfo ---@param app Gio.AppInfo
---@return string path ---@return string|nil path
function Get_gicon_path(app) function Get_gicon_path(app)
if not app then return end
local icon_info = gtk_theme:lookup_by_gicon(app, 64, 0) local icon_info = gtk_theme:lookup_by_gicon(app, 64, 0)
if icon_info then if icon_info then
local path = icon_info:get_filename() local path = icon_info:get_filename()

View File

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

View File

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

View File

@@ -1,6 +1,10 @@
local awful = require("awful") local awful = require("awful")
local watch = awful.widget.watch local watch = awful.widget.watch
local capi = {
awesome = awesome,
}
watch( watch(
[[ bash -c "cat /proc/cpuinfo | grep "MHz" | awk '{print int($4)}'" ]], [[ bash -c "cat /proc/cpuinfo | grep "MHz" | awk '{print int($4)}'" ]],
3, 3,
@@ -18,9 +22,9 @@ watch(
average = average + cpu_freq[i] average = average + cpu_freq[i]
end end
average = math.floor(average / #cpu_freq) 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 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
end end
) )

View File

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

View File

@@ -1,6 +1,10 @@
local awful = require("awful") local awful = require("awful")
local watch = awful.widget.watch local watch = awful.widget.watch
local capi = {
awesome = awesome,
}
local total_prev = 0 local total_prev = 0
local idle_prev = 0 local idle_prev = 0
@@ -18,7 +22,7 @@ watch(
local diff_total = total - total_prev local diff_total = total - total_prev
local diff_usage = math.floor(((1000 * (diff_total - diff_idle) / diff_total + 5) / 10) + 0.5) 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 total_prev = total
idle_prev = idle idle_prev = idle

View File

@@ -1,10 +1,14 @@
local awful = require("awful") local awful = require("awful")
local watch = awful.widget.watch local watch = awful.widget.watch
local capi = {
awesome = awesome,
}
watch( watch(
[[ bash -c "nvidia-smi -q -d TEMPERATURE | grep 'GPU Current Temp' | awk '{print $5}'"]], [[ bash -c "nvidia-smi -q -d TEMPERATURE | grep 'GPU Current Temp' | awk '{print $5}'"]],
3, 3,
function(_, stdout) 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 end
) )

View File

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

View File

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

View File

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

View File

@@ -1,11 +1,15 @@
local awful = require("awful") local awful = require("awful")
local watch = awful.widget.watch local watch = awful.widget.watch
local capi = {
awesome = awesome,
}
watch( watch(
[[ bash -c "cat /proc/meminfo| grep Mem | awk '{print $2}'" ]], [[ bash -c "cat /proc/meminfo| grep Mem | awk '{print $2}'" ]],
3, 3,
function(_, stdout) function(_, stdout)
local MemTotal, MemFree, MemAvailable = stdout:match("(%d+)\n(%d+)\n(%d+)\n") 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 end
) )

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -9,6 +9,10 @@ local gears = require("gears")
local watch = awful.widget.watch local watch = awful.widget.watch
local wibox = require("wibox") local wibox = require("wibox")
local capi = {
awesome = awesome,
}
local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/" local icon_dir = awful.util.getdir("config") .. "src/assets/icons/cpu/"
return function() return function()
@@ -57,7 +61,7 @@ return function()
Hover_signal(ram_widget) Hover_signal(ram_widget)
awesome.connect_signal( capi.awesome.connect_signal(
"update::ram_widget", "update::ram_widget",
function(MemTotal, MemFree, MemAvailable) function(MemTotal, MemFree, MemAvailable)
local ram_string = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) .. 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 gears = require("gears")
local wibox = require("wibox") local wibox = require("wibox")
local capi = {
awesome = awesome,
}
Theme.bg_systray = Theme_config.systray.bg Theme.bg_systray = Theme_config.systray.bg
Theme.systray_icon_spacing = dpi(10) Theme.systray_icon_spacing = dpi(10)
@@ -29,8 +33,8 @@ return function(s)
bg = Theme_config.systray.bg bg = Theme_config.systray.bg
} }
awesome.connect_signal("systray::update", function() capi.awesome.connect_signal("systray::update", function()
local num_entries = awesome.systray() local num_entries = capi.awesome.systray()
if num_entries == 0 then if num_entries == 0 then
systray.container.st:set_margins(0) systray.container.st:set_margins(0)

View File

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

View File

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