Compare commits

...

3 Commits

Author SHA1 Message Date
don philipe
6f33155f3c Additional icon for bluetooth connected 2024-06-01 18:27:12 +02:00
don philipe
d427081284 Add wireguard interface detection 2024-03-29 14:09:40 +01:00
don philipe
a7b10c63fa Fix string to number conversion 2023-12-17 21:08:03 +01:00
2 changed files with 7 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ local gears = require("gears")
local is_on
local icon_dis
local icon_enab
local icon_conn
local widget = wibox.widget {
{
@@ -33,9 +34,10 @@ widget:buttons(awful.util.table.join(
-- Add icons vor various BT states.
-- These icons should come as beautiful.icons
function widget.set_icons(disabled, enabled)
function widget.set_icons(disabled, enabled, connected)
icon_dis = disabled
icon_enab = enabled
icon_conn = connected
end
awful.tooltip(
@@ -59,6 +61,7 @@ watch("bluetoothctl show", 5,
function(_, stdout)
-- Check if there bluetooth
local checker = stdout:match("Powered: yes") -- If 'Powered: yes' string is detected on stdout
-- TODO check for connection and set connected icon
local widget_icon_nme
if (checker ~= nil) then
is_on = true

View File

@@ -20,7 +20,7 @@ gears.timer {
timeout = 10,
autostart = true,
callback = function ()
awful.spawn.easy_async_with_shell("ifconfig | grep \"tun.*:\"",
awful.spawn.easy_async_with_shell("ifconfig | grep \"tun.*:\\|wg.*:\"",
function (stdout, _, _, _)
if (stdout == "") then
widget.icon:set_image(icon_vpn_noconn)
@@ -48,11 +48,11 @@ awful.tooltip(
preferred_positions = { "right", "left", "top", "bottom" },
timer_function = function()
local num_vpnc_proc = awful.spawn.with_shell("ps aux | grep vpnc | wc -l")
if (num_vpnc_proc > 1) then
if (tonumber(num_vpnc_proc) > 1) then
return "VPNC"
end
local num_openconnect_proc = awful.spawn.with_shell("ps aux | grep openconnect | wc -l")
if (num_openconnect_proc > 1) then
if (tonumber(num_openconnect_proc) > 1) then
return "OPENCONNECT"
end
end