diff options
| author | delta <darkussdelta@gmail.com> | 2023-04-04 15:43:40 +0200 |
|---|---|---|
| committer | delta <darkussdelta@gmail.com> | 2023-04-04 15:43:40 +0200 |
| commit | f7116d268aff3fae88d8de408e8c807295618a5c (patch) | |
| tree | 6f52530d5799769e6af7c63bc5108f16f9aff742 /.config/awesome/services/wifi.lua | |
| parent | f0b32f45746c026d402651013b7e98315d6956a1 (diff) | |
restructure and improve config
Diffstat (limited to '.config/awesome/services/wifi.lua')
| -rw-r--r-- | .config/awesome/services/wifi.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/.config/awesome/services/wifi.lua b/.config/awesome/services/wifi.lua new file mode 100644 index 0000000..f6b67f1 --- /dev/null +++ b/.config/awesome/services/wifi.lua @@ -0,0 +1,23 @@ +local gtimer = require "gears.timer" + +gtimer { + timeout = 1, + call_now = true, + autostart = true, + callback = function() + local lines = {} + + for line in io.lines("/proc/net/wireless") do + table.insert(lines, line) + end + + if not lines[3] then + awesome.emit_signal("services::wifi", 0, false) + return + end + + local strength = lines[3]:match("^%s*(.*)"):match("^.-%s+.-%s+.-(%S+)%.") + + awesome.emit_signal("services::wifi", math.floor(tonumber(strength) * 10 / 7), true) + end +} |
