local io = { popen = io.popen }
local math = { modf = math.modf }
+local mouse = mouse
local string = { format = string.format,
match = string.match,
rep = string.rep }
.. string.rep(" ", alsabar.notifications.bar_size - int)
.. "]"
+ if alsabar.followmouse then
+ preset.screen = mouse.screen
+ end
+
if alsabar._notify ~= nil then
alsabar._notify = naughty.notify ({
replaces_id = alsabar._notify.id,
alsabar.step = args.step or alsabar.step
alsabar.colors = args.colors or alsabar.colors
alsabar.notifications = args.notifications or alsabar.notifications
+ alsabar.followmouse = args.followmouse or false
alsabar.bar = awful.widget.progressbar()
local io = { popen = io.popen }
local os = { date = os.date }
+local mouse = mouse
local tonumber = tonumber
local setmetatable = setmetatable
.. "</span></tt>"
f:close()
+ if calendar.followmouse then
+ local scrp = mouse.screen
+ else
+ local scrp = scr or calendar.scr_pos
+ end
+
cal_notification = naughty.notify({
text = c_text,
icon = calendar.notify_icon,
fg = calendar.fg,
bg = calendar.bg,
timeout = tims,
- screen = scr or 1
+ screen = scrp
})
end
function calendar:attach(widget, args)
local args = args or {}
- calendar.cal = args.cal or "/usr/bin/cal"
- calendar.post_cal = args.post_cal or ""
- calendar.icons = args.icons or icons_dir .. "cal/white/"
- calendar.font = args.font or beautiful.font:sub(beautiful.font:find(""),
- beautiful.font:find(" "))
- calendar.font_size = tonumber(args.font_size) or 11
- calendar.fg = args.fg or beautiful.fg_normal or "#FFFFFF"
- calendar.bg = args.bg or beautiful.bg_normal or "#FFFFFF"
- calendar.position = args.position or "top_right"
- calendar.scr_pos = args.scr_pos or mouse.screen
-
- calendar.offset = 0
+
+ calendar.cal = args.cal or "/usr/bin/cal"
+ calendar.post_cal = args.post_cal or ""
+ calendar.icons = args.icons or icons_dir .. "cal/white/"
+ calendar.font = args.font or beautiful.font:sub(beautiful.font:find(""),
+ beautiful.font:find(" "))
+ calendar.font_size = tonumber(args.font_size) or 11
+ calendar.fg = args.fg or beautiful.fg_normal or "#FFFFFF"
+ calendar.bg = args.bg or beautiful.bg_normal or "#FFFFFF"
+ calendar.position = args.position or "top_right"
+ calendar.scr_pos = args.scr_pos or 1
+ calendar.followmouse = args.followmouse or false
+
+ calendar.offset = 0
calendar.notify_icon = nil
widget:connect_signal("mouse::enter", function () calendar:show(0, 0, 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),
- awful.button({ }, 3, function ()
- calendar:show(0, 1, calendar.scr_pos) end),
- awful.button({ }, 4, function ()
- calendar:show(0, -1, calendar.scr_pos) end),
- awful.button({ }, 5, function ()
- calendar:show(0, 1, calendar.scr_pos) end)))
+ widget:buttons(awful.util.table.join(awful.button({ }, 1, function ()
+ calendar:show(0, -1, calendar.scr_pos) end),
+ awful.button({ }, 3, function ()
+ calendar:show(0, 1, calendar.scr_pos) end),
+ awful.button({ }, 4, function ()
+ calendar:show(0, -1, calendar.scr_pos) end),
+ awful.button({ }, 5, function ()
+ calendar:show(0, 1, calendar.scr_pos) end)))
end
return setmetatable(calendar, { __call = function(_, ...) return create(...) end })
local music_dir = args.music_dir or os.getenv("HOME") .. "/Music"
local cover_size = args.cover_size or 100
local default_art = args.default_art or ""
+ local followmouse = args.followmouse or false
local settings = args.settings or function() end
local mpdcover = helpers.scripts_dir .. "mpdcover"
os.execute(string.format("%s %q %q %d %q", mpdcover, "",
moc_now.file, cover_size, default_art))
+ if followmouse then
+ moc_notification_preset.screen = mouse.screen
+ end
+
moc.id = naughty.notify({
preset = moc_notification_preset,
icon = "/tmp/mpdcover.png",
local beautiful = require("beautiful")
local naughty = require("naughty")
+local mouse = mouse
local io = io
local string = { len = string.len }
local tonumber = tonumber
local f, c_text
+ if task.followmouse then
+ local scrp = mouse.screen
+ else
+ local scrp = scr_pos or task.scr_pos
+ end
+
f = io.popen('task')
c_text = "<span font='"
.. task.font .. " "
fg = task.fg,
bg = task.bg,
timeout = task.timeout,
- screen = scr_pos or 1
+ screen = scrp
})
end
end
function task:attach(widget, args)
- local args = args or {}
-
- task.font_size = tonumber(args.font_size) or 12
- task.font = beautiful.font:sub(beautiful.font:find(""),
- beautiful.font:find(" "))
- task.fg = args.fg or beautiful.fg_normal or "#FFFFFF"
- task.bg = args.bg or beautiful.bg_normal or "#FFFFFF"
- task.position = args.position or "top_right"
- task.timeout = args.timeout or 7
- task.scr_pos = args.scr_pos or 1
+ local args = args or {}
+
+ task.font_size = tonumber(args.font_size) or 12
+ task.font = beautiful.font:sub(beautiful.font:find(""),
+ beautiful.font:find(" "))
+ task.fg = args.fg or beautiful.fg_normal or "#FFFFFF"
+ task.bg = args.bg or beautiful.bg_normal or "#FFFFFF"
+ task.position = args.position or "top_right"
+ task.timeout = args.timeout or 7
+ task.scr_pos = args.scr_pos or 1
+ task.followmouse = args.followmouse or false
task.notify_icon = icons_dir .. "/taskwarrior/task.png"
task.notify_icon_small = icons_dir .. "/taskwarrior/tasksmall.png"
- widget:connect_signal("mouse::enter", function () task:show(scr_pos) end)
+ widget:connect_signal("mouse::enter", function () task:show(task.scr_pos) end)
widget:connect_signal("mouse::leave", function () task:hide() end)
end
local io = { popen = io.popen }
local pairs = pairs
+local mouse = mouse
local string = { match = string.match,
format = string.format }
local tonumber = tonumber
-- File system disk space usage
-- lain.widgets.fs
local fs = {}
-
local fs_notification = nil
-fs_notification_preset = { fg = beautiful.fg_normal }
function fs:hide()
if fs_notification ~= nil then
function fs:show(t_out)
fs:hide()
- naughty.notify({text=fs_notification_preset.screen})
-
local f = io.popen(helpers.scripts_dir .. "dfs")
ws = f:read("*all"):gsub("\n*$", "")
f:close()
+ if fs.followmouse then
+ fs.notification_preset.screen = mouse.screen
+ end
+
notification = naughty.notify({
- preset = fs_notification_preset,
+ preset = fs.notification_preset,
text = ws,
timeout = t_out
})
local unit = { ["mb"] = 1024, ["gb"] = 1024^2 }
local function worker(args)
- local args = args or {}
- local timeout = args.timeout or 600
- local partition = args.partition or "/"
- local settings = args.settings or function() end
+ local args = args or {}
+ local timeout = args.timeout or 600
+ local partition = args.partition or "/"
+ local settings = args.settings or function() end
+
+ fs.followmouse = args.followmouse or false
+ fs.notification_preset = args.notification_preset or { fg = beautiful.fg_normal }
fs.widget = wibox.widget.textbox('')
local naughty = require("naughty")
local wibox = require("wibox")
+local mouse = mouse
local string = { format = string.format,
gsub = string.gsub }
local tonumber = tonumber
-- lain.widgets.imap
local function worker(args)
- local imap = {}
- local args = args or {}
+ local imap = {}
+ local args = args or {}
- local server = args.server
- local mail = args.mail
- local password = args.password
+ local server = args.server
+ local mail = args.mail
+ local password = args.password
- local port = args.port or 993
- local timeout = args.timeout or 60
- local is_plain = args.is_plain or false
- local settings = args.settings or function() end
+ local port = args.port or 993
+ local timeout = args.timeout or 60
+ local is_plain = args.is_plain or false
+ local followmouse = args.followmouse or false
+ local settings = args.settings or function() end
local head_command = "curl --connect-timeout 3 -fsm 3"
local request = "-X 'SEARCH (UNSEEN)'"
position = "top_left"
}
+ if followmouse then
+ mail_notification_preset.screen = mouse.screen
+ end
+
curl = string.format("%s --url imaps://%s:%s/INBOX -u %s:%q %s -k",
head_command, server, port, mail, password, request)
local os = { execute = os.execute,
getenv = os.getenv }
local math = { floor = math.floor }
+local mouse = mouse
local string = { format = string.format,
match = string.match,
gmatch = string.gmatch }
local music_dir = args.music_dir or os.getenv("HOME") .. "/Music"
local cover_size = args.cover_size or 100
local default_art = args.default_art or ""
+ local followmouse = args.followmouse or false
local settings = args.settings or function() end
local mpdcover = helpers.scripts_dir .. "mpdcover"
current_icon = default_art
end
+ if followmouse then
+ mpd_notification_preset.screen = mouse.screen
+ end
+
mpd.id = naughty.notify({
preset = mpd_notification_preset,
icon = current_icon,
local wibox = require("wibox")
local math = { floor = math.floor }
+local mouse = mouse
local string = { format = string.format,
gsub = string.gsub }
-- lain.widgets.weather
local function worker(args)
- local weather = {}
- local args = args or {}
- local timeout = args.timeout or 900 -- 15 min
- local timeout_forecast = args.timeout or 86400 -- 24 hrs
- local current_call = "curl -s 'http://api.openweathermap.org/data/2.5/weather?id=%s&units=%s&lang=%s'"
- local forecast_call = "curl -s 'http://api.openweathermap.org/data/2.5/forecast/daily?id=%s&units=%s&lang=%s&cnt=%s'"
- local city_id = args.city_id or 0 -- placeholder
- local units = args.units or "metric"
- local lang = args.lang or "en"
- local cnt = args.cnt or 7
- local date_cmd = args.date_cmd or "date -u -d @%d +'%%a %%d'"
- local icons_path = args.icons_path or lain_icons .. "openweathermap/"
- local w_notification_preset = args.w_notification_preset or {}
- local settings = args.settings or function() end
+ local weather = {}
+ local args = args or {}
+ local timeout = args.timeout or 900 -- 15 min
+ local timeout_forecast = args.timeout or 86400 -- 24 hrs
+ local current_call = "curl -s 'http://api.openweathermap.org/data/2.5/weather?id=%s&units=%s&lang=%s'"
+ local forecast_call = "curl -s 'http://api.openweathermap.org/data/2.5/forecast/daily?id=%s&units=%s&lang=%s&cnt=%s'"
+ local city_id = args.city_id or 0 -- placeholder
+ local units = args.units or "metric"
+ local lang = args.lang or "en"
+ local cnt = args.cnt or 7
+ local date_cmd = args.date_cmd or "date -u -d @%d +'%%a %%d'"
+ local icons_path = args.icons_path or lain_icons .. "openweathermap/"
+ local notification_preset = args.notification_preset or {}
+ local followmouse = args.followmouse or false
+ local settings = args.settings or function() end
weather.widget = wibox.widget.textbox('')
weather.icon = wibox.widget.imagebox()
function weather.show(t_out)
weather.hide()
+
+ if followmouse then
+ notification_preset.screen = mouse.screen
+ end
+
weather.notification = naughty.notify({
text = weather.notification_text,
icon = weather.icon_path,
timeout = t_out,
- preset = w_notification_preset
+ preset = notification_preset
})
end
-Subproject commit 1544177cc083a62e40d93dfc29e545dcafae40be
+Subproject commit 1b310ca2f9277d66d285b9ef89e38eb5106535fb