]> git.madduck.net Git - etc/awesome.git/commitdiff

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:

lain is now as asynchronous as possible
authorcopycat-killer <dada@archlinux.info>
Mon, 23 Jan 2017 22:03:13 +0000 (23:03 +0100)
committercopycat-killer <dada@archlinux.info>
Mon, 23 Jan 2017 22:03:13 +0000 (23:03 +0100)
widgets/calendar.lua
widgets/contrib/kbdlayout.lua
widgets/contrib/moc.lua
widgets/contrib/redshift.lua
widgets/contrib/task.lua
widgets/fs.lua
widgets/mpd.lua
widgets/net.lua
wiki

index e4216e4056953d7620f4a73944478bb2d2f18a74..7988ba26f60caa96a9978d8fcbfaa164b952b1d8 100644 (file)
@@ -67,7 +67,7 @@ function calendar.show(t_out, inc_offset, scr)
         calendar.notification_preset.screen = src or 1
     end
 
         calendar.notification_preset.screen = src or 1
     end
 
-    async(string.format("%s -c '%s'", awful.util.shell, f), function(ws)
+    async(f, function(ws)
         fg, bg = calendar.notification_preset.fg, calendar.notification_preset.bg
         ws = ws:gsub("%c%[7m%d+%c%[27m", markup.bold(markup.color(bg, fg, today)))
         calendar.notification = naughty.notify({
         fg, bg = calendar.notification_preset.fg, calendar.notification_preset.bg
         ws = ws:gsub("%c%[7m%d+%c%[27m", markup.bold(markup.color(bg, fg, today)))
         calendar.notification = naughty.notify({
@@ -94,7 +94,7 @@ function calendar.attach(widget, args)
     end
 
     if widget then
     end
 
     if widget then
-        widget:connect_signal("mouse::enter", function () calendar.show() end)
+        widget:connect_signal("mouse::enter", function () calendar.show(0) end)
         widget:connect_signal("mouse::leave", function () calendar.hide() end)
         widget:buttons(awful.util.table.join(awful.button({ }, 1, function ()
                                                  calendar.show(0, -1, calendar.scr_pos) end),
         widget:connect_signal("mouse::leave", function () calendar.hide() end)
         widget:buttons(awful.util.table.join(awful.button({ }, 1, function ()
                                                  calendar.show(0, -1, calendar.scr_pos) end),
index 3b514c5d01db47c4d9281b2d1360e32e32bf98e0..da3084c0e1131f70285ca3ded36a6612980e21b5 100644 (file)
@@ -38,8 +38,7 @@ local function worker(args)
    end
 
    function kbdlayout.update()
    end
 
    function kbdlayout.update()
-      helpers.async(string.format("%s -c 'setxkbmap -query'", awful.util.shell),
-      function(status)
+      helpers.async("setxkbmap -query", function(status)
           kbd_run_settings(string.match(status, "layout:%s*([^\n]*)"),
           string.match(status, "variant:%s*([^\n]*)"))
       end)
           kbd_run_settings(string.match(status, "layout:%s*([^\n]*)"),
           string.match(status, "variant:%s*([^\n]*)"))
       end)
index 44f46a66ef1ff21fe4d77e3427bc05d7298b11cc..d2f544f6b4f7a3c12c44922b0ad5962ab6d59f7a 100644 (file)
@@ -79,8 +79,8 @@ local function worker(args)
                     }
 
                     local path   = string.format("%s/%s", music_dir, string.match(moc_now.file, ".*/"))
                     }
 
                     local path   = string.format("%s/%s", music_dir, string.match(moc_now.file, ".*/"))
-                    local cover  = string.format("%s -c \"find '%s' -maxdepth 1 -type f | egrep -i -m1 '%s'\"", shell, path, cover_pattern)
-                    helpers.async(cover, function(current_icon)
+                    local cover  = string.format("find '%s' -maxdepth 1 -type f | egrep -i -m1 '%s'", path, cover_pattern)
+                    helpers.async({ shell, "-c", cover }, function(current_icon)
                         common.icon = current_icon:gsub("\n", "")
                         moc.id = naughty.notify(common).id
                     end)
                         common.icon = current_icon:gsub("\n", "")
                         moc.id = naughty.notify(common).id
                     end)
index fdda61f8ac1a67cb409235053c1685c25afd6e94..73cc100773197f17089116c2bdd5aac78c7fcefb 100644 (file)
@@ -26,7 +26,7 @@ function redshift:start()
 end
 
 function redshift:toggle()
 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")
         if f and #f > 0 then -- redshift is running
             -- Sending -USR1 toggles redshift (See project website)
             execute("pkill -USR1 redshift")
index 2f57317d70a58e3ccb6da56e5b77f37aa3e26ced..4325437fe11dbf4a210a27d2082b86c91f53d2af 100644 (file)
@@ -30,11 +30,10 @@ function task.show(scr)
         task.notification_preset.screen = scr
     end
 
         task.notification_preset.screen = scr
     end
 
-    helpers.async(string.format("%s -c '%s'", awful.util.shell, task.cmd),
-    function(f)
+    helpers.async(task.show_cmd, function(f)
         task.notification = naughty.notify({
             preset = task_notification_preset,
         task.notification = naughty.notify({
             preset = task_notification_preset,
-            title  = task.cmd,
+            title  = task.show_cmd,
             text   = markup.font(task.notification_preset.font,
                      awful.util.escape(f:gsub("\n*$", "")))
         })
             text   = markup.font(task.notification_preset.font,
                      awful.util.escape(f:gsub("\n*$", "")))
         })
@@ -46,10 +45,9 @@ function task.prompt()
         prompt       = task.prompt_text,
         textbox      = awful.screen.focused().mypromptbox.widget,
         exe_callback = function(t)
         prompt       = task.prompt_text,
         textbox      = awful.screen.focused().mypromptbox.widget,
         exe_callback = function(t)
-            helpers.async(string.format("%s -c '%s'", awful.util.shell, t),
-            function(f)
+            helpers.async(t, function(f)
                 naughty.notify {
                 naughty.notify {
-                    preset = task_notification_preset,
+                    preset = task.notification_preset,
                     title    = t,
                     text     = markup.font(task.notification_preset.font,
                                awful.util.escape(f:gsub("\n*$", "")))
                     title    = t,
                     text     = markup.font(task.notification_preset.font,
                                awful.util.escape(f:gsub("\n*$", "")))
@@ -62,7 +60,7 @@ end
 
 function task.attach(widget, args)
     local args               = args or {}
 
 function task.attach(widget, args)
     local args               = args or {}
-    task.show_cmd            = args.cmd or "task"
+    task.show_cmd            = args.show_cmd or "task next"
     task.prompt_text         = args.prompt_text or "Enter task command: "
     task.followtag           = args.followtag or false
     task.notification_preset = args.notification_preset
     task.prompt_text         = args.prompt_text or "Enter task command: "
     task.followtag           = args.followtag or false
     task.notification_preset = args.notification_preset
index 3a97d4cec93fd315e609ee38e5c3839e7ab6c8eb..eda3ffcdb9c8dc80a67ff5655074a83ceefd99e4 100644 (file)
@@ -76,7 +76,7 @@ local function worker(args)
 
     function update()
         fs_info, fs_now  = {}, {}
 
     function update()
         fs_info, fs_now  = {}, {}
-        helpers.async(string.format("%s -c 'LC_ALL=C df -k --output=target,size,used,avail,pcent'", shell), function(f)
+        helpers.async({ shell, "-c", "LC_ALL=C df -k --output=target,size,used,avail,pcent" }, function(f)
             for line in string.gmatch(f, "\n[^\n]+") do
                 local m,s,u,a,p = string.match(line, "(/.-%s).-(%d+).-(%d+).-(%d+).-([%d]+)%%")
                 m = m:gsub(" ", "") -- clean target from any whitespace
             for line in string.gmatch(f, "\n[^\n]+") do
                 local m,s,u,a,p = string.match(line, "(/.-%s).-(%d+).-(%d+).-(%d+).-([%d]+)%%")
                 m = m:gsub(" ", "") -- clean target from any whitespace
index 6011e0327aa27a222286484797efe657ccc5a742..02b56808972f12ed52f98fe1238871fdabaef9c4 100644 (file)
@@ -39,14 +39,14 @@ local function worker(args)
 
     local mpdh = string.format("telnet://%s:%s", host, port)
     local echo = string.format("printf \"%sstatus\\ncurrentsong\\nclose\\n\"", password)
 
     local mpdh = string.format("telnet://%s:%s", host, port)
     local echo = string.format("printf \"%sstatus\\ncurrentsong\\nclose\\n\"", password)
-    local cmd  = string.format("%s -c '%s | curl --connect-timeout 1 -fsm 3 %s'", shell, echo, mpdh)
+    local cmd  = string.format("%s | curl --connect-timeout 1 -fsm 3 %s", echo, mpdh)
 
     mpd_notification_preset = { title = "Now playing", timeout = 6 }
 
     helpers.set_map("current mpd track", nil)
 
     function mpd.update()
 
     mpd_notification_preset = { title = "Now playing", timeout = 6 }
 
     helpers.set_map("current mpd track", nil)
 
     function mpd.update()
-        helpers.async(cmd, function(f)
+        helpers.async({ shell, "-c", cmd }, function(f)
             mpd_now = {
                 random_mode  = false,
                 single_mode  = false,
             mpd_now = {
                 random_mode  = false,
                 single_mode  = false,
@@ -110,8 +110,8 @@ local function worker(args)
 
                     if not string.match(mpd_now.file, "http.*://") then -- local file instead of http stream
                         local path   = string.format("%s/%s", music_dir, string.match(mpd_now.file, ".*/"))
 
                     if not string.match(mpd_now.file, "http.*://") then -- local file instead of http stream
                         local path   = string.format("%s/%s", music_dir, string.match(mpd_now.file, ".*/"))
-                        local cover  = string.format("%s -c \"find '%s' -maxdepth 1 -type f | egrep -i -m1 '%s'\"", shell, path, cover_pattern)
-                        helpers.async(cover, function(current_icon)
+                        local cover  = string.format("find '%s' -maxdepth 1 -type f | egrep -i -m1 '%s'", path, cover_pattern)
+                        helpers.async({ shell, "-c", cover }, function(current_icon)
                             common.icon = current_icon:gsub("\n", "")
                             mpd.id = naughty.notify(common).id
                         end)
                             common.icon = current_icon:gsub("\n", "")
                             mpd.id = naughty.notify(common).id
                         end)
index ff1607517687226b8184c6e44c93f1d022cd82d3..983ec7ae2e12813d9a508003844f45d6293fee52 100644 (file)
@@ -10,7 +10,6 @@
 local helpers      = require("lain.helpers")
 local naughty      = require("naughty")
 local wibox        = require("wibox")
 local helpers      = require("lain.helpers")
 local naughty      = require("naughty")
 local wibox        = require("wibox")
-local shell        = require("awful.util").shell
 local string       = { format = string.format,
                        match  = string.match }
 local setmetatable = setmetatable
 local string       = { format = string.format,
                        match  = string.match }
 local setmetatable = setmetatable
@@ -35,7 +34,7 @@ local function worker(args)
     net.iface = (args.iface and type(args.iface) == "string" and {args.iface}) or {}
 
     function net.get_device()
     net.iface = (args.iface and type(args.iface) == "string" and {args.iface}) or {}
 
     function net.get_device()
-        helpers.async(string.format("%s -c 'ip link show'", shell, device_cmd), function(ws)
+        helpers.async(string.format("ip link show", device_cmd), function(ws)
             ws = ws:match("(%w+): <BROADCAST,MULTICAST,.-,UP,LOWER_UP>")
             net.iface = ws and { ws } or {}
         end)
             ws = ws:match("(%w+): <BROADCAST,MULTICAST,.-,UP,LOWER_UP>")
             net.iface = ws and { ws } or {}
         end)
diff --git a/wiki b/wiki
index 3d8de07f057bcc4cb16bb1244e53276ea11ecff4..991e3bb813a650a6d6bcd27a9563a746fe489716 160000 (submodule)
--- a/wiki
+++ b/wiki
@@ -1 +1 @@
-Subproject commit 3d8de07f057bcc4cb16bb1244e53276ea11ecff4
+Subproject commit 991e3bb813a650a6d6bcd27a9563a746fe489716