From f00909a034e159aa3573450ef35924efe4f2dac0 Mon Sep 17 00:00:00 2001 From: ache Date: Tue, 30 Jan 2018 17:49:28 +0100 Subject: Add notification about disable notification --- rc.lua | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/rc.lua b/rc.lua index d5a1255..6adee71 100644 --- a/rc.lua +++ b/rc.lua @@ -202,6 +202,9 @@ mynetworkwidget = wibox.widget.textbox ('') notify_bat = true +local lastIp = '' +local lastInt = '' + function act() vicious.force({ mpdwidget, }) --{{ Batterie notification @@ -259,12 +262,29 @@ function act() function(interface, stderr, reason, exit_code) if not ( interface == "" or interface == "\n") then interface = string.gsub(interface, "\n", "") + if not (interface == lastInt) then + naughty.notify({ preset = naughty.config.presets.normal, + title = "ip change", + text = "Changement d'interface " .. lastInt .. " to " + .. interface, + timeout=20}) + lastInt = interface + end + awful.spawn.easy_async("bash -c \"ip r | grep 'dev " .. interface .. "' | grep src | head -n 1 | sed 's/.*src/src/' | cut -d' ' -f 2 | cut -z -f1\"", function(ip, stderr2, reason3, exit_code3) toShow = "" if not ( ip == "" or ip == "\n") then ip = string.gsub(ip, "\n", "") toShow = ip .. "@" + if not (ip == lastIp) then + naughty.notify({ preset = naughty.config.presets.normal, + title = "ip route", + text = "Changement de route " .. lastIp .. + " to " .. ip, + timeout=20}) + lastIp = ip + end end awful.spawn.easy_async("bash -c \"iwconfig" .. interface .. "2>&1 | grep " .. interface .. " | cut -d'\\\"' -f 2 \"", function(essid, stderr2, reason2, exit_code2) @@ -640,7 +660,12 @@ awful.key({ modkey, "Shift" }, "s", hotkeys_popup.show_help, {descriptio {description = "Toogle Wibox", group = "awesome"}), awful.key({ modkey, "Shift" }, "t", function () blockWibox = not blockWibox end, {description = "Lock Wibox", group = "awesome"}), - awful.key({ modkey, "Shift" }, "b", function () notify_bat= not notify_bat end, + awful.key({ modkey, "Shift" }, "b", function () + notify_bat = not notify_bat + naughty.notify({ preset = naughty.config.presets.normal, timeout=1, + text = "Notification d'énergie : " .. ( notify_bat and "activée" or "désactivée" )}) + + end, {description = "Toggle battery warning", group = "awesome"}), awful.key({ modkey, "Control" }, "t", function () showHideWibox() end), -- cgit v1.2.3