]> git.madduck.net Git - etc/awesome.git/blobdiff - widgets/contrib/redshift.lua

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

no need to set naughty.config.defaults as preset, because it's implicit; closes #290
[etc/awesome.git] / widgets / contrib / redshift.lua
index 8a768fb8fac0cde959157f968dccad2fd6bae3c1..73cc100773197f17089116c2bdd5aac78c7fcefb 100644 (file)
@@ -26,7 +26,7 @@ function redshift:start()
 end
 
 function redshift:toggle()
-    async(string.format("%s -c 'ps -p %d -o pid='", awful.util.shell, redshift.pid), function(f)
+    async({ awful.util.shell, "-c", string.format("ps -p %d -o pid=", redshift.pid) }, function(f)
         if f and #f > 0 then -- redshift is running
             -- Sending -USR1 toggles redshift (See project website)
             execute("pkill -USR1 redshift")
@@ -46,7 +46,9 @@ end
 function redshift:attach(widget, fun)
     redshift.update_fun = fun or function() end
     if not redshift.pid then redshift:start() end
-    widget:buttons(awful.util.table.join(awful.button({}, 1, function () redshift:toggle() end)))
+    if widget then
+        widget:buttons(awful.util.table.join(awful.button({}, 1, function () redshift:toggle() end)))
+    end
 end
 
 return redshift