rewrote a lot of stuff especially the bluetooth module. fixed some errors
This commit is contained in:
@@ -5,24 +5,31 @@
|
||||
-- Awesome Libs
|
||||
local awful = require("awful")
|
||||
local Gio = require("lgi").Gio
|
||||
local gfilesystem = require("gears").filesystem
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
local json = require("src.lib.json-lua.json-lua")
|
||||
|
||||
local cm = require("src.modules.context_menu")
|
||||
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/context_menu/"
|
||||
|
||||
return function()
|
||||
return function(s)
|
||||
|
||||
local application_grid = wibox.widget {
|
||||
homogenous = true,
|
||||
expand = false,
|
||||
spacing = dpi(10),
|
||||
id = "grid",
|
||||
forced_num_cols = 8,
|
||||
-- 200 is the application element width + 10 spacing
|
||||
forced_num_cols = math.floor((capi.mouse.screen.geometry.width / 100 * 60) / (200)),
|
||||
forced_num_rows = 7,
|
||||
orientation = "vertical",
|
||||
layout = wibox.layout.grid
|
||||
@@ -107,7 +114,7 @@ return function()
|
||||
name = "Execute as sudo",
|
||||
icon = gears.color.recolor_image(icondir .. "launch.svg", Theme_config.context_menu.icon_color),
|
||||
callback = function()
|
||||
awesome.emit_signal("application_launcher::show")
|
||||
capi.awesome.emit_signal("application_launcher::show")
|
||||
awful.spawn("/home/crylia/.config/awesome/src/scripts/start_as_admin.sh " .. app_widget.exec)
|
||||
end
|
||||
},
|
||||
@@ -115,6 +122,11 @@ return function()
|
||||
name = "Pin to dock",
|
||||
icon = gears.color.recolor_image(icondir .. "pin.svg", Theme_config.context_menu.icon_color),
|
||||
callback = function()
|
||||
local dir = awful.util.getdir("config") .. "src/config"
|
||||
gfilesystem.make_directories(dir)
|
||||
if not gfilesystem.file_readable(dir) then
|
||||
os.execute("touch " .. dir .. "/dock.json")
|
||||
end
|
||||
local handler = io.open("/home/crylia/.config/awesome/src/config/dock.json", "r")
|
||||
if not handler then
|
||||
return
|
||||
@@ -141,14 +153,14 @@ return function()
|
||||
end
|
||||
handler:write(dock_encoded)
|
||||
handler:close()
|
||||
awesome.emit_signal("dock::changed")
|
||||
capi.awesome.emit_signal("dock::changed")
|
||||
end
|
||||
},
|
||||
{
|
||||
name = "Add to desktop",
|
||||
icon = gears.color.recolor_image(icondir .. "desktop.svg", Theme_config.context_menu.icon_color),
|
||||
callback = function()
|
||||
awesome.emit_signal("application_launcher::show")
|
||||
capi.awesome.emit_signal("application_launcher::show")
|
||||
--!TODO: Add to desktop
|
||||
end
|
||||
}
|
||||
@@ -163,7 +175,7 @@ return function()
|
||||
button = 1,
|
||||
on_release = function()
|
||||
Gio.AppInfo.launch_uris_async(app)
|
||||
awesome.emit_signal("application_launcher::show")
|
||||
capi.awesome.emit_signal("application_launcher::show")
|
||||
end
|
||||
}),
|
||||
awful.button({
|
||||
@@ -174,8 +186,8 @@ return function()
|
||||
return
|
||||
end
|
||||
-- add offset so mouse is above widget, this is so the mouse::leave event triggers always
|
||||
context_menu.x = mouse.coords().x - 10
|
||||
context_menu.y = mouse.coords().y - 10
|
||||
context_menu.x = capi.mouse.coords().x - 10
|
||||
context_menu.y = capi.mouse.coords().y - 10
|
||||
context_menu.visible = not context_menu.visible
|
||||
end
|
||||
})
|
||||
@@ -214,7 +226,7 @@ return function()
|
||||
local pos = application_grid:get_widget_position(application)
|
||||
|
||||
-- Check if the curser is currently at the same position as the application
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::selected",
|
||||
function()
|
||||
if curser.y == pos.row and curser.x == pos.col then
|
||||
@@ -224,7 +236,7 @@ return function()
|
||||
end
|
||||
end
|
||||
)
|
||||
awesome.emit_signal("update::selected")
|
||||
capi.awesome.emit_signal("update::selected")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -233,18 +245,18 @@ return function()
|
||||
|
||||
application_grid = get_applications(filter)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"application::left",
|
||||
function()
|
||||
curser.x = curser.x - 1
|
||||
if curser.x < 1 then
|
||||
curser.x = 1
|
||||
end
|
||||
awesome.emit_signal("update::selected")
|
||||
capi.awesome.emit_signal("update::selected")
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"application::right",
|
||||
function()
|
||||
curser.x = curser.x + 1
|
||||
@@ -252,22 +264,22 @@ return function()
|
||||
if curser.x > grid_cols then
|
||||
curser.x = grid_cols
|
||||
end
|
||||
awesome.emit_signal("update::selected")
|
||||
capi.awesome.emit_signal("update::selected")
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"application::up",
|
||||
function()
|
||||
curser.y = curser.y - 1
|
||||
if curser.y < 1 then
|
||||
curser.y = 1
|
||||
end
|
||||
awesome.emit_signal("update::selected")
|
||||
capi.awesome.emit_signal("update::selected")
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"application::down",
|
||||
function()
|
||||
curser.y = curser.y + 1
|
||||
@@ -275,21 +287,21 @@ return function()
|
||||
if curser.y > grid_rows then
|
||||
curser.y = grid_rows
|
||||
end
|
||||
awesome.emit_signal("update::selected")
|
||||
capi.awesome.emit_signal("update::selected")
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::application_list",
|
||||
function(f)
|
||||
application_grid = get_applications(f)
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"application_launcher::execute",
|
||||
function()
|
||||
awesome.emit_signal("searchbar::stop")
|
||||
capi.awesome.emit_signal("searchbar::stop")
|
||||
|
||||
local selected_widget = application_grid:get_widgets_at(curser.y, curser.x)[1]
|
||||
Gio.AppInfo.launch_uris_async(Gio.AppInfo.create_from_commandline(selected_widget.exec, nil, 0))
|
||||
|
||||
@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
local application_grid = require("src.modules.application_launcher.application")()
|
||||
local searchbar = require("src.modules.application_launcher.searchbar")()
|
||||
|
||||
@@ -32,7 +37,7 @@ return function(s)
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
height = s.geometry.height / 100 * 60,
|
||||
width = s.geometry.width / 100 * 60,
|
||||
--width = s.geometry.width / 100 * 60,
|
||||
strategy = "exact",
|
||||
widget = wibox.container.constraint
|
||||
}
|
||||
@@ -57,17 +62,17 @@ return function(s)
|
||||
layout = wibox.layout.fixed.vertical
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"application_launcher::show",
|
||||
function()
|
||||
if mouse.screen == s then
|
||||
if capi.mouse.screen == s then
|
||||
application_container.visible = not application_container.visible
|
||||
if application_container.visible == false then
|
||||
awesome.emit_signal("searchbar::stop")
|
||||
capi.awesome.emit_signal("searchbar::stop")
|
||||
end
|
||||
end
|
||||
if application_container.visible then
|
||||
awesome.emit_signal("searchbar::start")
|
||||
capi.awesome.emit_signal("searchbar::start")
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
local awful = require("awful")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local gfs = gears.filesystem
|
||||
local gtable = gears.table
|
||||
local gdebug = gears.debug
|
||||
local gstring = gears.string
|
||||
local keygrabber = require("awful.keygrabber")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/application_launcher/searchbar/"
|
||||
|
||||
local kgrabber
|
||||
@@ -71,7 +73,7 @@ return function()
|
||||
|
||||
local old_wibox, old_cursor
|
||||
local mouse_enter = function()
|
||||
local w = mouse.current_wibox
|
||||
local w = capi.mouse.current_wibox
|
||||
if w then
|
||||
old_cursor, old_wibox = w.cursor, w
|
||||
w.cursor = "xterm"
|
||||
@@ -135,16 +137,16 @@ return function()
|
||||
local function update()
|
||||
search_text:set_markup(promt_text_with_cursor(text_string, cur_pos))
|
||||
--Send the string over to the application to filter applications
|
||||
awesome.emit_signal("update::application_list", text_string)
|
||||
capi.awesome.emit_signal("update::application_list", text_string)
|
||||
end
|
||||
|
||||
update()
|
||||
|
||||
kgrabber = keygrabber.run(
|
||||
function(modifiers, key, event)
|
||||
awesome.connect_signal("searchbar::stop", function()
|
||||
capi.awesome.connect_signal("searchbar::stop", function()
|
||||
keygrabber.stop(kgrabber)
|
||||
awesome.emit_signal("application_launcher::kgrabber_start")
|
||||
capi.awesome.emit_signal("application_launcher::kgrabber_start")
|
||||
end)
|
||||
|
||||
local mod = {}
|
||||
@@ -162,7 +164,7 @@ return function()
|
||||
keygrabber.stop(kgrabber)
|
||||
search_text:set_markup(promt_text_with_cursor("", 1))
|
||||
text_string = ""
|
||||
awesome.emit_signal("application_launcher::show")
|
||||
capi.awesome.emit_signal("application_launcher::show")
|
||||
elseif (not mod.Control and key == "Return") or
|
||||
(not mod.Control and key == "KP_Enter") then
|
||||
keygrabber.stop(kgrabber)
|
||||
@@ -170,8 +172,8 @@ return function()
|
||||
searchbar.s_background.fg = Theme_config.application_launcher.searchbar.fg_hint
|
||||
search_text:set_markup(promt_text_with_cursor("", 1))
|
||||
text_string = ""
|
||||
awesome.emit_signal("application_launcher::execute")
|
||||
awesome.emit_signal("application_launcher::show")
|
||||
capi.awesome.emit_signal("application_launcher::execute")
|
||||
capi.awesome.emit_signal("application_launcher::show")
|
||||
end
|
||||
|
||||
if mod.Control then
|
||||
@@ -195,15 +197,15 @@ return function()
|
||||
-- Move cursor to the left
|
||||
elseif key == "Left" then
|
||||
--cur_pos = cur_pos - 1
|
||||
awesome.emit_signal("application::left")
|
||||
capi.awesome.emit_signal("application::left")
|
||||
-- Move cursor to the right
|
||||
elseif key == "Right" then
|
||||
--cur_pos = cur_pos + 1
|
||||
awesome.emit_signal("application::right")
|
||||
capi.awesome.emit_signal("application::right")
|
||||
elseif key == "Up" then
|
||||
awesome.emit_signal("application::up")
|
||||
capi.awesome.emit_signal("application::up")
|
||||
elseif key == "Down" then
|
||||
awesome.emit_signal("application::down")
|
||||
capi.awesome.emit_signal("application::down")
|
||||
else
|
||||
--Add key at cursor position
|
||||
if key:wlen() == 1 then
|
||||
@@ -234,7 +236,7 @@ return function()
|
||||
end)
|
||||
))
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"searchbar::start",
|
||||
function()
|
||||
if not awful.keygrabber.is_running then
|
||||
|
||||
187
awesome/src/modules/bluetooth/device.lua
Normal file
187
awesome/src/modules/bluetooth/device.lua
Normal 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)
|
||||
366
awesome/src/modules/bluetooth/init.lua
Normal file
366
awesome/src/modules/bluetooth/init.lua
Normal 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)
|
||||
@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/brightness/"
|
||||
|
||||
@@ -69,9 +74,10 @@ return function(s)
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"brightness::get",
|
||||
function(brightness)
|
||||
print(brightness)
|
||||
brightness_osd_widget:get_children_by_id("progressbar1")[1].value = brightness
|
||||
|
||||
local icon = icondir .. "brightness"
|
||||
@@ -112,10 +118,10 @@ return function(s)
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"brightness::rerun",
|
||||
function()
|
||||
if mouse.screen == s then
|
||||
if capi.mouse.screen == s then
|
||||
brightness_container.visible = true
|
||||
if hide_brightness_osd.started then
|
||||
hide_brightness_osd:again()
|
||||
|
||||
@@ -9,6 +9,11 @@ local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local ical_parser = require("src.tools.ical_parser")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/calendar/"
|
||||
|
||||
--- Month name lookup table
|
||||
@@ -124,7 +129,7 @@ local function get_weeks_in_month(month, year)
|
||||
end
|
||||
|
||||
---Gets the last month and accounts for year changes
|
||||
---@param d date date object
|
||||
---@param d table date object
|
||||
---@return table|nil date returns a date object
|
||||
local function get_last_month(d)
|
||||
if not (d) then return end
|
||||
@@ -410,7 +415,7 @@ return function(s)
|
||||
|
||||
---Main function to create the calendar widget
|
||||
---Probably needs some refractor at some point since it's a bit messy
|
||||
---@return widget calendar_widget
|
||||
---@return wibox.widget calendar_widget
|
||||
local function create_calendar()
|
||||
|
||||
calendar_matrix:reset()
|
||||
@@ -562,12 +567,12 @@ return function(s)
|
||||
|
||||
day:connect_signal("day::update_selected", function()
|
||||
if column == selected_day.col and 1 == selected_day.row then
|
||||
awesome.emit_signal("day::reset_border")
|
||||
capi.awesome.emit_signal("day::reset_border")
|
||||
day.background.border_color = Theme_config.calendar.day.today_border_color
|
||||
end
|
||||
end)
|
||||
|
||||
awesome.connect_signal("day::reset_border", function()
|
||||
capi.awesome.connect_signal("day::reset_border", function()
|
||||
day.background.border_color = Theme_config.calendar.day.border_color
|
||||
end)
|
||||
|
||||
@@ -663,12 +668,12 @@ return function(s)
|
||||
|
||||
day:connect_signal("day::update_selected", function()
|
||||
if col == selected_day.col and row == selected_day.row then
|
||||
awesome.emit_signal("day::reset_border")
|
||||
capi.awesome.emit_signal("day::reset_border")
|
||||
day.background.border_color = Theme_config.calendar.day.today_border_color
|
||||
end
|
||||
end)
|
||||
|
||||
awesome.connect_signal("day::reset_border", function()
|
||||
capi.awesome.connect_signal("day::reset_border", function()
|
||||
day.background.border_color = Theme_config.calendar.day.border_color
|
||||
end)
|
||||
|
||||
@@ -773,12 +778,12 @@ return function(s)
|
||||
|
||||
day:connect_signal("day::update_selected", function()
|
||||
if i == selected_day.col and months[date.month].weeks == selected_day.row then
|
||||
awesome.emit_signal("day::reset_border")
|
||||
capi.awesome.emit_signal("day::reset_border")
|
||||
day.background.border_color = Theme_config.calendar.day.today_border_color
|
||||
end
|
||||
end)
|
||||
|
||||
awesome.connect_signal("day::reset_border", function()
|
||||
capi.awesome.connect_signal("day::reset_border", function()
|
||||
day.background.border_color = Theme_config.calendar.day.border_color
|
||||
end)
|
||||
calendar_matrix:add_widget_at(day, months[date.month].weeks, months[date.month].last_day + i)
|
||||
@@ -1073,8 +1078,8 @@ return function(s)
|
||||
)
|
||||
|
||||
--- Toggle calendar visibility
|
||||
awesome.connect_signal("calendar::toggle", function(widget)
|
||||
if s == mouse.screen then
|
||||
capi.awesome.connect_signal("calendar::toggle", function(widget)
|
||||
if s == capi.mouse.screen then
|
||||
cal_popup.x = 3765
|
||||
cal_popup.y = 60
|
||||
cal_popup.visible = not cal_popup.visible
|
||||
|
||||
@@ -7,6 +7,11 @@ local gshape = require("gears.shape")
|
||||
local gcolor = require("gears.color")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
local ical_parser = require("src.tools.ical_parser")()
|
||||
--local task_info = require("src.modules.calendar.task_info")
|
||||
|
||||
@@ -481,8 +486,8 @@ function calendar:create_calendar_widget()
|
||||
ontop = true,
|
||||
visible = true,
|
||||
bg = "#00000000",
|
||||
x = mouse.coords().x,
|
||||
y = mouse.coords().y,
|
||||
x = capi.mouse.coords().x,
|
||||
y = capi.mouse.coords().y,
|
||||
screen = self.screen
|
||||
}
|
||||
|
||||
@@ -901,8 +906,10 @@ function calendar.new(args)
|
||||
ontop = true,
|
||||
bg = "#00000000",
|
||||
visible = false,
|
||||
x = 3750,
|
||||
y = 60
|
||||
placement = function(c) awful.placement.align(c,
|
||||
{ position = "top_right", margins = { right = dpi(10), top = dpi(65) } })
|
||||
end
|
||||
|
||||
}
|
||||
|
||||
calendar_widget:get_children_by_id("add_ical")[1]:buttons(
|
||||
@@ -991,8 +998,8 @@ function calendar.new(args)
|
||||
)
|
||||
)
|
||||
|
||||
awesome.connect_signal("calendar::toggle", function()
|
||||
if mouse.screen == args.screen then
|
||||
capi.awesome.connect_signal("calendar::toggle", function()
|
||||
if capi.mouse.screen == args.screen then
|
||||
ret.widget.visible = not ret.widget.visible
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -7,6 +7,10 @@ local gshape = require("gears.shape")
|
||||
local gobject = require("gears.object")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/calendar/"
|
||||
|
||||
local task_info = { mt = {} }
|
||||
@@ -111,8 +115,8 @@ function task_info.new(args)
|
||||
ontop = true,
|
||||
visible = true,
|
||||
bg = "#00000000",
|
||||
x = mouse.coords().x,
|
||||
y = mouse.coords().y,
|
||||
x = capi.mouse.coords().x,
|
||||
y = capi.mouse.coords().y,
|
||||
screen = args.screen
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
return function(args)
|
||||
if not args then
|
||||
return
|
||||
@@ -65,7 +70,7 @@ return function(args)
|
||||
modifiers = {},
|
||||
button = 1,
|
||||
on_release = function()
|
||||
awesome.emit_signal("context_menu::hide")
|
||||
capi.awesome.emit_signal("context_menu::hide")
|
||||
entry.callback()
|
||||
end
|
||||
})
|
||||
@@ -91,18 +96,18 @@ return function(args)
|
||||
border_width = Theme_config.context_menu.border_width,
|
||||
border_color = Theme_config.context_menu.border_color,
|
||||
shape = Theme_config.context_menu.shape,
|
||||
x = mouse.coords().x,
|
||||
y = mouse.coords().y,
|
||||
x = capi.mouse.coords().x,
|
||||
y = capi.mouse.coords().y,
|
||||
visible = false,
|
||||
ontop = true,
|
||||
placement = awful.placement.no_offscreen,
|
||||
}
|
||||
|
||||
menu:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("context_menu::hide")
|
||||
capi.awesome.emit_signal("context_menu::hide")
|
||||
end)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"context_menu::hide",
|
||||
function()
|
||||
menu.visible = false
|
||||
|
||||
@@ -7,6 +7,11 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
client = client,
|
||||
}
|
||||
|
||||
return function(s, widgets)
|
||||
|
||||
local top_center = awful.popup {
|
||||
@@ -74,7 +79,7 @@ return function(s, widgets)
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
client.connect_signal(
|
||||
capi.client.connect_signal(
|
||||
"manage",
|
||||
function(c)
|
||||
if #s.selected_tag:clients() < 1 then
|
||||
@@ -85,7 +90,7 @@ return function(s, widgets)
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
capi.client.connect_signal(
|
||||
"unmanage",
|
||||
function(c)
|
||||
if #s.selected_tag:clients() < 1 then
|
||||
@@ -96,7 +101,7 @@ return function(s, widgets)
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
capi.client.connect_signal(
|
||||
"property::selected",
|
||||
function(c)
|
||||
if #s.selected_tag:clients() < 1 then
|
||||
@@ -107,7 +112,7 @@ return function(s, widgets)
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"refresh",
|
||||
function(c)
|
||||
if #s.selected_tag:clients() < 1 then
|
||||
|
||||
@@ -8,6 +8,12 @@ local Gio = require("lgi").Gio
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
client = client,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
local json = require("src.lib.json-lua.json-lua")
|
||||
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/context_menu/"
|
||||
@@ -65,7 +71,7 @@ return function(screen)
|
||||
Hover_signal(dock_element.background, Theme_config.dock.element_focused_bg .. "dd")
|
||||
|
||||
local DAI = Gio.DesktopAppInfo.new_from_filename(program.desktop_file)
|
||||
|
||||
if not DAI then return end
|
||||
local action_entries = {}
|
||||
for _, action in ipairs(program.actions) do
|
||||
table.insert(action_entries, {
|
||||
@@ -101,7 +107,7 @@ return function(screen)
|
||||
end
|
||||
data:write(json:encode(dock))
|
||||
data:close()
|
||||
awesome.emit_signal("dock::changed")
|
||||
capi.awesome.emit_signal("dock::changed")
|
||||
end
|
||||
})
|
||||
|
||||
@@ -125,19 +131,19 @@ return function(screen)
|
||||
return
|
||||
end
|
||||
-- add offset so mouse is above widget, this is so the mouse::leave event triggers always
|
||||
context_menu.x = mouse.coords().x - 10
|
||||
context_menu.y = mouse.coords().y + 10 - context_menu.height
|
||||
context_menu.x = capi.mouse.coords().x - 10
|
||||
context_menu.y = capi.mouse.coords().y + 10 - context_menu.height
|
||||
context_menu.visible = not context_menu.visible
|
||||
cm_open = context_menu.visible
|
||||
end
|
||||
})
|
||||
))
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"context_menu::hide",
|
||||
function()
|
||||
cm_open = false
|
||||
awesome.emit_signal("dock::check_for_dock_hide")
|
||||
capi.awesome.emit_signal("dock::check_for_dock_hide")
|
||||
end
|
||||
)
|
||||
|
||||
@@ -168,14 +174,14 @@ return function(screen)
|
||||
for _, pr in ipairs(prog) do
|
||||
local indicators = { layout = wibox.layout.flex.horizontal, spacing = dpi(5) }
|
||||
local col = Theme_config.dock.indicator_bg
|
||||
for _, c in ipairs(client.get()) do
|
||||
for _, c in ipairs(capi.client.get()) do
|
||||
local icon_name = string.lower(pr.icon)
|
||||
if not c or not c.valid then return end
|
||||
if not c.class then c.class = "" end
|
||||
local class = string.lower(c.class)
|
||||
local cls = c.class or ""
|
||||
local class = string.lower(cls)
|
||||
icon_name = string.match(icon_name, ".*/(.*)%.[svg|png]")
|
||||
if class == icon_name or class:match(icon_name) or icon_name:match(class) then
|
||||
if c == client.focus then
|
||||
if c == capi.client.focus then
|
||||
col = Theme_config.dock.indicator_focused_bg
|
||||
elseif c.urgent then
|
||||
col = Theme_config.dock.indicator_urgent_bg
|
||||
@@ -307,17 +313,17 @@ return function(screen)
|
||||
dock.visible = false
|
||||
if client.fullscreen then
|
||||
fakedock.visible = false
|
||||
awesome.emit_signal("notification_center_activation::toggle", s, false)
|
||||
capi.awesome.emit_signal("notification_center_activation::toggle", s, false)
|
||||
end
|
||||
elseif not client.fullscreen then
|
||||
fakedock.visible = true
|
||||
awesome.emit_signal("notification_center_activation::toggle", s, true)
|
||||
capi.awesome.emit_signal("notification_center_activation::toggle", s, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
if s == mouse.screen then
|
||||
if s == capi.mouse.screen then
|
||||
local minimized = false
|
||||
for _, c in ipairs(clients_on_tag) do
|
||||
if c.minimized then
|
||||
@@ -370,7 +376,7 @@ return function(screen)
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
capi.client.connect_signal(
|
||||
"manage",
|
||||
function()
|
||||
check_for_dock_hide(screen)
|
||||
@@ -387,7 +393,7 @@ return function(screen)
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
capi.client.connect_signal(
|
||||
"property::minimized",
|
||||
function()
|
||||
check_for_dock_hide(screen)
|
||||
@@ -404,7 +410,7 @@ return function(screen)
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
capi.client.connect_signal(
|
||||
"unmanage",
|
||||
function()
|
||||
check_for_dock_hide(screen)
|
||||
@@ -421,7 +427,7 @@ return function(screen)
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
capi.client.connect_signal(
|
||||
"focus",
|
||||
function()
|
||||
check_for_dock_hide(screen)
|
||||
@@ -438,7 +444,7 @@ return function(screen)
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"dock::changed",
|
||||
function()
|
||||
get_dock_elements()
|
||||
@@ -455,7 +461,7 @@ return function(screen)
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"dock::check_for_dock_hide",
|
||||
function()
|
||||
dock_intelligent_hide:again()
|
||||
|
||||
@@ -20,7 +20,7 @@ awful.screen.connect_for_each_screen(
|
||||
require("src.modules.powermenu")(s)
|
||||
require("src.modules.volume_osd")(s)
|
||||
require("src.modules.brightness_osd")(s)
|
||||
require("src.modules.bluetooth_controller")(s)
|
||||
require("src.modules.bluetooth.init") { screen = s }
|
||||
require("src.modules.titlebar")
|
||||
require("src.modules.volume_controller")(s)
|
||||
require("src.modules.crylia_bar.init")(s)
|
||||
|
||||
@@ -10,6 +10,10 @@ local wibox = require("wibox")
|
||||
|
||||
local rubato = require("src.lib.rubato")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
|
||||
|
||||
@@ -36,7 +40,7 @@ return function(s)
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
})
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"notification_center_activation::toggle",
|
||||
function(screen, hide)
|
||||
if screen == s then
|
||||
@@ -121,7 +125,7 @@ return function(s)
|
||||
fit = function(_, width, height)
|
||||
return width, height
|
||||
end,
|
||||
draw = toggle_animation(0, Theme_config.notification_center.dnd.disabled),
|
||||
draw = toggle_animation(0),
|
||||
},
|
||||
id = "background",
|
||||
},
|
||||
@@ -326,7 +330,7 @@ return function(s)
|
||||
)
|
||||
|
||||
-- Update the notification center popup and check if there are no notifications
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"notification_center:update::needed",
|
||||
function()
|
||||
if #nl == 0 then
|
||||
@@ -352,11 +356,11 @@ return function(s)
|
||||
notification_center.visible = false
|
||||
end
|
||||
|
||||
awesome.connect_signal("notification_center::block_mouse_events", function()
|
||||
capi.awesome.connect_signal("notification_center::block_mouse_events", function()
|
||||
notification_center:disconnect_signal("mouse::leave", mouse_leave)
|
||||
end)
|
||||
|
||||
awesome.connect_signal("notification_center::unblock_mouse_events", function()
|
||||
capi.awesome.connect_signal("notification_center::unblock_mouse_events", function()
|
||||
notification_center:connect_signal("mouse::leave", mouse_leave)
|
||||
end)
|
||||
|
||||
@@ -374,7 +378,7 @@ return function(s)
|
||||
for i = 0, size do
|
||||
nl[i] = nil
|
||||
end
|
||||
awesome.emit_signal("notification_center:update::needed")
|
||||
capi.awesome.emit_signal("notification_center:update::needed")
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
@@ -9,6 +9,10 @@ local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local naughty = require("naughty")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
|
||||
|
||||
@@ -226,7 +230,7 @@ function nl.create_notification(n)
|
||||
for i, b in pairs(nl.notification_list) do
|
||||
if b.pk == notification.pk then
|
||||
table.remove(nl.notification_list, math.tointeger(i))
|
||||
awesome.emit_signal("notification_center:update::needed")
|
||||
capi.awesome.emit_signal("notification_center:update::needed")
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -257,7 +261,7 @@ naughty.connect_signal(
|
||||
"request::display",
|
||||
function(n)
|
||||
nl.create_notification(n)
|
||||
awesome.emit_signal("notification_center:update::needed")
|
||||
capi.awesome.emit_signal("notification_center:update::needed")
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
|
||||
|
||||
@@ -18,7 +23,7 @@ return function(s)
|
||||
local function button_hover_effect(widget, svg, color, color2)
|
||||
local mouse_enter = function()
|
||||
widget.image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. svg, color2))
|
||||
local w = mouse.current_wibox
|
||||
local w = capi.mouse.current_wibox
|
||||
if w then
|
||||
w.cursor = "hand1"
|
||||
end
|
||||
@@ -26,8 +31,8 @@ return function(s)
|
||||
|
||||
local mouse_leave = function()
|
||||
widget.image = gears.surface.load_uncached(gears.color.recolor_image(icondir .. svg, color))
|
||||
mouse.cursor = "left_ptr"
|
||||
local w = mouse.current_wibox
|
||||
capi.mouse.cursor = "left_ptr"
|
||||
local w = capi.mouse.current_wibox
|
||||
if w then
|
||||
w.cursor = "left_ptr"
|
||||
end
|
||||
@@ -488,7 +493,7 @@ return function(s)
|
||||
}
|
||||
|
||||
-- get_spotify_metadata() on awesome reload
|
||||
awesome.connect_signal("startup", function()
|
||||
capi.awesome.connect_signal("startup", function()
|
||||
get_spotify_metadata(true)
|
||||
end)
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@ local wibox = require("wibox")
|
||||
|
||||
local rubato = require("src.lib.rubato")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/"
|
||||
|
||||
@@ -91,14 +95,14 @@ return function()
|
||||
}
|
||||
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::cpu_usage",
|
||||
function(cpu_usage)
|
||||
tooltip.text = "CPU Usage: " .. cpu_usage .. "%"
|
||||
@@ -169,13 +173,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::cpu_temp",
|
||||
function(cpu_temp)
|
||||
local temp_icon
|
||||
@@ -254,13 +258,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::ram_widget",
|
||||
function(MemTotal, _, MemAvailable)
|
||||
if not MemTotal or not MemAvailable then
|
||||
@@ -333,13 +337,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::gpu_usage",
|
||||
function(gpu_usage)
|
||||
tooltip.text = "GPU Usage: " .. gpu_usage .. "%"
|
||||
@@ -410,13 +414,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::gpu_temp",
|
||||
function(gpu_temp)
|
||||
local temp_icon
|
||||
@@ -505,13 +509,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"audio::get",
|
||||
function(muted, volume)
|
||||
local icon = icondir .. "audio/volume"
|
||||
@@ -602,13 +606,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"microphone::get",
|
||||
function(muted, volume)
|
||||
if not volume then
|
||||
@@ -658,7 +662,7 @@ return function()
|
||||
{
|
||||
{ --Icon
|
||||
id = "icon1",
|
||||
image = gears.color.recolor_image(icondir .. "brightness/brightness-high.svg" .. ".svg",
|
||||
image = gears.color.recolor_image(icondir .. "brightness/brightness-high.svg",
|
||||
Theme_config.notification_center.status_bar.backlight_color),
|
||||
halign = "center",
|
||||
valign = "center",
|
||||
@@ -692,19 +696,27 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
"update::backlight",
|
||||
function(backlight, backlight_icon)
|
||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(backlight_icon,
|
||||
Theme_config.notification_center.status_bar.backlight_color)
|
||||
tooltip.text = "Backlight: " .. backlight .. "%"
|
||||
rubato_timer.target = backlight
|
||||
capi.awesome.connect_signal(
|
||||
"brightness::get",
|
||||
function(brightness)
|
||||
local icon = icondir .. "brightness"
|
||||
if brightness >= 0 and brightness < 34 then
|
||||
icon = icon .. "-low"
|
||||
elseif brightness >= 34 and brightness < 67 then
|
||||
icon = icon .. "-medium"
|
||||
elseif brightness >= 67 then
|
||||
icon = icon .. "-high"
|
||||
end
|
||||
w:get_children_by_id("icon1")[1]:set_image(gears.color.recolor_image(icon .. ".svg",
|
||||
Theme_config.notification_center.status_bar.backlight_color))
|
||||
tooltip.text = "Backlight: " .. brightness .. "%"
|
||||
rubato_timer.target = brightness
|
||||
end
|
||||
)
|
||||
elseif widget == "battery" then
|
||||
@@ -771,13 +783,13 @@ return function()
|
||||
margins = dpi(10)
|
||||
}
|
||||
w:connect_signal("mouse::enter", function()
|
||||
awesome.emit_signal("notification_center::block_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::block_mouse_events")
|
||||
end)
|
||||
|
||||
w:connect_signal("mouse::leave", function()
|
||||
awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
capi.awesome.emit_signal("notification_center::unblock_mouse_events")
|
||||
end)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::battery_widget",
|
||||
function(battery, battery_icon)
|
||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(battery_icon,
|
||||
|
||||
@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/powermenu/"
|
||||
|
||||
@@ -117,26 +122,26 @@ return function(s)
|
||||
-- Create the power menu actions
|
||||
local suspend_command = function()
|
||||
awful.spawn("systemctl suspend")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
capi.awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
|
||||
local logout_command = function()
|
||||
awesome.quit()
|
||||
capi.awesome.quit()
|
||||
end
|
||||
|
||||
local lock_command = function()
|
||||
awful.spawn("dm-tool lock")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
capi.awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
|
||||
local shutdown_command = function()
|
||||
awful.spawn("shutdown now")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
capi.awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
|
||||
local reboot_command = function()
|
||||
awful.spawn("reboot")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
capi.awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
|
||||
-- Create the buttons with their command and name etc
|
||||
@@ -206,7 +211,7 @@ return function(s)
|
||||
{},
|
||||
3,
|
||||
function()
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
capi.awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
)
|
||||
)
|
||||
@@ -218,23 +223,23 @@ return function(s)
|
||||
stop_event = 'release',
|
||||
keypressed_callback = function(self, mod, key, command)
|
||||
if key == 'Escape' then
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
capi.awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
-- Signals
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"module::powermenu:show",
|
||||
function()
|
||||
if s == mouse.screen then
|
||||
if s == capi.mouse.screen then
|
||||
powermenu_container.visible = true
|
||||
powermenu_keygrabber:start()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"module::powermenu:hide",
|
||||
function()
|
||||
powermenu_keygrabber:stop()
|
||||
|
||||
@@ -8,8 +8,10 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local color = require("src.lib.color")
|
||||
local rubato = require("src.lib.rubato")
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
client = client
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/titlebar/"
|
||||
@@ -404,7 +406,7 @@ local create_titlebar_dialog_modal = function(c, size, position)
|
||||
)
|
||||
end
|
||||
|
||||
client.connect_signal(
|
||||
capi.client.connect_signal(
|
||||
"request::titlebars",
|
||||
function(c)
|
||||
if c.type == "dialog" then
|
||||
@@ -425,7 +427,7 @@ client.connect_signal(
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
capi.client.connect_signal(
|
||||
"property::floating",
|
||||
function(c)
|
||||
if c.floating and not (c.maximized or c.fullscreen) then
|
||||
|
||||
@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mousegrabber = mousegrabber,
|
||||
}
|
||||
|
||||
local rubato = require("src.lib.rubato")
|
||||
|
||||
-- Icon directory path
|
||||
@@ -55,12 +60,12 @@ return function(s)
|
||||
if key == 1 then
|
||||
if node then
|
||||
awful.spawn("./.config/awesome/src/scripts/vol.sh set_sink " .. node)
|
||||
awesome.emit_signal("update::bg_sink", node)
|
||||
capi.awesome.emit_signal("update::bg_sink", node)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::bg_sink",
|
||||
function(new_node)
|
||||
if node == new_node then
|
||||
@@ -97,7 +102,7 @@ return function(s)
|
||||
end
|
||||
end
|
||||
)
|
||||
awesome.emit_signal("update::bg_sink", node)
|
||||
capi.awesome.emit_signal("update::bg_sink", node)
|
||||
else
|
||||
device:connect_signal(
|
||||
"button::press",
|
||||
@@ -105,12 +110,12 @@ return function(s)
|
||||
if key == 1 then
|
||||
if node then
|
||||
awful.spawn("./.config/awesome/src/scripts/mic.sh set_source " .. node)
|
||||
awesome.emit_signal("update::bg_source", node)
|
||||
capi.awesome.emit_signal("update::bg_source", node)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"update::bg_source",
|
||||
function(new_node)
|
||||
if node == new_node then
|
||||
@@ -147,7 +152,7 @@ return function(s)
|
||||
end
|
||||
end
|
||||
)
|
||||
awesome.emit_signal("update::bg_source", node)
|
||||
capi.awesome.emit_signal("update::bg_source", node)
|
||||
end
|
||||
return device
|
||||
end
|
||||
@@ -595,14 +600,15 @@ return function(s)
|
||||
)
|
||||
end
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"audio::device_changed",
|
||||
function()
|
||||
get_input_devices()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
|
||||
"microphone::device_changed",
|
||||
function()
|
||||
get_source_devices()
|
||||
@@ -610,7 +616,8 @@ return function(s)
|
||||
)
|
||||
|
||||
-- Set the volume and icon
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
|
||||
"audio::get",
|
||||
function(muted, volume)
|
||||
if muted then
|
||||
@@ -642,12 +649,12 @@ return function(s)
|
||||
)
|
||||
|
||||
-- Get microphone volume
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"microphone::get",
|
||||
function(muted, volume)
|
||||
if muted then
|
||||
--volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(0))
|
||||
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir
|
||||
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir
|
||||
.. "microphone-off.svg", Theme_config.volume_controller.microphone_fg))
|
||||
else
|
||||
volume = tonumber(volume)
|
||||
@@ -670,10 +677,10 @@ return function(s)
|
||||
volume_controller_container:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
mousegrabber.run(
|
||||
capi.mousegrabber.run(
|
||||
function()
|
||||
awesome.emit_signal("volume_controller::toggle", s)
|
||||
mousegrabber.stop()
|
||||
capi.awesome.emit_signal("volume_controller::toggle", s)
|
||||
capi.mousegrabber.stop()
|
||||
return true
|
||||
end,
|
||||
"arrow"
|
||||
@@ -684,7 +691,7 @@ return function(s)
|
||||
volume_controller_container:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
mousegrabber.stop()
|
||||
capi.mousegrabber.stop()
|
||||
end
|
||||
)
|
||||
|
||||
@@ -694,8 +701,8 @@ return function(s)
|
||||
autostart = false,
|
||||
stop_event = 'release',
|
||||
keypressed_callback = function()
|
||||
awesome.emit_signal("volume_controller::toggle", s)
|
||||
mousegrabber.stop()
|
||||
capi.awesome.emit_signal("volume_controller::toggle", s)
|
||||
capi.mousegrabber.stop()
|
||||
end
|
||||
}
|
||||
|
||||
@@ -706,7 +713,7 @@ return function(s)
|
||||
}
|
||||
|
||||
-- Toggle container visibility
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"volume_controller::toggle",
|
||||
function(scr)
|
||||
if scr == s then
|
||||
|
||||
@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/"
|
||||
|
||||
@@ -70,7 +75,7 @@ return function(s)
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"audio::get",
|
||||
function(muted, volume)
|
||||
if muted then
|
||||
@@ -126,10 +131,10 @@ return function(s)
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"widget::volume_osd:rerun",
|
||||
function()
|
||||
if mouse.screen == s then
|
||||
if capi.mouse.screen == s then
|
||||
volume_container.visible = true
|
||||
if hide_volume_osd.started then
|
||||
hide_volume_osd:again()
|
||||
|
||||
@@ -8,6 +8,11 @@ local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse,
|
||||
}
|
||||
|
||||
local window_elements = require("src.modules.window_switcher.window_elements")()
|
||||
|
||||
return function(s)
|
||||
@@ -38,10 +43,10 @@ return function(s)
|
||||
layout = wibox.layout.fixed.vertical
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"toggle_window_switcher",
|
||||
function()
|
||||
if mouse.screen == s then
|
||||
if capi.mouse.screen == s then
|
||||
window_switcher_container.visible = not window_switcher_container.visible
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,6 +11,11 @@ local wibox = require("wibox")
|
||||
local color = require("src.lib.color")
|
||||
local rubato = require("src.lib.rubato")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
client = client,
|
||||
}
|
||||
|
||||
return function()
|
||||
|
||||
local elements = wibox.widget {
|
||||
@@ -26,11 +31,11 @@ return function()
|
||||
|
||||
elements:reset()
|
||||
|
||||
local clients = client.get()
|
||||
local clients = capi.client.get()
|
||||
local clients_sorted = {}
|
||||
|
||||
if client.focus then
|
||||
clients_sorted[1] = client.focus
|
||||
if capi.client.focus then
|
||||
clients_sorted[1] = capi.client.focus
|
||||
end
|
||||
|
||||
for _, client in ipairs(clients) do
|
||||
@@ -213,35 +218,35 @@ return function()
|
||||
|
||||
elements = create_elements()
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"window_switcher::select_next",
|
||||
function()
|
||||
elements = create_elements("next")
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"window_switcher::raise",
|
||||
function()
|
||||
elements = create_elements("raise")
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
capi.client.connect_signal(
|
||||
"manage",
|
||||
function()
|
||||
elements = create_elements()
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
capi.client.connect_signal(
|
||||
"unmanage",
|
||||
function()
|
||||
elements = create_elements()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
capi.awesome.connect_signal(
|
||||
"window_switcher::update",
|
||||
function()
|
||||
elements = create_elements()
|
||||
|
||||
Reference in New Issue
Block a user