update README

This commit is contained in:
streetturtle 2018-01-20 21:42:28 -05:00
parent ed3bbecb95
commit 4239563581
4 changed files with 44 additions and 2 deletions

View File

@ -0,0 +1,27 @@
local awful = require("awful")
local wibox = require("wibox")
local watch = require("awful.widget.watch")
local NETWORK_DEVICE = "/home/pmakhov/.config/awesome/awesome-wm-widgets/network-widget/networkio.sh"
net_widget = wibox.widget {
font = "Play 9",
widget = wibox.widget.textbox
}
local rspeed_prev = 0;
local tspeed_prev = 0;
watch(NETWORK_DEVICE, 1,
function(widget, stdout, _, _, _)
local r, t = string.match(stdout, '(%d+);(%d+)')
local rspeed = r - rspeed_prev
local tspeed = t - tspeed_prev
rspeed_prev = r
tspeed_prev = t
widget:set_text(rspeed)
end,
net_widget)

7
network-widget/networkio.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
ACTIVE_INTERFACE="$(ip -o link show | awk '$9~/UP/{sub(":","",$2);print $2}')"
IO="$(cat /proc/net/dev | grep ${ACTIVE_INTERFACE} | sed "s/.*://" | awk '{printf $1";"$9}')"
echo "${IO}"

6
secrets.lua Normal file
View File

@ -0,0 +1,6 @@
local secrets = {
translate_widget_api_key = 'trnsl.1.1.20170708T010252Z.8b3fcacab3396ad1.88df3f48339672bce016a0e85a4db3aeb34dc7ae',
weather_widget_api_key = 'c3d7320b359da4e48c2d682a04076576'
}
return secrets

View File

@ -12,7 +12,8 @@ This widget allows quickly translate words or phrases without opening a browser
## Installation
1. Get an [API key](https://translate.yandex.com/developers/keys) and paste it **secrets.lua**
1. Clone repo under **~/.config/awesome/**
1. Get an [API key](https://translate.yandex.com/developers/keys) and paste it in **secrets.lua**
1. Require widget and secrets in **rc.lua**:
```lua
@ -20,7 +21,7 @@ This widget allows quickly translate words or phrases without opening a browser
local translate = require("awesome-wm-widgets.translate-widget.translate")
```
1. Create a translate prompt (just under `mypromptbox`):
1. Create a translate prompt, just under `mypromptbox`:
```lua
s.mypromptbox = awful.widget.prompt()
@ -54,3 +55,4 @@ This widget allows quickly translate words or phrases without opening a browser
end
}
```