From c4826fd21340d34e3592b0c8ca24fc068e52c6ef Mon Sep 17 00:00:00 2001 From: streetturtle Date: Mon, 30 Jan 2017 21:38:50 -0500 Subject: new widgets added --- RatesWidget/currency.png | Bin 19289 -> 0 bytes RatesWidget/rates.lua | 39 --------------------------------------- RatesWidget/rates.py | 9 --------- RatesWidget/ratesPopup.py | 11 ----------- RatesWidget/readme.md | 8 -------- 5 files changed, 67 deletions(-) delete mode 100644 RatesWidget/currency.png delete mode 100644 RatesWidget/rates.lua delete mode 100644 RatesWidget/rates.py delete mode 100644 RatesWidget/ratesPopup.py delete mode 100644 RatesWidget/readme.md (limited to 'RatesWidget') diff --git a/RatesWidget/currency.png b/RatesWidget/currency.png deleted file mode 100644 index 4c7dbce..0000000 Binary files a/RatesWidget/currency.png and /dev/null differ diff --git a/RatesWidget/rates.lua b/RatesWidget/rates.lua deleted file mode 100644 index 6fa2e47..0000000 --- a/RatesWidget/rates.lua +++ /dev/null @@ -1,39 +0,0 @@ -local wibox = require("wibox") -local awful = require("awful") - -rateWidget = wibox.widget.textbox() - --- DBus (Command are sent to Dbus, which prevents Awesome from freezŅƒ) -sleepTimerDbus = timer ({timeout = 1800}) -sleepTimerDbus:connect_signal ("timeout", - function () - awful.util.spawn_with_shell("dbus-send --session --dest=org.naquadah.awesome.awful /com/console/rate com.console.rate.rateWidget string:$(python ~/.config/awesome/rates/rates.py)" ) - end) -sleepTimerDbus:start() -sleepTimerDbus:emit_signal("timeout") - -dbus.request_name("session", "com.console.rate") -dbus.add_match("session", "interface='com.console.rate', member='rateWidget' " ) -dbus.connect_signal("com.console.rate", - function (...) - local data = {...} - 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) \ No newline at end of file diff --git a/RatesWidget/rates.py b/RatesWidget/rates.py deleted file mode 100644 index 9a12462..0000000 --- a/RatesWidget/rates.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/python - -import requests -import json - -r = requests.get("http://api.fixer.io/latest?symbols=CHF,EUR") -resp = json.loads(r.content) - -print resp["rates"]["CHF"] \ No newline at end of file diff --git a/RatesWidget/ratesPopup.py b/RatesWidget/ratesPopup.py deleted file mode 100644 index 4ac6cce..0000000 --- a/RatesWidget/ratesPopup.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/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 diff --git a/RatesWidget/readme.md b/RatesWidget/readme.md deleted file mode 100644 index d13bae1..0000000 --- a/RatesWidget/readme.md +++ /dev/null @@ -1,8 +0,0 @@ -# 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/ -- cgit v1.2.3