mirror of
https://github.com/don-philipe/knorke.git
synced 2025-11-08 22:57:03 +01:00
Compare commits
3 Commits
4fa74ea78c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f33155f3c | ||
|
|
d427081284 | ||
|
|
a7b10c63fa |
@@ -10,6 +10,7 @@ local gears = require("gears")
|
|||||||
local is_on
|
local is_on
|
||||||
local icon_dis
|
local icon_dis
|
||||||
local icon_enab
|
local icon_enab
|
||||||
|
local icon_conn
|
||||||
|
|
||||||
local widget = wibox.widget {
|
local widget = wibox.widget {
|
||||||
{
|
{
|
||||||
@@ -33,9 +34,10 @@ widget:buttons(awful.util.table.join(
|
|||||||
|
|
||||||
-- Add icons vor various BT states.
|
-- Add icons vor various BT states.
|
||||||
-- These icons should come as beautiful.icons
|
-- These icons should come as beautiful.icons
|
||||||
function widget.set_icons(disabled, enabled)
|
function widget.set_icons(disabled, enabled, connected)
|
||||||
icon_dis = disabled
|
icon_dis = disabled
|
||||||
icon_enab = enabled
|
icon_enab = enabled
|
||||||
|
icon_conn = connected
|
||||||
end
|
end
|
||||||
|
|
||||||
awful.tooltip(
|
awful.tooltip(
|
||||||
@@ -59,6 +61,7 @@ watch("bluetoothctl show", 5,
|
|||||||
function(_, stdout)
|
function(_, stdout)
|
||||||
-- Check if there bluetooth
|
-- Check if there bluetooth
|
||||||
local checker = stdout:match("Powered: yes") -- If 'Powered: yes' string is detected on stdout
|
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
|
local widget_icon_nme
|
||||||
if (checker ~= nil) then
|
if (checker ~= nil) then
|
||||||
is_on = true
|
is_on = true
|
||||||
|
|||||||
6
vpn.lua
6
vpn.lua
@@ -20,7 +20,7 @@ gears.timer {
|
|||||||
timeout = 10,
|
timeout = 10,
|
||||||
autostart = true,
|
autostart = true,
|
||||||
callback = function ()
|
callback = function ()
|
||||||
awful.spawn.easy_async_with_shell("ifconfig | grep \"tun.*:\"",
|
awful.spawn.easy_async_with_shell("ifconfig | grep \"tun.*:\\|wg.*:\"",
|
||||||
function (stdout, _, _, _)
|
function (stdout, _, _, _)
|
||||||
if (stdout == "") then
|
if (stdout == "") then
|
||||||
widget.icon:set_image(icon_vpn_noconn)
|
widget.icon:set_image(icon_vpn_noconn)
|
||||||
@@ -48,11 +48,11 @@ awful.tooltip(
|
|||||||
preferred_positions = { "right", "left", "top", "bottom" },
|
preferred_positions = { "right", "left", "top", "bottom" },
|
||||||
timer_function = function()
|
timer_function = function()
|
||||||
local num_vpnc_proc = awful.spawn.with_shell("ps aux | grep vpnc | wc -l")
|
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"
|
return "VPNC"
|
||||||
end
|
end
|
||||||
local num_openconnect_proc = awful.spawn.with_shell("ps aux | grep openconnect | wc -l")
|
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"
|
return "OPENCONNECT"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user