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({
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),
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)
}
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)
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")
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,
- title = task.cmd,
+ title = task.show_cmd,
text = markup.font(task.notification_preset.font,
awful.util.escape(f:gsub("\n*$", "")))
})
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 {
- preset = task_notification_preset,
+ preset = task.notification_preset,
title = t,
text = markup.font(task.notification_preset.font,
awful.util.escape(f:gsub("\n*$", "")))
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
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
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()
- helpers.async(cmd, function(f)
+ helpers.async({ shell, "-c", cmd }, function(f)
mpd_now = {
random_mode = false,
single_mode = false,
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)
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
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)
-Subproject commit 3d8de07f057bcc4cb16bb1244e53276ea11ecff4
+Subproject commit 991e3bb813a650a6d6bcd27a9563a746fe489716