Popup notification added
This commit is contained in:
parent
7d2752e3f3
commit
aa4c4b621a
|
@ -20,3 +20,20 @@ dbus.connect_signal("com.console.rate",
|
|||
local dbustext = data[2]
|
||||
rateWidget:set_text(dbustext)
|
||||
end)
|
||||
|
||||
-- The notification popup which shows rates for other currencies
|
||||
function showRatesPopup()
|
||||
naughty.notify({
|
||||
title = "Rates",
|
||||
text = awful.util.pread("python ~/.config/awesome/rates/ratesPopup.py"),
|
||||
icon = "/home/username/.config/awesome/rates/currency.png",
|
||||
icon_size = 100,
|
||||
timeout = 10,
|
||||
width = 300,
|
||||
padding = 100,
|
||||
fg = "#ffffff",
|
||||
bg = "#333333aa",
|
||||
})
|
||||
end
|
||||
|
||||
rateWidget:connect_signal("mouse::enter", function() showRatesPopup() end)
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import requests
|
||||
import json
|
||||
|
||||
r = requests.get("http://api.fixer.io/latest?symbols=USD,EUR,JPY,GBP,CHF,CAD,RUB")
|
||||
resp = json.loads(r.content)
|
||||
rates = resp["rates"]
|
||||
|
||||
for currency, rate in rates.items():
|
||||
print currency, rate
|
|
@ -1,3 +1,8 @@
|
|||
# Rates Widget
|
||||
|
||||
Widget for Awesome WM which displays the currency rate between Swiss Frank and Euro. For the rate API it uses [fixer.io](http://fixer.io/) - JSON API for foreign exchange rates and currency conversion. And a python script which calls this API.
|
||||
|
||||
You can read more about it in these posts:
|
||||
|
||||
- http://pavelmakhov.com/2016/01/how-to-create-widget/
|
||||
- http://pavelmakhov.com/2016/01/how-to-create-widget-part-2/
|
||||
|
|
Loading…
Reference in New Issue