[awesome] add redshift widget

legacy
Simon Bruder 2019-06-07 14:55:07 +00:00
parent d3d7da3456
commit 91dfcb40be
No known key found for this signature in database
GPG Key ID: 6F03E0000CC5B62F
4 changed files with 29 additions and 1 deletions

View File

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 131 B

View File

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 131 B

View File

@ -203,6 +203,7 @@ awful.screen.connect_for_each_screen(function(s)
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
wibox.widget.systray(),
widgets.redshift,
widgets.bluetooth,
widgets.netdown_icon,
widgets.netdown.widget,
@ -518,4 +519,3 @@ awful.util.spawn({"nm-applet"})
awful.util.spawn({"ibus-daemon", "-r", "--xim"})
awful.util.spawn({"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1"})
awful.util.spawn_with_shell("~/bin/spawn-once pasystray")
awful.util.spawn_with_shell("~/bin/spawn-once redshift-gtk")

View File

@ -110,4 +110,32 @@ widgets.bluetooth:buttons(
helpers.newtimer("bluetooth", 10, widgets.bluetooth.update)
widgets.redshift = wibox.widget.imagebox(iconsdir .. "redshift-on.png")
widgets.redshift.pid = nil
helpers.async_with_shell("ps x -o pid=,command=|grep -E 'redshift$' |cut -d' ' -f 1", function(pid)
if pid and #pid > 0 then
widgets.redshift.pid = tonumber(pid)
else
widgets.redshift.pid = awful.spawn.spawn({ "redshift" })
end
end)
widgets.redshift.active = true
widgets.redshift.toggle = function()
awful.spawn.spawn({ "kill", "-SIGUSR1", tostring(widgets.redshift.pid) })
widgets.redshift.active = not widgets.redshift.active
if widgets.redshift.active == true then
widgets.redshift:set_image(iconsdir .. "redshift-on.png")
else
widgets.redshift:set_image(iconsdir .. "redshift-off.png")
end
end
widgets.redshift:buttons(
table.join(
awful.button({ }, 1, widgets.redshift.toggle)
)
)
return widgets