diff options
author | ache <ache@ache.one> | 2018-01-30 17:49:28 +0100 |
---|---|---|
committer | ache <ache@ache.one> | 2018-02-06 02:35:10 +0100 |
commit | f00909a034e159aa3573450ef35924efe4f2dac0 (patch) | |
tree | 6675d237632929f67ae5ae48098e53c49a679e41 | |
parent | Clean unused shortkut (diff) |
Add notification about disable notification
-rw-r--r-- | rc.lua | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -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), |