Initial commit

This commit is contained in:
jorraan committed 2021-11-29 19:57:00 +11:00
1 parent ed88af090f
commit 05c9c7fc71
448 files changed
+46802

No files matched your search

@@ -0,0 +1,35 @@
local wibox = require('wibox')
function build(widget)
local container =
wibox.widget {
widget,
widget = wibox.container.background,
}
local old_cursor, old_wibox
container:connect_signal(
'mouse::enter',
function()
-- Hm, no idea how to get the wibox from this signal's arguments...
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = 'hand1'
end
end
)
container:connect_signal(
'mouse::leave',
function()
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
end
end
)
return container
end
return build
@@ -0,0 +1,5 @@
<?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" baseProfile="full" width="240" height="240" viewBox="0 0 24.00 24.00" enable-background="new 0 0 24.00 24.00" xml:space="preserve">
<path fill="#ffffff" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 12.9975,5.83L 14.8775,7.71L 13.2813,9.31125L 14.6925,10.7175L 17.71,7.7L 12.0025,2.0025L 11.0013,2.0025L 11.0013,7.03125L 12.9975,9.02875M 5.41,3.99875L 3.99875,5.41L 10.5912,12.0025L 5,17.5875L 6.41125,18.9988L 11.0013,14.4088L 11.0013,22.0025L 12.0025,22.0025L 16.2887,17.71L 18.5888,20L 20,18.5887M 12.9975,18.1687L 12.9975,14.4088L 14.8775,16.2888"/>
</svg>
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="240"
height="240"
viewBox="0 0 240 240"
version="1.1"
id="svg4"
sodipodi:docname="ic_sync_48px.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1321"
inkscape:window-height="740"
id="namedview6"
showgrid="false"
inkscape:pagecheckerboard="true"
inkscape:zoom="0.61458333"
inkscape:cx="-276.66458"
inkscape:cy="-76.310045"
inkscape:window-x="45"
inkscape:window-y="28"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" />
<path
d="M 120,47.272727 V 20 L 83.636361,56.363636 120,92.72727 V 65.454545 c 30.13636,0 54.54545,24.409095 54.54545,54.545455 0,9.22727 -2.31818,17.86364 -6.31818,25.5 l 13.27272,13.27273 C 188.54545,147.5 192.72727,134.27273 192.72727,120 192.72727,79.818182 160.18181,47.272727 120,47.272727 Z m 0,127.272723 c -30.136366,0 -54.545457,-24.40909 -54.545457,-54.54545 0,-9.22727 2.318182,-17.86364 6.318182,-25.5 L 58.499998,81.227273 C 51.454543,92.5 47.272725,105.72727 47.272725,120 c 0,40.18182 32.545455,72.72727 72.727275,72.72727 V 220 L 156.36363,183.63636 120,147.27273 Z"
id="path2"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke-width:4.5454545" />
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

@@ -0,0 +1,164 @@
local awful = require('awful')
local wibox = require('wibox')
local gears = require('gears')
local naughty = require('naughty')
local watch = awful.widget.watch
local dpi = require('beautiful').xresources.apply_dpi
local clickable_container = require('widget.bluetooth-toggle.clickable-container')
local config_dir = gears.filesystem.get_configuration_dir()
local widget_icon_dir = config_dir .. 'widget/bluetooth-toggle/icons/'
local icons = require('theme.icons')
local device_state = false
local action_name = wibox.widget {
text = 'Bluetooth Connection',
font = 'Inter Regular 11',
align = 'left',
widget = wibox.widget.textbox
}
local button_widget = wibox.widget {
{
id = 'icon',
image = icons.toggled_off,
widget = wibox.widget.imagebox,
resize = true
},
layout = wibox.layout.align.horizontal
}
local widget_button = wibox.widget {
{
button_widget,
top = dpi(7),
bottom = dpi(7),
widget = wibox.container.margin
},
widget = clickable_container
}
local action_widget = wibox.widget {
{
action_name,
nil,
{
widget_button,
layout = wibox.layout.fixed.horizontal,
},
layout = wibox.layout.align.horizontal,
},
left = dpi(24),
right = dpi(24),
forced_height = dpi(48),
widget = wibox.container.margin
}
local update_imagebox = function()
if device_state then
button_widget.icon:set_image(icons.toggled_on)
else
button_widget.icon:set_image(icons.toggled_off)
end
end
local check_device_state = function()
awful.spawn.easy_async_with_shell(
'rfkill list bluetooth',
function(stdout)
if stdout:match('Soft blocked: yes') then
device_state = false
else
device_state = true
end
update_imagebox()
end
)
end
check_device_state()
local power_on_cmd = [[
rfkill unblock bluetooth
# Create an AwesomeWM Notification
awesome-client "
naughty = require('naughty')
naughty.notification({
app_name = 'Bluetooth Manager',
title = 'System Notification',
message = 'Initializing bluetooth device...',
icon = ']] .. widget_icon_dir .. 'loading' .. '.svg' .. [['
})
"
# Add a delay here so we can enable the bluetooth
sleep 1
bluetoothctl power on
]]
local power_off_cmd = [[
bluetoothctl power off
rfkill block bluetooth
# Create an AwesomeWM Notification
awesome-client "
naughty = require('naughty')
naughty.notification({
app_name = 'Bluetooth Manager',
title = 'System Notification',
message = 'The bluetooth device has been disabled.',
icon = ']] .. widget_icon_dir .. 'bluetooth-off' .. '.svg' .. [['
})
"
]]
local toggle_action = function()
if device_state then
device_state = false
awful.spawn.easy_async_with_shell(
power_off_cmd,
function(stdout)
update_imagebox()
end
)
else
device_state = true
awful.spawn.easy_async_with_shell(
power_on_cmd,
function(stdout)
update_imagebox()
end
)
end
end
widget_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
toggle_action()
end
)
)
)
watch(
'rfkill list bluetooth',
5,
function(_, stdout)
check_device_state()
collectgarbage('collect')
end
)
return action_widget