rewrote bluetooth to using the dbus, small changes to volume_controller, added more rubato animations
1
awesome/src/assets/icons/bluetooth/audio-card.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M2,7V8.5H3V17H4.5V7C3.7,7 2.8,7 2,7M6,7V7L6,16H7V17H14V16H22V7H6M17.5,9A2.5,2.5 0 0,1 20,11.5A2.5,2.5 0 0,1 17.5,14A2.5,2.5 0 0,1 15,11.5A2.5,2.5 0 0,1 17.5,9Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 454 B |
1
awesome/src/assets/icons/bluetooth/audio-headphones.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M12,1C7,1 3,5 3,10V17A3,3 0 0,0 6,20H9V12H5V10A7,7 0 0,1 12,3A7,7 0 0,1 19,10V12H15V20H18A3,3 0 0,0 21,17V10C21,5 16.97,1 12,1Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 422 B |
1
awesome/src/assets/icons/bluetooth/audio-headset.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M12,1C7,1 3,5 3,10V17A3,3 0 0,0 6,20H9V12H5V10A7,7 0 0,1 12,3A7,7 0 0,1 19,10V12H15V20H19V21H12V23H18A3,3 0 0,0 21,20V10C21,5 16.97,1 12,1Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 434 B |
1
awesome/src/assets/icons/bluetooth/camera-photo.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M4,5H7L9,3H15L17,5H20A2,2 0 0,1 22,7V19A2,2 0 0,1 20,21H4A2,2 0 0,1 2,19V7A2,2 0 0,1 4,5M13.09,9.45L11.05,12.18L12.6,14.25L11.73,14.91L9.27,11.64L6,16H18L13.09,9.45Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 460 B |
1
awesome/src/assets/icons/bluetooth/camera-video.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M4,4H7L9,2H15L17,4H20A2,2 0 0,1 22,6V18A2,2 0 0,1 20,20H4A2,2 0 0,1 2,18V6A2,2 0 0,1 4,4M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 518 B |
1
awesome/src/assets/icons/bluetooth/computer.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M4,6H20V16H4M20,18A2,2 0 0,0 22,16V6C22,4.89 21.1,4 20,4H4C2.89,4 2,4.89 2,6V16A2,2 0 0,0 4,18H0V20H24V18H20Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 404 B |
1
awesome/src/assets/icons/bluetooth/input-gaming.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M7.97,16L5,19C4.67,19.3 4.23,19.5 3.75,19.5A1.75,1.75 0 0,1 2,17.75V17.5L3,10.12C3.21,7.81 5.14,6 7.5,6H16.5C18.86,6 20.79,7.81 21,10.12L22,17.5V17.75A1.75,1.75 0 0,1 20.25,19.5C19.77,19.5 19.33,19.3 19,19L16.03,16H7.97M7,8V10H5V11H7V13H8V11H10V10H8V8H7M16.5,8A0.75,0.75 0 0,0 15.75,8.75A0.75,0.75 0 0,0 16.5,9.5A0.75,0.75 0 0,0 17.25,8.75A0.75,0.75 0 0,0 16.5,8M14.75,9.75A0.75,0.75 0 0,0 14,10.5A0.75,0.75 0 0,0 14.75,11.25A0.75,0.75 0 0,0 15.5,10.5A0.75,0.75 0 0,0 14.75,9.75M18.25,9.75A0.75,0.75 0 0,0 17.5,10.5A0.75,0.75 0 0,0 18.25,11.25A0.75,0.75 0 0,0 19,10.5A0.75,0.75 0 0,0 18.25,9.75M16.5,11.5A0.75,0.75 0 0,0 15.75,12.25A0.75,0.75 0 0,0 16.5,13A0.75,0.75 0 0,0 17.25,12.25A0.75,0.75 0 0,0 16.5,11.5Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 1006 B |
1
awesome/src/assets/icons/bluetooth/input-keyboard.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M19,10H17V8H19M19,13H17V11H19M16,10H14V8H16M16,13H14V11H16M16,17H8V15H16M7,10H5V8H7M7,13H5V11H7M8,11H10V13H8M8,8H10V10H8M11,11H13V13H11M11,8H13V10H11M20,5H4C2.89,5 2,5.89 2,7V17A2,2 0 0,0 4,19H20A2,2 0 0,0 22,17V7C22,5.89 21.1,5 20,5Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 529 B |
1
awesome/src/assets/icons/bluetooth/input-mouse.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M11,1.07C7.05,1.56 4,4.92 4,9H11M4,15A8,8 0 0,0 12,23A8,8 0 0,0 20,15V11H4M13,1.07V9H20C20,4.92 16.94,1.56 13,1.07Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 410 B |
1
awesome/src/assets/icons/bluetooth/input-tablet.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M19,18H5V6H19M21,4H3C1.89,4 1,4.89 1,6V18A2,2 0 0,0 3,20H21A2,2 0 0,0 23,18V6C23,4.89 22.1,4 21,4Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 393 B |
1
awesome/src/assets/icons/bluetooth/link-off.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.43 19.12,14.63 17.79,15L19.25,16.44C20.88,15.61 22,13.95 22,12A5,5 0 0,0 17,7M16,11H13.81L15.81,13H16V11M2,4.27L5.11,7.38C3.29,8.12 2,9.91 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12C3.9,10.41 5.11,9.1 6.66,8.93L8.73,11H8V13H10.73L13,15.27V17H14.73L18.74,21L20,19.74L3.27,3L2,4.27Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 642 B |
1
awesome/src/assets/icons/bluetooth/link.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 532 B |
1
awesome/src/assets/icons/bluetooth/menu-down.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M7,10L12,15L17,10H7Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 315 B |
1
awesome/src/assets/icons/bluetooth/menu-up.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M7,15L12,10L17,15H7Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 315 B |
1
awesome/src/assets/icons/bluetooth/multimedia-player.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M13,2.05V4.05C17.39,4.59 20.5,8.58 19.96,12.97C19.5,16.61 16.64,19.5 13,19.93V21.93C18.5,21.38 22.5,16.5 21.95,11C21.5,6.25 17.73,2.5 13,2.03V2.05M5.67,19.74C7.18,21 9.04,21.79 11,22V20C9.58,19.82 8.23,19.25 7.1,18.37L5.67,19.74M7.1,5.74C8.22,4.84 9.57,4.26 11,4.06V2.06C9.05,2.25 7.19,3 5.67,4.26L7.1,5.74M5.69,7.1L4.26,5.67C3,7.19 2.25,9.04 2.05,11H4.05C4.24,9.58 4.8,8.23 5.69,7.1M4.06,13H2.06C2.26,14.96 3.03,16.81 4.27,18.33L5.69,16.9C4.81,15.77 4.24,14.42 4.06,13M10,16.5L16,12L10,7.5V16.5Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 791 B |
1
awesome/src/assets/icons/bluetooth/network-wireless.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M12,3C7.79,3 3.7,4.41 0.38,7C4.41,12.06 7.89,16.37 12,21.5C16.08,16.42 20.24,11.24 23.65,7C20.32,4.41 16.22,3 12,3Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 410 B |
1
awesome/src/assets/icons/bluetooth/phone.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M17,19H7V5H17M17,1H7C5.89,1 5,1.89 5,3V21A2,2 0 0,0 7,23H17A2,2 0 0,0 19,21V3C19,1.89 18.1,1 17,1Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 393 B |
1
awesome/src/assets/icons/bluetooth/printer.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M18,3H6V7H18M19,12A1,1 0 0,1 18,11A1,1 0 0,1 19,10A1,1 0 0,1 20,11A1,1 0 0,1 19,12M16,19H8V14H16M19,8H5A3,3 0 0,0 2,11V17H6V21H18V17H22V11A3,3 0 0,0 19,8Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 449 B |
1
awesome/src/assets/icons/bluetooth/scanner.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M4.2,10.7L19.8,5L20.5,6.9L6.4,12H19A2,2 0 0,1 21,14V18A2,2 0 0,1 19,20H5A2,2 0 0,1 3,18V12.5C3,11.7 3.5,10.9 4.2,10.7M17,17H19V15H17V17M5,17H15V15H5V17Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 447 B |
1
awesome/src/assets/icons/bluetooth/television.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M21,17H3V5H21M21,3H3A2,2 0 0,0 1,5V17A2,2 0 0,0 3,19H8V21H16V19H21A2,2 0 0,0 23,17V5A2,2 0 0,0 21,3Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 395 B |
1
awesome/src/assets/icons/bluetooth/video-display.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M21,16H3V4H21M21,2H3C1.89,2 1,2.89 1,4V16A2,2 0 0,0 3,18H10V20H8V22H16V20H14V18H21A2,2 0 0,0 23,16V4C23,2.89 22.1,2 21,2Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 416 B |
1
awesome/src/assets/icons/bluetooth/watch.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M6,12A6,6 0 0,1 12,6A6,6 0 0,1 18,12A6,6 0 0,1 12,18A6,6 0 0,1 6,12M20,12C20,9.45 18.81,7.19 16.95,5.73L16,0H8L7.05,5.73C5.19,7.19 4,9.45 4,12C4,14.54 5.19,16.81 7.05,18.27L8,24H16L16.95,18.27C18.81,16.81 20,14.54 20,12Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 515 B |
@@ -28,16 +28,12 @@ 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 ~= "" and device.Name ~= nil then
|
if device.Name ~= nil or device.Alias ~= nil then
|
||||||
device_properties:connect_signal(function()
|
device_properties:connect_signal(function()
|
||||||
naughty.notification {
|
awesome.emit_signal("bluetooth::device_changed", device, battery)
|
||||||
title = "Bluetooth Device Connected",
|
|
||||||
message = device.Name,
|
|
||||||
icon = require("awful").util.getdir("config") .. "src/assets/icons/bluetooth/bluetooth.svg"
|
|
||||||
}
|
|
||||||
awesome.emit_signal("device_added", object_path, device, battery)
|
|
||||||
end, "PropertiesChanged")
|
end, "PropertiesChanged")
|
||||||
|
awesome.emit_signal("bluetooth::device_changed", device, battery)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -91,10 +87,16 @@ return function()
|
|||||||
"PropertiesChanged"
|
"PropertiesChanged"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
awesome.connect_signal(
|
||||||
|
"bluetooth::scan",
|
||||||
|
function()
|
||||||
|
Adapter:StartDiscovery()
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
AdapterProperties:connect_signal(
|
AdapterProperties:connect_signal(
|
||||||
function(data)
|
function(data)
|
||||||
if data.Powered ~= nil then
|
if data.Powered ~= nil then
|
||||||
awesome.emit_signal("state", data.Powered)
|
|
||||||
if data.Powered then
|
if data.Powered then
|
||||||
Adapter:StartDiscovery()
|
Adapter:StartDiscovery()
|
||||||
end
|
end
|
||||||
|
|||||||
500
awesome/src/modules/bluetooth_controller.lua
Normal file
@@ -0,0 +1,500 @@
|
|||||||
|
--------------------------------------
|
||||||
|
-- This is the bluetooth controller --
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
-- Awesome Libs
|
||||||
|
local awful = require("awful")
|
||||||
|
local color = require("src.theme.colors")
|
||||||
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
|
local gears = require("gears")
|
||||||
|
local naughty = require("naughty")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
|
||||||
|
local rubato = require("src.lib.rubato")
|
||||||
|
|
||||||
|
local icondir = awful.util.getdir("config") .. "src/assets/icons/bluetooth/"
|
||||||
|
|
||||||
|
return function(s)
|
||||||
|
|
||||||
|
local function create_device(device, battery)
|
||||||
|
local icon = device.Icon or "bluetooth-on"
|
||||||
|
local device_widget = wibox.widget {
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
image = gears.color.recolor_image(icondir .. icon .. ".svg", color["Purple200"]),
|
||||||
|
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 = device.Alias or device.Name,
|
||||||
|
id = "alias",
|
||||||
|
widget = wibox.widget.textbox
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text = "Connecting...",
|
||||||
|
id = "connecting",
|
||||||
|
visible = false,
|
||||||
|
font = user_vars.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)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, dpi(4))
|
||||||
|
end,
|
||||||
|
bg = color["Blue200"],
|
||||||
|
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 = color["Grey900"],
|
||||||
|
fg = color["LightBlue200"],
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(2),
|
||||||
|
id = "background",
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, 4)
|
||||||
|
end,
|
||||||
|
widget = wibox.container.background
|
||||||
|
}
|
||||||
|
|
||||||
|
--! using :Connect freezes awesome, either find a solution or switch to console commands
|
||||||
|
if device.Connected then
|
||||||
|
device_widget:get_children_by_id("con")[1].image = gears.color.recolor_image(icondir .. "link-off.svg", color["Grey900"])
|
||||||
|
device_widget:connect_signal(
|
||||||
|
"button::press",
|
||||||
|
function(c, d, e, key)
|
||||||
|
if key == 1 then
|
||||||
|
device:Disconnect()
|
||||||
|
awesome.emit_signal("bluetooth::connect", device)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
else
|
||||||
|
device_widget:get_children_by_id("con")[1].image = gears.color.recolor_image(icondir .. "link.svg", color["Grey900"])
|
||||||
|
device_widget:connect_signal(
|
||||||
|
"button::press",
|
||||||
|
function(c, d, e, key)
|
||||||
|
if key == 1 then
|
||||||
|
device:Connect()
|
||||||
|
awesome.emit_signal("bluetooth::disconnect", device)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
Hover_signal(device_widget, '#313131', color["LightBlue100"])
|
||||||
|
return device_widget
|
||||||
|
end
|
||||||
|
|
||||||
|
local connected_devices_list = wibox.widget {
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
step = dpi(50),
|
||||||
|
spacing = dpi(10),
|
||||||
|
layout = wibox.layout.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
|
||||||
|
},
|
||||||
|
id = "connected_device_background",
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(2),
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
|
||||||
|
end,
|
||||||
|
widget = wibox.container.background
|
||||||
|
}
|
||||||
|
|
||||||
|
local discovered_devices_list = wibox.widget {
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
spacing = dpi(10),
|
||||||
|
step = dpi(50),
|
||||||
|
layout = wibox.layout.overflow.vertical,
|
||||||
|
scrollbar_width = 0,
|
||||||
|
id = "discovered_device_list"
|
||||||
|
},
|
||||||
|
id = "margin",
|
||||||
|
margins = dpi(10),
|
||||||
|
widget = wibox.container.margin
|
||||||
|
},
|
||||||
|
id = "place",
|
||||||
|
height = dpi(200),
|
||||||
|
strategy = "max",
|
||||||
|
widget = wibox.container.constraint
|
||||||
|
},
|
||||||
|
id = "discovered_device_background",
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(2),
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
|
||||||
|
end,
|
||||||
|
widget = wibox.container.background
|
||||||
|
}
|
||||||
|
|
||||||
|
local bluetooth_container = wibox.widget {
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
resize = false,
|
||||||
|
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]),
|
||||||
|
widget = wibox.widget.imagebox,
|
||||||
|
id = "icon"
|
||||||
|
},
|
||||||
|
id = "center",
|
||||||
|
halign = "center",
|
||||||
|
valign = "center",
|
||||||
|
widget = wibox.container.place,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{
|
||||||
|
text = "Coupled 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 = color["Grey800"],
|
||||||
|
fg = color["Purple200"],
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, 4)
|
||||||
|
end,
|
||||||
|
widget = wibox.container.background
|
||||||
|
},
|
||||||
|
id = "connected_margin",
|
||||||
|
widget = wibox.container.margin
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = "connected_list",
|
||||||
|
widget = connected_devices_list,
|
||||||
|
forced_height = 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
resize = false,
|
||||||
|
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["LightBlueA200"]),
|
||||||
|
widget = wibox.widget.imagebox,
|
||||||
|
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 = color["Grey800"],
|
||||||
|
fg = color["Blue200"],
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, 4)
|
||||||
|
end,
|
||||||
|
widget = wibox.container.background
|
||||||
|
},
|
||||||
|
id = "discovered_margin",
|
||||||
|
top = dpi(10),
|
||||||
|
widget = wibox.container.margin
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = "discovered_list",
|
||||||
|
widget = discovered_devices_list,
|
||||||
|
forced_height = 0
|
||||||
|
},
|
||||||
|
id = "layout1",
|
||||||
|
layout = wibox.layout.fixed.vertical
|
||||||
|
},
|
||||||
|
id = "margin",
|
||||||
|
margins = dpi(15),
|
||||||
|
widget = wibox.container.margin
|
||||||
|
},
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, dpi(8))
|
||||||
|
end,
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(4),
|
||||||
|
bg = color["Grey900"],
|
||||||
|
id = "background",
|
||||||
|
widget = wibox.container.background
|
||||||
|
},
|
||||||
|
width = dpi(400),
|
||||||
|
strategy = "exact",
|
||||||
|
widget = wibox.container.constraint
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Main container
|
||||||
|
local bluetooth_controller_container = awful.popup {
|
||||||
|
widget = wibox.container.background,
|
||||||
|
ontop = true,
|
||||||
|
bg = color["Grey900"],
|
||||||
|
stretch = false,
|
||||||
|
visible = false,
|
||||||
|
screen = s,
|
||||||
|
placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(380), top = dpi(60) } }) end,
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, 12)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
local connected_devices, nearby_devices = {}, {}
|
||||||
|
|
||||||
|
-- function to check if a device is already in the list
|
||||||
|
local function is_device_in_list(device)
|
||||||
|
for i = 1, #connected_devices do
|
||||||
|
if connected_devices[i].Address == device.Address then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
awesome.connect_signal(
|
||||||
|
"bluetooth::device_changed",
|
||||||
|
function(device, battery)
|
||||||
|
if not is_device_in_list(device) then
|
||||||
|
-- add device and battery to list
|
||||||
|
if device.Paired then
|
||||||
|
table.insert(connected_devices, device)
|
||||||
|
else
|
||||||
|
table.insert(nearby_devices, device)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if (#connected_devices + #nearby_devices) > 0 then
|
||||||
|
local cd_list, dd_list = {}, {}
|
||||||
|
for _, d in pairs(connected_devices) do
|
||||||
|
if d.Paired then
|
||||||
|
table.insert(cd_list, create_device(d))
|
||||||
|
else
|
||||||
|
table.insert(dd_list, create_device(d))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _, d in pairs(nearby_devices) do
|
||||||
|
if d.Paired then
|
||||||
|
table.insert(cd_list, create_device(d, battery))
|
||||||
|
else
|
||||||
|
table.insert(dd_list, create_device(d, battery))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
connected_devices_list:get_children_by_id("connected_device_list")[1].children = cd_list
|
||||||
|
discovered_devices_list:get_children_by_id("discovered_device_list")[1].children = dd_list
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Variables for easier access and better readability
|
||||||
|
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
|
||||||
|
|
||||||
|
-- Click event for the microphone dropdown
|
||||||
|
connected_margin:connect_signal(
|
||||||
|
"button::press",
|
||||||
|
function()
|
||||||
|
local rubato_timer = rubato.timed {
|
||||||
|
duration = 0.4,
|
||||||
|
intro = 0.1,
|
||||||
|
outro = 0.1,
|
||||||
|
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 = (#connected_devices * 45) + ((#connected_devices - 1) * 10)
|
||||||
|
if size < 210 then
|
||||||
|
rubato_timer.target = dpi(size)
|
||||||
|
else
|
||||||
|
rubato_timer.target = dpi(210)
|
||||||
|
end
|
||||||
|
connected_margin.connected_bg.shape = function(cr, width, height)
|
||||||
|
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
|
||||||
|
end
|
||||||
|
connected.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Purple200"]))
|
||||||
|
else
|
||||||
|
rubato_timer.target = 0
|
||||||
|
connected_bg.shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, 4)
|
||||||
|
end
|
||||||
|
connected.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Variables for easier access and better readability
|
||||||
|
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
|
||||||
|
|
||||||
|
-- Click event for the microphone dropdown
|
||||||
|
discovered_margin:connect_signal(
|
||||||
|
"button::press",
|
||||||
|
function()
|
||||||
|
local rubato_timer = rubato.timed {
|
||||||
|
duration = 0.4,
|
||||||
|
intro = 0.1,
|
||||||
|
outro = 0.1,
|
||||||
|
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 = (#nearby_devices * dpi(45)) + ((#nearby_devices - 1) * dpi(10))
|
||||||
|
if size < 210 then
|
||||||
|
rubato_timer.target = dpi(size)
|
||||||
|
else
|
||||||
|
rubato_timer.target = dpi(20)
|
||||||
|
end
|
||||||
|
discovered_margin.discovered_bg.shape = function(cr, width, height)
|
||||||
|
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
|
||||||
|
end
|
||||||
|
discovered.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["LightBlue200"]))
|
||||||
|
else
|
||||||
|
rubato_timer.target = dpi(0)
|
||||||
|
discovered_bg.shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, 4)
|
||||||
|
end
|
||||||
|
discovered.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["LightBlue200"]))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
-- When the mouse leaves the popup it stops the mousegrabber and hides the popup.
|
||||||
|
bluetooth_controller_container:connect_signal(
|
||||||
|
"mouse::leave",
|
||||||
|
function()
|
||||||
|
mousegrabber.run(
|
||||||
|
function()
|
||||||
|
awesome.emit_signal("bluetooth_controller::toggle", s)
|
||||||
|
mousegrabber.stop()
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
"arrow"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
bluetooth_controller_container:connect_signal(
|
||||||
|
"mouse::enter",
|
||||||
|
function()
|
||||||
|
mousegrabber.stop()
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Draw the popup
|
||||||
|
bluetooth_controller_container:setup {
|
||||||
|
bluetooth_container,
|
||||||
|
layout = wibox.layout.fixed.horizontal
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Toggle container visibility
|
||||||
|
awesome.connect_signal(
|
||||||
|
"bluetooth_controller::toggle",
|
||||||
|
function(scr)
|
||||||
|
if scr == s then
|
||||||
|
bluetooth_controller_container.visible = not bluetooth_controller_container.visible
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
end
|
||||||
@@ -92,7 +92,7 @@ return function()
|
|||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::cpu_usage_widget",
|
"update::cpu_usage_widget",
|
||||||
function(cpu_usage)
|
function(cpu_usage)
|
||||||
w:get_children_by_id("progressbar1")[1].value = cpu_usage
|
--w:get_children_by_id("progressbar1")[1].value = cpu_usage
|
||||||
tooltip.text = "CPU Usage: " .. cpu_usage .. "%"
|
tooltip.text = "CPU Usage: " .. cpu_usage .. "%"
|
||||||
rubato_timer.target = cpu_usage
|
rubato_timer.target = cpu_usage
|
||||||
end
|
end
|
||||||
@@ -163,7 +163,7 @@ return function()
|
|||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::cpu_temp_widget",
|
"update::cpu_temp_widget",
|
||||||
function(cpu_temp, cpu_temp_icon)
|
function(cpu_temp, cpu_temp_icon)
|
||||||
w:get_children_by_id("progressbar1")[1].value = cpu_temp
|
--w:get_children_by_id("progressbar1")[1].value = cpu_temp
|
||||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(cpu_temp_icon, color["Blue200"])
|
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(cpu_temp_icon, color["Blue200"])
|
||||||
tooltip.text = "CPU Temp: " .. cpu_temp .. "°C"
|
tooltip.text = "CPU Temp: " .. cpu_temp .. "°C"
|
||||||
rubato_timer.target = cpu_temp
|
rubato_timer.target = cpu_temp
|
||||||
@@ -233,7 +233,7 @@ return function()
|
|||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::ram_widget",
|
"update::ram_widget",
|
||||||
function(ram_usage)
|
function(ram_usage)
|
||||||
w:get_children_by_id("progressbar1")[1].value = ram_usage
|
--w:get_children_by_id("progressbar1")[1].value = ram_usage
|
||||||
tooltip.text = "RAM Usage: " .. ram_usage .. "%"
|
tooltip.text = "RAM Usage: " .. ram_usage .. "%"
|
||||||
rubato_timer.target = ram_usage
|
rubato_timer.target = ram_usage
|
||||||
end
|
end
|
||||||
@@ -302,7 +302,7 @@ return function()
|
|||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::gpu_usage_widget",
|
"update::gpu_usage_widget",
|
||||||
function(gpu_usage)
|
function(gpu_usage)
|
||||||
w:get_children_by_id("progressbar1")[1].value = gpu_usage
|
--w:get_children_by_id("progressbar1")[1].value = gpu_usage
|
||||||
tooltip.text = "GPU Usage: " .. gpu_usage .. "%"
|
tooltip.text = "GPU Usage: " .. gpu_usage .. "%"
|
||||||
rubato_timer.target = gpu_usage
|
rubato_timer.target = gpu_usage
|
||||||
end
|
end
|
||||||
@@ -373,7 +373,7 @@ return function()
|
|||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::gpu_temp_widget",
|
"update::gpu_temp_widget",
|
||||||
function(gpu_temp, gpu_temp_icon)
|
function(gpu_temp, gpu_temp_icon)
|
||||||
w:get_children_by_id("progressbar1")[1].value = gpu_temp
|
--w:get_children_by_id("progressbar1")[1].value = gpu_temp
|
||||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(gpu_temp_icon, color["Green200"])
|
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(gpu_temp_icon, color["Green200"])
|
||||||
tooltip.text = "GPU Temp: " .. gpu_temp .. "°C"
|
tooltip.text = "GPU Temp: " .. gpu_temp .. "°C"
|
||||||
rubato_timer.target = gpu_temp
|
rubato_timer.target = gpu_temp
|
||||||
@@ -445,7 +445,7 @@ return function()
|
|||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::volume_widget",
|
"update::volume_widget",
|
||||||
function(volume, volume_icon)
|
function(volume, volume_icon)
|
||||||
w:get_children_by_id("progressbar1")[1].value = volume
|
--w:get_children_by_id("progressbar1")[1].value = volume
|
||||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(volume_icon, color["Yellow200"])
|
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(volume_icon, color["Yellow200"])
|
||||||
tooltip.text = "Volume: " .. volume .. "%"
|
tooltip.text = "Volume: " .. volume .. "%"
|
||||||
rubato_timer.target = volume
|
rubato_timer.target = volume
|
||||||
@@ -517,7 +517,7 @@ return function()
|
|||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::microphone_widget",
|
"update::microphone_widget",
|
||||||
function(microphone, microphone_icon)
|
function(microphone, microphone_icon)
|
||||||
w:get_children_by_id("progressbar1")[1].value = microphone
|
--w:get_children_by_id("progressbar1")[1].value = microphone
|
||||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(microphone_icon, color["Purple200"])
|
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(microphone_icon, color["Purple200"])
|
||||||
tooltip.text = "Microphone: " .. microphone .. "%"
|
tooltip.text = "Microphone: " .. microphone .. "%"
|
||||||
rubato_timer.target = microphone
|
rubato_timer.target = microphone
|
||||||
@@ -589,7 +589,7 @@ return function()
|
|||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::backlight_widget",
|
"update::backlight_widget",
|
||||||
function(backlight, backlight_icon)
|
function(backlight, backlight_icon)
|
||||||
w:get_children_by_id("progressbar1")[1].value = backlight
|
--w:get_children_by_id("progressbar1")[1].value = backlight
|
||||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(backlight_icon, color["Pink200"])
|
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(backlight_icon, color["Pink200"])
|
||||||
tooltip.text = "Backlight: " .. backlight .. "%"
|
tooltip.text = "Backlight: " .. backlight .. "%"
|
||||||
rubato_timer.target = backlight
|
rubato_timer.target = backlight
|
||||||
@@ -661,7 +661,7 @@ return function()
|
|||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::battery_widget",
|
"update::battery_widget",
|
||||||
function(battery, battery_icon)
|
function(battery, battery_icon)
|
||||||
w:get_children_by_id("progressbar1")[1].value = battery
|
--w:get_children_by_id("progressbar1")[1].value = battery
|
||||||
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(battery_icon, color["Purple200"])
|
w:get_children_by_id("icon1")[1].image = gears.color.recolor_image(battery_icon, color["Purple200"])
|
||||||
tooltip.text = "Battery: " .. battery .. "%"
|
tooltip.text = "Battery: " .. battery .. "%"
|
||||||
rubato_timer.target = battery
|
rubato_timer.target = battery
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ local dpi = require("beautiful").xresources.apply_dpi
|
|||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local naughty = require("naughty")
|
local naughty = require("naughty")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
require("src.core.signals")
|
|
||||||
|
local rubato = require("src.lib.rubato")
|
||||||
|
|
||||||
-- 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/"
|
||||||
@@ -23,145 +24,53 @@ return function(s)
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
{
|
id = "icon",
|
||||||
image = "",
|
resize = false,
|
||||||
id = "icon",
|
widget = wibox.widget.imagebox
|
||||||
resize = false,
|
|
||||||
widget = wibox.widget.imagebox
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text = name,
|
|
||||||
id = "node",
|
|
||||||
widget = wibox.widget.textbox
|
|
||||||
},
|
|
||||||
id = "device_layout",
|
|
||||||
layout = wibox.layout.align.horizontal
|
|
||||||
},
|
},
|
||||||
id = "device_margin",
|
spacing = dpi(10),
|
||||||
margins = dpi(5),
|
{
|
||||||
widget = wibox.container.margin
|
text = name,
|
||||||
|
id = "node",
|
||||||
|
widget = wibox.widget.textbox
|
||||||
|
},
|
||||||
|
id = "device_layout",
|
||||||
|
layout = wibox.layout.fixed.horizontal
|
||||||
},
|
},
|
||||||
id = "background",
|
id = "device_margin",
|
||||||
shape = function(cr, width, height)
|
margins = dpi(9),
|
||||||
gears.shape.rounded_rect(cr, width, height, 4)
|
widget = wibox.container.margin
|
||||||
end,
|
|
||||||
widget = wibox.container.background
|
|
||||||
},
|
},
|
||||||
margins = dpi(5),
|
id = "background",
|
||||||
widget = wibox.container.margin
|
bg = color["Grey900"],
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(2),
|
||||||
|
shape = function(cr, width, height)
|
||||||
|
gears.shape.rounded_rect(cr, width, height, 4)
|
||||||
|
end,
|
||||||
|
widget = wibox.container.background
|
||||||
}
|
}
|
||||||
|
|
||||||
if sink == true then
|
if sink == true then
|
||||||
device:connect_signal(
|
device:connect_signal(
|
||||||
"button::press",
|
"button::press",
|
||||||
function()
|
function()
|
||||||
if node then
|
if node then
|
||||||
awful.spawn.spawn("./.config/awesome/src/scripts/vol.sh set_sink " .. node)
|
awful.spawn("./.config/awesome/src/scripts/vol.sh set_sink " .. node)
|
||||||
end
|
end
|
||||||
|
awesome.emit_signal("update::bg_sink", node)
|
||||||
awesome.emit_signal("update::background:vol", node)
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
--#region Signal Functions
|
|
||||||
local old_wibox, old_cursor, old_bg, old_fg
|
|
||||||
local bg = ""
|
|
||||||
local fg = ""
|
|
||||||
local mouse_enter = function()
|
|
||||||
if bg then
|
|
||||||
old_bg = device.background.bg
|
|
||||||
device.background.bg = bg .. 'dd'
|
|
||||||
end
|
|
||||||
if fg then
|
|
||||||
old_fg = device.background.fg
|
|
||||||
device.background.fg = fg
|
|
||||||
end
|
|
||||||
local w = mouse.current_wibox
|
|
||||||
if w then
|
|
||||||
old_cursor, old_wibox = w.cursor, w
|
|
||||||
w.cursor = "hand1"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local button_press = function()
|
|
||||||
if bg then
|
|
||||||
if bg then
|
|
||||||
if string.len(bg) == 7 then
|
|
||||||
device.background.bg = bg .. 'bb'
|
|
||||||
else
|
|
||||||
device.background.bg = bg
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if fg then
|
|
||||||
device.background.fg = fg
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local button_release = function()
|
|
||||||
if bg then
|
|
||||||
if bg then
|
|
||||||
if string.len(bg) == 7 then
|
|
||||||
device.background.bg = bg .. 'dd'
|
|
||||||
else
|
|
||||||
device.background.bg = bg
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if fg then
|
|
||||||
device.background.fg = fg
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local mouse_leave = function()
|
|
||||||
if bg then
|
|
||||||
device.background.bg = old_bg
|
|
||||||
end
|
|
||||||
if fg then
|
|
||||||
device.background.fg = old_fg
|
|
||||||
end
|
|
||||||
if old_wibox then
|
|
||||||
old_wibox.cursor = old_cursor
|
|
||||||
old_wibox = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
device:connect_signal(
|
|
||||||
"mouse::enter",
|
|
||||||
mouse_enter
|
|
||||||
)
|
|
||||||
|
|
||||||
device:connect_signal(
|
|
||||||
"button::press",
|
|
||||||
button_press
|
|
||||||
)
|
|
||||||
|
|
||||||
device:connect_signal(
|
|
||||||
"button::release",
|
|
||||||
button_release
|
|
||||||
)
|
|
||||||
|
|
||||||
device:connect_signal(
|
|
||||||
"mouse::leave",
|
|
||||||
mouse_leave
|
|
||||||
)
|
|
||||||
--#endregion
|
|
||||||
|
|
||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::background:vol",
|
"update::bg_sink",
|
||||||
function(new_node)
|
function(new_node)
|
||||||
if node == new_node then
|
if node == new_node then
|
||||||
old_bg = color["Purple200"]
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg", color["Grey900"])
|
||||||
old_fg = color["Grey900"]
|
device.bg = color["Purple200"]
|
||||||
bg = color["Purple200"]
|
device.fg = color["Grey900"]
|
||||||
fg = color["Grey900"]
|
|
||||||
device.background:set_bg(color["Purple200"])
|
|
||||||
device.background:set_fg(color["Grey900"])
|
|
||||||
else
|
else
|
||||||
fg = color["Purple200"]
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg", color["Purple200"])
|
||||||
bg = color["Grey700"]
|
device.bg = color["Grey900"]
|
||||||
device.background:set_fg(color["Purple200"])
|
device.fg = color["Purple200"]
|
||||||
device.background:set_bg(color["Grey700"])
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -170,130 +79,40 @@ return function(s)
|
|||||||
function(stdout)
|
function(stdout)
|
||||||
local node_active = stdout:gsub("\n", "")
|
local node_active = stdout:gsub("\n", "")
|
||||||
if node == node_active then
|
if node == node_active then
|
||||||
bg = color["Purple200"]
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg", color["Grey900"])
|
||||||
fg = color["Grey900"]
|
device.bg = color["Purple200"]
|
||||||
device.background:set_bg(color["Purple200"])
|
device.fg = color["Grey900"]
|
||||||
device.background:set_fg(color["Grey900"])
|
|
||||||
else
|
else
|
||||||
fg = color["Purple200"]
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "headphones.svg", color["Purple200"])
|
||||||
bg = color["Grey700"]
|
device.bg = color["Grey900"]
|
||||||
device.background:set_fg(color["Purple200"])
|
device.fg = color["Purple200"]
|
||||||
device.background:set_bg(color["Grey700"])
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
awesome.emit_signal("update::bg_sink", node)
|
||||||
|
--Hover_signal(device, "#313131", color["Purple200"])
|
||||||
else
|
else
|
||||||
|
|
||||||
device:connect_signal(
|
device:connect_signal(
|
||||||
"button::press",
|
"button::press",
|
||||||
function()
|
function()
|
||||||
if node then
|
if node then
|
||||||
awful.spawn.spawn("./.config/awesome/src/scripts/mic.sh set_source " .. node)
|
awful.spawn("./.config/awesome/src/scripts/mic.sh set_source " .. node)
|
||||||
end
|
end
|
||||||
|
awesome.emit_signal("update::bg_source", node)
|
||||||
awesome.emit_signal("update::background:mic", node)
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
--#region Signal Functions
|
|
||||||
local old_wibox, old_cursor, old_bg, old_fg
|
|
||||||
local bg = ""
|
|
||||||
local fg = ""
|
|
||||||
local mouse_enter = function()
|
|
||||||
if bg then
|
|
||||||
old_bg = device.background.bg
|
|
||||||
device.background.bg = bg .. 'dd'
|
|
||||||
end
|
|
||||||
if fg then
|
|
||||||
old_fg = device.background.fg
|
|
||||||
device.background.fg = fg
|
|
||||||
end
|
|
||||||
local w = mouse.current_wibox
|
|
||||||
if w then
|
|
||||||
old_cursor, old_wibox = w.cursor, w
|
|
||||||
w.cursor = "hand1"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local button_press = function()
|
|
||||||
if bg then
|
|
||||||
if bg then
|
|
||||||
if string.len(bg) == 7 then
|
|
||||||
device.background.bg = bg .. 'bb'
|
|
||||||
else
|
|
||||||
device.background.bg = bg
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if fg then
|
|
||||||
device.background.fg = fg
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local button_release = function()
|
|
||||||
if bg then
|
|
||||||
if bg then
|
|
||||||
if string.len(bg) == 7 then
|
|
||||||
device.background.bg = bg .. 'dd'
|
|
||||||
else
|
|
||||||
device.background.bg = bg
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if fg then
|
|
||||||
device.background.fg = fg
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local mouse_leave = function()
|
|
||||||
if bg then
|
|
||||||
device.background.bg = old_bg
|
|
||||||
end
|
|
||||||
if fg then
|
|
||||||
device.background.fg = old_fg
|
|
||||||
end
|
|
||||||
if old_wibox then
|
|
||||||
old_wibox.cursor = old_cursor
|
|
||||||
old_wibox = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
device:connect_signal(
|
|
||||||
"mouse::enter",
|
|
||||||
mouse_enter
|
|
||||||
)
|
|
||||||
|
|
||||||
device:connect_signal(
|
|
||||||
"button::press",
|
|
||||||
button_press
|
|
||||||
)
|
|
||||||
|
|
||||||
device:connect_signal(
|
|
||||||
"button::release",
|
|
||||||
button_release
|
|
||||||
)
|
|
||||||
|
|
||||||
device:connect_signal(
|
|
||||||
"mouse::leave",
|
|
||||||
mouse_leave
|
|
||||||
)
|
|
||||||
--#endregion
|
|
||||||
|
|
||||||
awesome.connect_signal(
|
awesome.connect_signal(
|
||||||
"update::background:mic",
|
"update::bg_source",
|
||||||
function(new_node)
|
function(new_node)
|
||||||
if node == new_node then
|
if node == new_node then
|
||||||
old_bg = color["Blue200"]
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg", color["Grey900"])
|
||||||
old_fg = color["Grey900"]
|
device.bg = color["Blue200"]
|
||||||
bg = color["Blue200"]
|
device.fg = color["Grey900"]
|
||||||
fg = color["Grey900"]
|
|
||||||
device.background:set_bg(color["Blue200"])
|
|
||||||
device.background:set_fg(color["Grey900"])
|
|
||||||
else
|
else
|
||||||
fg = color["Blue200"]
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg", color["Blue200"])
|
||||||
bg = color["Grey700"]
|
device.bg = color["Grey900"]
|
||||||
device.background:set_fg(color["Blue200"])
|
device.fg = color["Blue200"]
|
||||||
device.background:set_bg(color["Grey700"])
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -302,18 +121,19 @@ return function(s)
|
|||||||
function(stdout)
|
function(stdout)
|
||||||
local node_active = stdout:gsub("\n", "")
|
local node_active = stdout:gsub("\n", "")
|
||||||
if node == node_active then
|
if node == node_active then
|
||||||
bg = color["Blue200"]
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg", color["Grey900"])
|
||||||
fg = color["Grey900"]
|
device.bg = color["Blue200"]
|
||||||
device.background:set_bg(color["Blue200"])
|
device.fg = color["Grey900"]
|
||||||
device.background:set_fg(color["Grey900"])
|
Hover_signal(device, "#313131", color["Blue200"])
|
||||||
else
|
else
|
||||||
fg = color["Blue200"]
|
device:get_children_by_id("icon")[1].image = gears.color.recolor_image(icondir .. "microphone.svg", color["Blue200"])
|
||||||
bg = color["Grey700"]
|
device.bg = color["Grey900"]
|
||||||
device.background:set_fg(color["Blue200"])
|
device.fg = color["Blue200"]
|
||||||
device.background:set_bg(color["Grey700"])
|
Hover_signal(device, "#313131", color["Blue200"])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
awesome.emit_signal("update::bg_source", node)
|
||||||
end
|
end
|
||||||
return device
|
return device
|
||||||
end
|
end
|
||||||
@@ -322,11 +142,26 @@ return function(s)
|
|||||||
local dropdown_list_volume = wibox.widget {
|
local dropdown_list_volume = wibox.widget {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
layout = wibox.layout.fixed.vertical,
|
{
|
||||||
id = "volume_device_list"
|
{
|
||||||
|
spacing = dpi(10),
|
||||||
|
layout = wibox.layout.overflow.vertical,
|
||||||
|
scrollbar_width = 0,
|
||||||
|
step = dpi(50),
|
||||||
|
id = "volume_device_list",
|
||||||
|
},
|
||||||
|
id = "margin",
|
||||||
|
margins = dpi(10),
|
||||||
|
widget = wibox.container.margin
|
||||||
|
},
|
||||||
|
id = "place",
|
||||||
|
height = dpi(200),
|
||||||
|
strategy = "max",
|
||||||
|
widget = wibox.container.constraint
|
||||||
},
|
},
|
||||||
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(2),
|
||||||
id = "volume_device_background",
|
id = "volume_device_background",
|
||||||
bg = color["Grey800"],
|
|
||||||
shape = function(cr, width, height)
|
shape = function(cr, width, height)
|
||||||
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
|
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
|
||||||
end,
|
end,
|
||||||
@@ -341,11 +176,26 @@ return function(s)
|
|||||||
local dropdown_list_microphone = wibox.widget {
|
local dropdown_list_microphone = wibox.widget {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
layout = wibox.layout.fixed.vertical,
|
{
|
||||||
id = "volume_device_list"
|
{
|
||||||
|
spacing = dpi(10),
|
||||||
|
layout = wibox.layout.overflow.vertical,
|
||||||
|
id = "volume_device_list",
|
||||||
|
scrollbar_width = 0,
|
||||||
|
step = dpi(50),
|
||||||
|
},
|
||||||
|
id = "margin",
|
||||||
|
margins = dpi(10),
|
||||||
|
widget = wibox.container.margin
|
||||||
|
},
|
||||||
|
id = "place",
|
||||||
|
height = dpi(200),
|
||||||
|
strategy = "max",
|
||||||
|
widget = wibox.container.constraint
|
||||||
},
|
},
|
||||||
id = "volume_device_background",
|
id = "volume_device_background",
|
||||||
bg = color["Grey800"],
|
border_color = color["Grey800"],
|
||||||
|
border_width = dpi(2),
|
||||||
shape = function(cr, width, height)
|
shape = function(cr, width, height)
|
||||||
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
|
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
|
||||||
end,
|
end,
|
||||||
@@ -404,7 +254,7 @@ return function(s)
|
|||||||
{
|
{
|
||||||
id = "volume_list",
|
id = "volume_list",
|
||||||
widget = dropdown_list_volume,
|
widget = dropdown_list_volume,
|
||||||
visible = false
|
forced_height = 0
|
||||||
},
|
},
|
||||||
-- Microphone selector
|
-- Microphone selector
|
||||||
{
|
{
|
||||||
@@ -451,7 +301,7 @@ return function(s)
|
|||||||
{
|
{
|
||||||
id = "mic_list",
|
id = "mic_list",
|
||||||
widget = dropdown_list_microphone,
|
widget = dropdown_list_microphone,
|
||||||
visible = false
|
forced_height = 0
|
||||||
},
|
},
|
||||||
-- Audio volume slider
|
-- Audio volume slider
|
||||||
{
|
{
|
||||||
@@ -558,17 +408,28 @@ return function(s)
|
|||||||
audio_selector_margin:connect_signal(
|
audio_selector_margin:connect_signal(
|
||||||
"button::press",
|
"button::press",
|
||||||
function()
|
function()
|
||||||
volume_list.visible = not volume_list.visible
|
local rubato_timer = rubato.timed {
|
||||||
if volume_list.visible then
|
duration = 0.4,
|
||||||
|
intro = 0.1,
|
||||||
|
outro = 0.1,
|
||||||
|
pos = volume_list.forced_height,
|
||||||
|
easing = rubato.linear,
|
||||||
|
subscribed = function(v)
|
||||||
|
volume_list.forced_height = v
|
||||||
|
end
|
||||||
|
}
|
||||||
|
if volume_list.forced_height == 0 then
|
||||||
|
rubato_timer.target = dpi(200)
|
||||||
audio_bg.shape = function(cr, width, height)
|
audio_bg.shape = function(cr, width, height)
|
||||||
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
|
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
|
||||||
end
|
end
|
||||||
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"]))
|
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Purple200"]))
|
||||||
else
|
else
|
||||||
|
rubato_timer.target = 0
|
||||||
audio_bg.shape = function(cr, width, height)
|
audio_bg.shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, 4)
|
gears.shape.rounded_rect(cr, width, height, 4)
|
||||||
end
|
end
|
||||||
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"]))
|
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -583,17 +444,28 @@ return function(s)
|
|||||||
mic_selector_margin:connect_signal(
|
mic_selector_margin:connect_signal(
|
||||||
"button::press",
|
"button::press",
|
||||||
function()
|
function()
|
||||||
mic_list.visible = not mic_list.visible
|
local rubato_timer = rubato.timed {
|
||||||
if mic_list.visible then
|
duration = 0.4,
|
||||||
|
intro = 0.1,
|
||||||
|
outro = 0.1,
|
||||||
|
pos = mic_list.forced_height,
|
||||||
|
easing = rubato.linear,
|
||||||
|
subscribed = function(v)
|
||||||
|
mic_list.forced_height = v
|
||||||
|
end
|
||||||
|
}
|
||||||
|
if mic_list.forced_height == 0 then
|
||||||
|
rubato_timer.target = dpi(200)
|
||||||
mic_selector_margin.mic_bg.shape = function(cr, width, height)
|
mic_selector_margin.mic_bg.shape = function(cr, width, height)
|
||||||
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
|
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
|
||||||
end
|
end
|
||||||
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"]))
|
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Blue200"]))
|
||||||
else
|
else
|
||||||
|
rubato_timer.target = 0
|
||||||
mic_bg.shape = function(cr, width, height)
|
mic_bg.shape = function(cr, width, height)
|
||||||
gears.shape.rounded_rect(cr, width, height, 4)
|
gears.shape.rounded_rect(cr, width, height, 4)
|
||||||
end
|
end
|
||||||
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"]))
|
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Blue200"]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -641,7 +513,7 @@ return function(s)
|
|||||||
[[ pactl list sinks | grep -E 'node.name|device.description|alsa.card_name' | awk '{gsub(/"/, ""); for(i = 1;i < NF;i++) printf $i " "; print $NF}' ]],
|
[[ pactl list sinks | grep -E 'node.name|device.description|alsa.card_name' | awk '{gsub(/"/, ""); for(i = 1;i < NF;i++) printf $i " "; print $NF}' ]],
|
||||||
|
|
||||||
function(stdout)
|
function(stdout)
|
||||||
local device_list = { layout = wibox.layout.fixed.vertical }
|
local device_list = {}
|
||||||
local was_alsa = false
|
local was_alsa = false
|
||||||
local node_names, alsa_names = {}, {}
|
local node_names, alsa_names = {}, {}
|
||||||
for val in stdout:gmatch("[^\n]+") do
|
for val in stdout:gmatch("[^\n]+") do
|
||||||
@@ -663,7 +535,7 @@ return function(s)
|
|||||||
for k = 1, #alsa_names, 1 do
|
for k = 1, #alsa_names, 1 do
|
||||||
device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], true)
|
device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], true)
|
||||||
end
|
end
|
||||||
dropdown_list_volume.volume_device_background.volume_device_list.children = device_list
|
dropdown_list_volume:get_children_by_id("volume_device_list")[1].children = device_list
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@@ -676,7 +548,7 @@ return function(s)
|
|||||||
[[ pactl list sources | grep -E "node.name|device.description|alsa.card_name" | awk '{gsub(/"/, ""); for(i = 1;i < NF;i++) printf $i " "; print $NF}' ]],
|
[[ pactl list sources | grep -E "node.name|device.description|alsa.card_name" | awk '{gsub(/"/, ""); for(i = 1;i < NF;i++) printf $i " "; print $NF}' ]],
|
||||||
|
|
||||||
function(stdout)
|
function(stdout)
|
||||||
local device_list = { layout = wibox.layout.fixed.vertical }
|
local device_list = {}
|
||||||
local was_alsa = false
|
local was_alsa = false
|
||||||
local node_names, alsa_names = {}, {}
|
local node_names, alsa_names = {}, {}
|
||||||
|
|
||||||
@@ -699,7 +571,7 @@ return function(s)
|
|||||||
for k = 1, #alsa_names, 1 do
|
for k = 1, #alsa_names, 1 do
|
||||||
device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], false)
|
device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], false)
|
||||||
end
|
end
|
||||||
dropdown_list_microphone.volume_device_background.volume_device_list.children = device_list
|
dropdown_list_microphone:get_children_by_id("volume_device_list")[1].children = device_list
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,13 +9,12 @@ local dpi = require("beautiful").xresources.apply_dpi
|
|||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local naughty = require("naughty")
|
local naughty = require("naughty")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
require("src.core.signals")
|
|
||||||
|
|
||||||
-- 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/"
|
||||||
|
|
||||||
-- Returns the bluetooth widget
|
-- Returns the bluetooth widget
|
||||||
return function()
|
return function(s)
|
||||||
local bluetooth_widget = wibox.widget {
|
local bluetooth_widget = wibox.widget {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -53,8 +52,12 @@ return function()
|
|||||||
|
|
||||||
bluetooth_widget:connect_signal(
|
bluetooth_widget:connect_signal(
|
||||||
"button::press",
|
"button::press",
|
||||||
function()
|
function(c, d, e, key)
|
||||||
awesome.emit_signal("toggle_bluetooth")
|
if key == 1 then
|
||||||
|
awesome.emit_signal("bluetooth_controller::toggle", s)
|
||||||
|
else
|
||||||
|
awesome.emit_signal("toggle_bluetooth")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||