Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added right click for toggling bluetooth #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions awesome/widgets/bluetooth.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ widget_button:buttons(
function()
awful.spawn("blueman-manager")
end
),
awful.button({}, 3, nil,
function()
if checker ~= nil then
awful.spawn.easy_async_with_shell('bluetoothctl power off')
else
awful.spawn.easy_async_with_shell('bluetoothctl power on')
end
end
)
)
)
Expand All @@ -63,10 +72,10 @@ awful.tooltip(
)

local last_bluetooth_check = os.time()
watch("bluetoothctl --monitor list", 5,
watch("bluetoothctl show", 5,
function(_, stdout)
-- Check if there bluetooth
checker = stdout:match("Controller") -- If 'Controller' string is detected on stdout
checker = stdout:match("Powered: yes") -- If Controller powered: yes string is detected on stdout
local widget_icon_name
if (checker ~= nil) then
widget_icon_name = "bluetooth"
Expand Down