New Setup 📦
This commit is contained in:
parent
d16174b447
commit
415dbd08a1
10194 changed files with 1368647 additions and 4 deletions
43
home/.config/awesome/signals/bluetooth.lua
Normal file
43
home/.config/awesome/signals/bluetooth.lua
Normal file
|
@ -0,0 +1,43 @@
|
|||
-- emits bluetooth status
|
||||
-- listen, i know this is dumb but.. yeah.
|
||||
------------------------------------------
|
||||
|
||||
-- ("signal::bluetooth"), function(status(bool), service_status(bool))
|
||||
|
||||
|
||||
-- requirements
|
||||
local awful = require("awful")
|
||||
|
||||
-- update interval
|
||||
local update_interval = 1
|
||||
|
||||
|
||||
-- import bluetooth info
|
||||
local cmd = [[
|
||||
bash -c "
|
||||
bluetoothctl show | grep "Powered:" | awk '{ print $2 }'
|
||||
"
|
||||
]]
|
||||
|
||||
awful.widget.watch(cmd, update_interval, function(_, stdout)
|
||||
local output = string.gsub(stdout, '^%s*(.-)%s*$', '%1')
|
||||
local bluetooth_active = true
|
||||
local bluetooth_runnding_service
|
||||
|
||||
-- lets see if bluetooth.service is enabled
|
||||
awful.spawn.easy_async_with_shell("bash -c 'pgrep bluetooth'", function (lets_see)
|
||||
if lets_see == "" then
|
||||
bluetooth_runnding_service = false
|
||||
else
|
||||
bluetooth_runnding_service = true
|
||||
end
|
||||
end)
|
||||
|
||||
-- set output as above info
|
||||
if output == "no" then
|
||||
bluetooth_active = bluetooth_runnding_service
|
||||
end
|
||||
|
||||
-- emit (powered on?) , (is the proceess running?)
|
||||
awesome.emit_signal("signal::bluetooth", bluetooth_active, bluetooth_runnding_service)
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue