mirror of
https://github.com/don-philipe/knorke.git
synced 2026-06-09 20:03:14 +02:00
Compare commits
7 Commits
4fa74ea78c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 1404159cc4 | |||
| 5ee82345ed | |||
| 04541118c8 | |||
| 4c4dbb0efd | |||
| 6f33155f3c | |||
| d427081284 | |||
| a7b10c63fa |
+4
-1
@@ -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
|
||||||
|
|||||||
+60
@@ -0,0 +1,60 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
|
local gears = require("gears")
|
||||||
|
local vicious = require("vicious")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
|
||||||
|
local color = beautiful.bg_focus
|
||||||
|
|
||||||
|
local widget = wibox.widget {
|
||||||
|
{
|
||||||
|
id = "sep",
|
||||||
|
widget = wibox.widget.separator,
|
||||||
|
shape = gears.shape["parallelogram"],
|
||||||
|
color = color,
|
||||||
|
forced_width = 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = "icon",
|
||||||
|
widget = wibox.widget.imagebox,
|
||||||
|
resize = true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = "text",
|
||||||
|
widget = wibox.widget.textbox,
|
||||||
|
resize = true,
|
||||||
|
forced_width = 30,
|
||||||
|
align = "right"
|
||||||
|
},
|
||||||
|
layout = wibox.layout.align.horizontal
|
||||||
|
}
|
||||||
|
local container = wibox.container.margin(wibox.container.margin(widget, 3), 3)
|
||||||
|
local pkgs = ""
|
||||||
|
|
||||||
|
vicious.register(widget.text, vicious.widgets.pkg,
|
||||||
|
function (w, args)
|
||||||
|
pkgs = args[2]
|
||||||
|
return args[1]
|
||||||
|
end, 5, "Arch")
|
||||||
|
|
||||||
|
-- These icons should come as beautiful.icons
|
||||||
|
function container.set_icons(pacman)
|
||||||
|
widget.icon:set_image(pacman)
|
||||||
|
end
|
||||||
|
|
||||||
|
awful.tooltip(
|
||||||
|
{
|
||||||
|
objects = { widget },
|
||||||
|
mode = "outside",
|
||||||
|
align = "right",
|
||||||
|
fg = "white",
|
||||||
|
margin_leftright = 10,
|
||||||
|
margin_topbottom = 10,
|
||||||
|
timer_function = function()
|
||||||
|
return "Installable packages: \n" .. pkgs
|
||||||
|
end,
|
||||||
|
preferred_positions = {"right", "left", "top", "bottom"}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return container
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
local awful = require("awful")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
|
local gears = require("gears")
|
||||||
local vicious = require("vicious")
|
local vicious = require("vicious")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
|
|
||||||
@@ -6,10 +9,19 @@ local icon_excellent
|
|||||||
local icon_good
|
local icon_good
|
||||||
local icon_ok
|
local icon_ok
|
||||||
local icon_none
|
local icon_none
|
||||||
|
local color = beautiful.bg_focus
|
||||||
|
|
||||||
|
local info = {}
|
||||||
|
|
||||||
-- Create layout with widgets
|
-- Create layout with widgets
|
||||||
local widget = wibox.widget {
|
local widget = wibox.widget {
|
||||||
|
{
|
||||||
|
id = "sep",
|
||||||
|
widget = wibox.widget.separator,
|
||||||
|
shape = gears.shape["parallelogram"],
|
||||||
|
color = color,
|
||||||
|
forced_width = 8
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id = "icon",
|
id = "icon",
|
||||||
widget = wibox.widget.imagebox,
|
widget = wibox.widget.imagebox,
|
||||||
@@ -22,6 +34,8 @@ local widget = wibox.widget {
|
|||||||
},
|
},
|
||||||
layout = wibox.layout.align.horizontal
|
layout = wibox.layout.align.horizontal
|
||||||
}
|
}
|
||||||
|
local container = wibox.container.margin(wibox.container.margin(widget, 3), 3)
|
||||||
|
|
||||||
vicious.register(widget.text, vicious.widgets.wifi,
|
vicious.register(widget.text, vicious.widgets.wifi,
|
||||||
function (w, args)
|
function (w, args)
|
||||||
if args["{ssid}"] ~= "N/A" then
|
if args["{ssid}"] ~= "N/A" then
|
||||||
@@ -34,14 +48,15 @@ vicious.register(widget.text, vicious.widgets.wifi,
|
|||||||
else
|
else
|
||||||
widget.icon:set_image(icon_none)
|
widget.icon:set_image(icon_none)
|
||||||
end
|
end
|
||||||
|
info = args
|
||||||
else
|
else
|
||||||
widget.icon:set_image(icon_wifi)
|
widget.icon:set_image(icon_none)
|
||||||
end
|
end
|
||||||
return " " .. args["{ssid}"]
|
return " " .. args["{ssid}"]
|
||||||
end, 2, "wlp64s0")
|
end, 2, "wlp64s0")
|
||||||
|
|
||||||
-- Widget function that is available from the outside.
|
-- Widget function that is available from the outside.
|
||||||
function widget.set_icons(wifi, excellent, good, ok, none)
|
function container.set_icons(wifi, excellent, good, ok, none)
|
||||||
icon_wifi = wifi
|
icon_wifi = wifi
|
||||||
icon_excellent = excellent
|
icon_excellent = excellent
|
||||||
icon_good = good
|
icon_good = good
|
||||||
@@ -49,4 +64,25 @@ function widget.set_icons(wifi, excellent, good, ok, none)
|
|||||||
icon_none = none
|
icon_none = none
|
||||||
end
|
end
|
||||||
|
|
||||||
return widget
|
awful.tooltip(
|
||||||
|
{
|
||||||
|
objects = { widget },
|
||||||
|
mode = "outside",
|
||||||
|
align = "right",
|
||||||
|
fg = "white",
|
||||||
|
margin_leftright = 10,
|
||||||
|
margin_topbottom = 10,
|
||||||
|
timer_function = function()
|
||||||
|
if info["{ssid}"] ~= nil then
|
||||||
|
return info["{ssid}"] .. "\n Channel: " .. info["{chan}"] .. "\n Rate: " .. info["{rate}"] .. "Mb/s\n Frequency: " .. info["{freq}"] .. "MHz"
|
||||||
|
else
|
||||||
|
return "N/A"
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
preferred_positions = {"right", "left", "top", "bottom"}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return container
|
||||||
|
|
||||||
|
-- scan networks via `sudo iw dev wlp64s0 scan | grep SSID:`
|
||||||
|
|||||||
Reference in New Issue
Block a user