summaryrefslogtreecommitdiff
path: root/RatesWidget/rates.lua
blob: b170210d4ef24cc2dd2c23b7d78883080184c0e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)