mirror of https://github.com/lcpz/lain.git
some fixes
This commit is contained in:
parent
f278805dc7
commit
9c829662f1
|
@ -29,7 +29,7 @@ local function create(background, foreground)
|
|||
calendar.notify_icon = nil
|
||||
calendar.font_size = 12
|
||||
calendar.bg = background or beautiful.bg_normal or "#FFFFFF"
|
||||
calendar.fg = foreground or beautiful.fg_normal or "#FFFFFF"
|
||||
calendar.fg = foreground or beautiful.fg_focus or "#FFFFFF"
|
||||
end
|
||||
|
||||
function calendar:hide()
|
||||
|
|
|
@ -43,7 +43,7 @@ function fs:show(t_out)
|
|||
notification = naughty.notify({
|
||||
text = ws,
|
||||
timeout = t_out,
|
||||
fg = beautiful.fg_focus,
|
||||
fg = fs.color,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -56,8 +56,8 @@ local function worker(args)
|
|||
local refresh_timeout = args.refresh_timeout or 600
|
||||
local header = args.header or " Hdd "
|
||||
local header_color = args.header_color or beautiful.fg_normal or "#FFFFFF"
|
||||
local color = args.color or beautiful.fg_focus or "#FFFFFF"
|
||||
local footer = args.header or ""
|
||||
fs.color = args.color or beautiful.fg_focus or "#FFFFFF"
|
||||
local footer = args.footer or ""
|
||||
local shadow = args.shadow or false
|
||||
|
||||
local myfs = wibox.widget.textbox()
|
||||
|
@ -71,7 +71,7 @@ local function worker(args)
|
|||
local function set_text()
|
||||
local info = fs_info['{' .. partition .. ' used_p}']
|
||||
myfs:set_markup(markup(header_color, header)
|
||||
.. markup(color, info .. footer) .. " ")
|
||||
.. markup(fs.color, info .. footer))
|
||||
end
|
||||
|
||||
for line in f:lines() do -- Match: (size) (used)(avail)(use%) (mount)
|
||||
|
|
|
@ -35,8 +35,7 @@ function worker(args)
|
|||
local refresh_timeout = args.refresh_timeout or 60
|
||||
local header = args.header or " Mail "
|
||||
local header_color = args.header_color or beautiful.fg_normal or "#FFFFFF"
|
||||
local color_newmail = args.color_newmail or beautiful.fg_focus or "#FFFFFF"
|
||||
local color_nomail = args.color_nomail or beautiful.fg_normal or "#FFFFFF"
|
||||
local color = args.color or beautiful.fg_focus or "#FFFFFF"
|
||||
local mail_encoding = args.mail_encoding or nil
|
||||
local maxlen = args.maxlen or 200
|
||||
local app = args.app or "mutt"
|
||||
|
@ -63,7 +62,7 @@ function worker(args)
|
|||
then
|
||||
myimapcheck:set_text('')
|
||||
else
|
||||
myimapcheck:set_markup(markup(color_nomail, " no mail "))
|
||||
myimapcheck:set_markup(markup(color, " no mail "))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -97,8 +96,8 @@ function worker(args)
|
|||
elseif ws:find("CheckMailError: invalid credentials") ~= nil
|
||||
then
|
||||
helpers.set_map(mail, true)
|
||||
myimapcheck.set_markup(markup(header_color, header) ..
|
||||
markup(color_newmail, "invalid credentials "))
|
||||
myimapcheck:set_markup(markup(header_color, header) ..
|
||||
markup(color, "invalid credentials "))
|
||||
else
|
||||
mailcount = ws:match("%d") or "?"
|
||||
|
||||
|
@ -109,7 +108,7 @@ function worker(args)
|
|||
end
|
||||
|
||||
myimapcheck:set_markup(markup(header_color, header) ..
|
||||
markup(color_newmail, mailcount) .. " ")
|
||||
markup(color, mailcount) .. " ")
|
||||
|
||||
if helpers.get_map(mail)
|
||||
then
|
||||
|
@ -137,7 +136,7 @@ function worker(args)
|
|||
end
|
||||
|
||||
naughty.notify({ title = notify_title,
|
||||
fg = color_newmail,
|
||||
fg = color,
|
||||
text = ws,
|
||||
icon = beautiful.lain_mail_notify or
|
||||
helpers.icons_dir .. "mail.png",
|
||||
|
|
|
@ -33,8 +33,8 @@ function worker(args)
|
|||
local port = args.port or "6600"
|
||||
local music_dir = args.music_dir or os.getenv("HOME") .. "/Music"
|
||||
local refresh_timeout = args.refresh_timeout or 1
|
||||
local color_artist = args.color_artist or beautiful.fg_normal or "#FFFFFF"
|
||||
local color_song = args.color_song or beautiful.fg_focus or "#FFFFFF"
|
||||
local header_color = args.header_color or beautiful.fg_normal or "#FFFFFF"
|
||||
local color = args.color or beautiful.fg_focus or "#FFFFFF"
|
||||
local spr = args.spr or " "
|
||||
local app = args.app or "ncmpcpp"
|
||||
local shadow = args.shadow or false
|
||||
|
@ -53,7 +53,7 @@ function worker(args)
|
|||
then
|
||||
mympd:set_text('')
|
||||
else
|
||||
mympd:set_markup(markup(color_artist, " mpd "), markup(color_song , "off "))
|
||||
mympd:set_markup(markup(header_color, " mpd "), markup(color , "off "))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -97,20 +97,19 @@ function worker(args)
|
|||
mpd_state["{Date}"] .. "\n" ..
|
||||
mpd_state["{Title}"],
|
||||
icon = "/tmp/mpdcover.png",
|
||||
fg = beautiful.fg_focus or "#FFFFFF",
|
||||
bg = beautiful.bg_normal or "#000000" ,
|
||||
fg = color,
|
||||
timeout = 6,
|
||||
replaces_id = mpd.id
|
||||
}).id
|
||||
end
|
||||
mympd:set_markup(markup(color_artist, " " .. mpd_state["{Artist}"])
|
||||
mympd:set_markup(markup(header_color, " " .. mpd_state["{Artist}"])
|
||||
.. spr ..
|
||||
markup(color_song, mpd_state["{Title}"] .. " "))
|
||||
markup(color, mpd_state["{Title}"] .. " "))
|
||||
elseif mpd_state["{state}"] == "pause"
|
||||
then
|
||||
mympd:set_markup(markup(color_artist, " mpd")
|
||||
mympd:set_markup(markup(header_color, " mpd")
|
||||
.. spr ..
|
||||
markup(color_song, "paused "))
|
||||
markup(color, "paused "))
|
||||
else
|
||||
helpers.set_map("current mpd track", nil)
|
||||
set_nompd()
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
--[[
|
||||
|
||||
Yahoo's Awesome (WM) Weather Notification
|
||||
|
||||
Licensed under WTFPL v2
|
||||
Licensed under GNU General Public License v2
|
||||
* (c) 2013, Luke Bonham
|
||||
|
||||
--]]
|
||||
|
@ -26,8 +24,7 @@ local tonumber = tonumber
|
|||
|
||||
local setmetatable = setmetatable
|
||||
|
||||
-- yawn integration
|
||||
-- https://github.com/copycat-killer/yawn
|
||||
-- YAhoo! Weather Notification
|
||||
-- lain.widgets.yawn
|
||||
local yawn =
|
||||
{
|
||||
|
@ -52,20 +49,19 @@ local update_timer = nil
|
|||
|
||||
local function fetch_weather(args)
|
||||
local toshow = args.toshow or "forecast"
|
||||
local spr = args.spr or " "
|
||||
local footer = args.footer or ""
|
||||
|
||||
local url = api_url .. units_set .. city_id
|
||||
local f = io.popen("curl --connect-timeout 1 -fsm 2 '"
|
||||
.. url .. "'" )
|
||||
local text = f:read("*all")
|
||||
io.close(f)
|
||||
f:close()
|
||||
|
||||
-- In case of no connection or invalid city ID
|
||||
-- widgets won't display
|
||||
if text == "" or text:match("City not found")
|
||||
then
|
||||
sky = icon_path .. "na.png"
|
||||
yawn.icon:set_image(sky)
|
||||
if text == "" then
|
||||
weather_data = "Service not available at the moment."
|
||||
return "N/A"
|
||||
|
@ -119,14 +115,14 @@ local function fetch_weather(args)
|
|||
if f == nil then
|
||||
sky = icon_path .. "na.png"
|
||||
else
|
||||
io.close(f)
|
||||
f:close()
|
||||
end
|
||||
|
||||
-- Localization
|
||||
local f = io.open(localizations_path .. language, "r")
|
||||
if language:find("en_") == nil and f ~= nil
|
||||
then
|
||||
io.close(f)
|
||||
f:close()
|
||||
for line in io.lines(localizations_path .. language)
|
||||
do
|
||||
word = string.sub(line, 1, line:find("|")-1)
|
||||
|
@ -136,18 +132,20 @@ local function fetch_weather(args)
|
|||
end
|
||||
|
||||
-- Finally setting infos
|
||||
forecast = weather_data:match(": %S+"):gsub(": ", ""):gsub(",", "")
|
||||
yawn.forecast = markup(yawn.forecast_color, markup.font(beautiful.font, forecast))
|
||||
yawn.units = markup(yawn.units_color, markup.font(beautiful.font, units))
|
||||
both = weather_data:match(": %S+.-\n"):gsub(": ", "")
|
||||
forecast = weather_data:match(": %S+.-,"):gsub(": ", ""):gsub(",", "\n")
|
||||
units = units:gsub(" ", "")
|
||||
|
||||
yawn.forecast = markup(yawn.color, " " .. markup.font(beautiful.font, forecast) .. " ")
|
||||
yawn.units = markup(yawn.color, " " .. markup.font(beautiful.font, units))
|
||||
yawn.icon:set_image(sky)
|
||||
|
||||
if toshow == "forecast" then
|
||||
return yawn.forecast
|
||||
elseif toshow == "units" then
|
||||
return yawn.units
|
||||
else -- "both"
|
||||
return yawn.forecast .. spr
|
||||
.. yawn.units .. footer
|
||||
else
|
||||
return both
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -175,21 +173,16 @@ function yawn.show(t_out)
|
|||
text = weather_data,
|
||||
icon = sky,
|
||||
timeout = t_out,
|
||||
fg = yawn.notification_color
|
||||
fg = yawn.color
|
||||
})
|
||||
end
|
||||
|
||||
function yawn.register(id, args)
|
||||
local args = args or {}
|
||||
|
||||
settings = { args.toshow, args.spr, args.footer }
|
||||
settings = args
|
||||
|
||||
yawn.units_color = args.units_color or
|
||||
beautiful.fg_normal or "#FFFFFF"
|
||||
yawn.forecast_color = args.forecast_color or
|
||||
yawn.units_color
|
||||
yawn.notification_color = args.notification_color or
|
||||
beautiful.fg_focus or "#FFFFFF"
|
||||
yawn.color = args.color or beautiful.fg_normal or "#FFFFFF"
|
||||
|
||||
if args.u == "f" then units_set = '?u=f&w=' end
|
||||
|
||||
|
@ -208,6 +201,8 @@ function yawn.register(id, args)
|
|||
yawn.icon:connect_signal("mouse::leave", function()
|
||||
yawn.hide()
|
||||
end)
|
||||
|
||||
return yawn
|
||||
end
|
||||
|
||||
function yawn.attach(widget, id, args)
|
||||
|
|
Loading…
Reference in New Issue