From be69daf9644b137784789878f91b2479c09afc69 Mon Sep 17 00:00:00 2001 From: Luca CPZ Date: Sat, 15 Sep 2018 10:21:37 +0200 Subject: [PATCH 01/15] util.markup: fixed typos --- util/markup.lua | 14 +++++++------- widget/alsabar.lua | 24 +++++++++++++++++++----- wiki | 2 +- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/util/markup.lua b/util/markup.lua index 6d1331e..63f9486 100644 --- a/util/markup.lua +++ b/util/markup.lua @@ -25,37 +25,37 @@ function markup.small(text) return format("%s", text) end -- Set the font function markup.font(font, text) - return format("%s", font, text) + return format("%s", font, text) end -- Set the foreground function markup.fg.color(color, text) - return format("%s", fg, bg, text) + return format("%s", color, text) end -- Set the background function markup.bg.color(color, text) - return format("%s", fg, bg, text) + return format("%s", color, text) end -- Set foreground and background function markup.color(fg, bg, text) - return format("%s", fg, bg, text) + return format("%s", fg, bg, text) end -- Set font and foreground function markup.fontfg(font, fg, text) - return format("%s", font, fg, text) + return format("%s", font, fg, text) end -- Set font and background function markup.fontbg(font, bg, text) - return format("%s", font, bg, text) + return format("%s", font, bg, text) end -- Set font, foreground and background function markup.fontcolor(font, fg, bg, text) - return format("%s", font, fg, bg, text) + return format("%s", font, fg, bg, text) end -- link markup.{fg,bg}(...) calls to markup.{fg,bg}.color(...) diff --git a/widget/alsabar.lua b/widget/alsabar.lua index 557e97b..9601f09 100644 --- a/widget/alsabar.lua +++ b/widget/alsabar.lua @@ -36,8 +36,11 @@ local function factory(args) local settings = args.settings or function() end local width = args.width or 63 local height = args.height or 1 + local margins = args.margins or 1 + local paddings = args.paddings or 1 local ticks = args.ticks or false local ticks_size = args.ticks_size or 7 + local step = args.step or '5%' alsabar.cmd = args.cmd or "amixer" alsabar.channel = args.channel or "Master" @@ -51,10 +54,13 @@ local function factory(args) alsabar.notification_preset.font = "Monospace 10" end - local format_cmd = string.format("%s get %s", alsabar.cmd, alsabar.channel) + local format_get_cmd = string.format("%s get %s", alsabar.cmd, alsabar.channel) + local format_inc_cmd = string.format("%s sset %s %s+", alsabar.cmd, alsabar.channel, step) + local format_dec_cmd = string.format("%s sset %s %s-" , alsabar.cmd, alsabar.channel, step) + local format_tog_cmd = string.format("%s sset %s toggle", alsabar.cmd, alsabar.channel) if alsabar.togglechannel then - format_cmd = { awful.util.shell, "-c", string.format("%s get %s; %s get %s", + format_get_cmd = { awful.util.shell, "-c", string.format("%s get %s; %s get %s", alsabar.cmd, alsabar.channel, alsabar.cmd, alsabar.togglechannel) } end @@ -63,8 +69,8 @@ local function factory(args) forced_width = width, color = alsabar.colors.unmute, background_color = alsabar.colors.background, - margins = 1, - paddings = 1, + margins = margins, + paddings = paddings, ticks = ticks, ticks_size = ticks_size, widget = wibox.widget.progressbar @@ -73,7 +79,7 @@ local function factory(args) alsabar.tooltip = awful.tooltip({ objects = { alsabar.bar } }) function alsabar.update(callback) - helpers.async(format_cmd, function(mixer) + helpers.async(format_get_cmd, function(mixer) local vol, playback = string.match(mixer, "([%d]+)%%.*%[([%l]*)") if not vol or not playback then return end @@ -146,6 +152,14 @@ local function factory(args) helpers.newtimer(string.format("alsabar-%s-%s", alsabar.cmd, alsabar.channel), timeout, alsabar.update) + alsabar.bar:connect_signal("button::press", function(_,_,_,button) + if (button == 4) then awful.spawn(format_inc_cmd) + elseif (button == 5) then awful.spawn(format_dec_cmd) + elseif (button == 1) then awful.spawn(format_tog_cmd) + end + alsabar.update() +end) + return alsabar end diff --git a/wiki b/wiki index 0d9b19b..1acb69e 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 0d9b19badf44b16c27663dd4dc7f49699a51be73 +Subproject commit 1acb69eb3cf431b9102978c6117144980e8a2939 From f58970997ea2130947aae58a88019b4b70478d68 Mon Sep 17 00:00:00 2001 From: lcpz Date: Sun, 28 Oct 2018 12:59:00 +0000 Subject: [PATCH 02/15] {alsa,pulse}bar: added margins/paddings args --- widget/alsabar.lua | 39 ++++++++++++--------------------------- widget/pulsebar.lua | 28 +++++++++++++--------------- wiki | 2 +- 3 files changed, 26 insertions(+), 43 deletions(-) diff --git a/widget/alsabar.lua b/widget/alsabar.lua index 9601f09..ea78ec5 100644 --- a/widget/alsabar.lua +++ b/widget/alsabar.lua @@ -6,15 +6,12 @@ --]] -local helpers = require("lain.helpers") -local awful = require("awful") -local naughty = require("naughty") -local wibox = require("wibox") -local math = { modf = math.modf } -local string = { format = string.format, - match = string.match, - rep = string.rep } -local type, tonumber = type, tonumber +local helpers = require("lain.helpers") +local awful = require("awful") +local naughty = require("naughty") +local wibox = require("wibox") + +local math, string, type, tonumber = math, string, type, tonumber -- ALSA volume bar -- lain.widget.alsabar @@ -40,7 +37,6 @@ local function factory(args) local paddings = args.paddings or 1 local ticks = args.ticks or false local ticks_size = args.ticks_size or 7 - local step = args.step or '5%' alsabar.cmd = args.cmd or "amixer" alsabar.channel = args.channel or "Master" @@ -54,23 +50,20 @@ local function factory(args) alsabar.notification_preset.font = "Monospace 10" end - local format_get_cmd = string.format("%s get %s", alsabar.cmd, alsabar.channel) - local format_inc_cmd = string.format("%s sset %s %s+", alsabar.cmd, alsabar.channel, step) - local format_dec_cmd = string.format("%s sset %s %s-" , alsabar.cmd, alsabar.channel, step) - local format_tog_cmd = string.format("%s sset %s toggle", alsabar.cmd, alsabar.channel) + local format_cmd = string.format("%s get %s", alsabar.cmd, alsabar.channel) if alsabar.togglechannel then - format_get_cmd = { awful.util.shell, "-c", string.format("%s get %s; %s get %s", + format_cmd = { awful.util.shell, "-c", string.format("%s get %s; %s get %s", alsabar.cmd, alsabar.channel, alsabar.cmd, alsabar.togglechannel) } end alsabar.bar = wibox.widget { - forced_height = height, - forced_width = width, color = alsabar.colors.unmute, background_color = alsabar.colors.background, + forced_height = height, + forced_width = width, margins = margins, - paddings = paddings, + paddings = margins, ticks = ticks, ticks_size = ticks_size, widget = wibox.widget.progressbar @@ -79,7 +72,7 @@ local function factory(args) alsabar.tooltip = awful.tooltip({ objects = { alsabar.bar } }) function alsabar.update(callback) - helpers.async(format_get_cmd, function(mixer) + helpers.async(format_cmd, function(mixer) local vol, playback = string.match(mixer, "([%d]+)%%.*%[([%l]*)") if not vol or not playback then return end @@ -152,14 +145,6 @@ local function factory(args) helpers.newtimer(string.format("alsabar-%s-%s", alsabar.cmd, alsabar.channel), timeout, alsabar.update) - alsabar.bar:connect_signal("button::press", function(_,_,_,button) - if (button == 4) then awful.spawn(format_inc_cmd) - elseif (button == 5) then awful.spawn(format_dec_cmd) - elseif (button == 1) then awful.spawn(format_tog_cmd) - end - alsabar.update() -end) - return alsabar end diff --git a/widget/pulsebar.lua b/widget/pulsebar.lua index 158e639..670c5c3 100644 --- a/widget/pulsebar.lua +++ b/widget/pulsebar.lua @@ -6,16 +6,12 @@ --]] -local helpers = require("lain.helpers") -local awful = require("awful") -local naughty = require("naughty") -local wibox = require("wibox") -local math = { modf = math.modf } -local string = { format = string.format, - match = string.match, - gmatch = string.gmatch, - rep = string.rep } -local type, tonumber = type, tonumber +local helpers = require("lain.helpers") +local awful = require("awful") +local naughty = require("naughty") +local wibox = require("wibox") + +local math, string, type, tonumber = math, string, type, tonumber -- PulseAudio volume bar -- lain.widget.pulsebar @@ -37,7 +33,9 @@ local function factory(args) local timeout = args.timeout or 5 local settings = args.settings or function() end local width = args.width or 63 - local height = args.heigth or 1 + local height = args.height or 1 + local margins = args.margins or 1 + local paddings = args.paddings or 1 local ticks = args.ticks or false local ticks_size = args.ticks_size or 7 @@ -54,12 +52,12 @@ local function factory(args) end pulsebar.bar = wibox.widget { - forced_height = height, - forced_width = width, color = pulsebar.colors.unmute, background_color = pulsebar.colors.background, - margins = 1, - paddings = 1, + forced_height = height, + forced_width = width, + margins = margins, + paddings = margins, ticks = ticks, ticks_size = ticks_size, widget = wibox.widget.progressbar, diff --git a/wiki b/wiki index 1acb69e..e611812 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 1acb69eb3cf431b9102978c6117144980e8a2939 +Subproject commit e6118121ad7e2c2a6d7a846e1ffc3762a42d5fe1 From 4cc47f8d61c14feccba095c09d903c0c666e9055 Mon Sep 17 00:00:00 2001 From: Greg Flynn Date: Sun, 4 Nov 2018 14:29:12 -0500 Subject: [PATCH 03/15] fix paddings always being the margins in pulsebar --- widget/pulsebar.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widget/pulsebar.lua b/widget/pulsebar.lua index 670c5c3..a7c0666 100644 --- a/widget/pulsebar.lua +++ b/widget/pulsebar.lua @@ -57,7 +57,7 @@ local function factory(args) forced_height = height, forced_width = width, margins = margins, - paddings = margins, + paddings = paddings, ticks = ticks, ticks_size = ticks_size, widget = wibox.widget.progressbar, From f6e032ffe180188dfd133d2924bfcbdfcb17b153 Mon Sep 17 00:00:00 2001 From: Greg Flynn Date: Sun, 4 Nov 2018 19:57:54 -0500 Subject: [PATCH 04/15] allow separator colors to be updated --- util/separators.lua | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/util/separators.lua b/util/separators.lua index 29d3005..e45b954 100644 --- a/util/separators.lua +++ b/util/separators.lua @@ -18,14 +18,22 @@ local separators = { height = 0, width = 9 } -- Right function separators.arrow_right(col1, col2) local widget = wibox.widget.base.make_widget() + widget.col1 = col1 + widget.col2 = col2 widget.fit = function(m, w, h) return separators.width, separators.height end + widget.update = function(col1, col2) + widget.col1 = col1 + widget.col2 = col2 + widget:emit_signal("widget::redraw_needed") + end + widget.draw = function(mycross, wibox, cr, width, height) - if col2 ~= "alpha" then - cr:set_source_rgb(gears.color.parse_color(col2)) + if widget.col2 ~= "alpha" then + cr:set_source_rgb(gears.color.parse_color(widget.col2)) cr:new_path() cr:move_to(0, 0) cr:line_to(width, height/2) @@ -41,8 +49,8 @@ function separators.arrow_right(col1, col2) cr:fill() end - if col1 ~= "alpha" then - cr:set_source_rgb(gears.color.parse_color(col1)) + if widget.col1 ~= "alpha" then + cr:set_source_rgb(gears.color.parse_color(widget.col1)) cr:new_path() cr:move_to(0, 0) cr:line_to(width, height/2) @@ -58,14 +66,22 @@ end -- Left function separators.arrow_left(col1, col2) local widget = wibox.widget.base.make_widget() + widget.col1 = col1 + widget.col2 = col2 widget.fit = function(m, w, h) return separators.width, separators.height end + widget.update = function(col1, col2) + widget.col1 = col1 + widget.col2 = col2 + widget:emit_signal("widget::redraw_needed") + end + widget.draw = function(mycross, wibox, cr, width, height) - if col1 ~= "alpha" then - cr:set_source_rgb(gears.color.parse_color(col1)) + if widget.col1 ~= "alpha" then + cr:set_source_rgb(gears.color.parse_color(widget.col1)) cr:new_path() cr:move_to(width, 0) cr:line_to(0, height/2) @@ -81,14 +97,14 @@ function separators.arrow_left(col1, col2) cr:fill() end - if col2 ~= "alpha" then + if widget.col2 ~= "alpha" then cr:new_path() cr:move_to(width, 0) cr:line_to(0, height/2) cr:line_to(width, height) cr:close_path() - cr:set_source_rgb(gears.color.parse_color(col2)) + cr:set_source_rgb(gears.color.parse_color(widget.col2)) cr:fill() end end From f76d33e8cd5bc84f44758e8047294227deb3f29d Mon Sep 17 00:00:00 2001 From: sergey Date: Sat, 10 Nov 2018 21:58:37 +0300 Subject: [PATCH 05/15] add screen and tag arguments to useless_gaps_resize function --- util/init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/init.lua b/util/init.lua index 8b8e719..55bfa26 100644 --- a/util/init.lua +++ b/util/init.lua @@ -158,9 +158,10 @@ end -- }}} -- On the fly useless gaps change -function util.useless_gaps_resize(thatmuch) - local scr = awful.screen.focused() - scr.selected_tag.gap = scr.selected_tag.gap + tonumber(thatmuch) +function util.useless_gaps_resize(thatmuch, s, t) + local scr = s or awful.screen.focused() + local tag = t or scr.selected_tag + tag.gap = tag.gap + tonumber(thatmuch) awful.layout.arrange(scr) end From 4f3babced781559863e7300491c8d6f0e228810e Mon Sep 17 00:00:00 2001 From: lcpz Date: Thu, 15 Nov 2018 10:59:52 +0000 Subject: [PATCH 06/15] widget.cal: fix calendar icons not displaying; closes #410 --- widget/cal.lua | 1 + wiki | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/widget/cal.lua b/widget/cal.lua index 326dc00..50426ba 100644 --- a/widget/cal.lua +++ b/widget/cal.lua @@ -47,6 +47,7 @@ local function factory(args) strx = string.format("%s%s", string.rep(" ", 3 - tostring(x):len()), strx) notifytable[#notifytable+1] = string.format("%-4s%s", strx, (x+st_day)%7==0 and x ~= mth_days and "\n" or "") end + if string.len(cal.icons or "") > 0 and today then cal.icon = cal.icons .. today .. ".png" end cal.month, cal.year = d.month, d.year return notifytable end diff --git a/wiki b/wiki index e611812..7c3a5bf 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit e6118121ad7e2c2a6d7a846e1ffc3762a42d5fe1 +Subproject commit 7c3a5bfba6e779a86169a6cbb1eaf20bf19627f7 From 8112df667d6c56dfec90695341f22af8718a6eb6 Mon Sep 17 00:00:00 2001 From: lcpz Date: Sat, 24 Nov 2018 14:08:04 +0000 Subject: [PATCH 07/15] lain.imap: various improvements 1. allow special chars in password 2. make it gmail/yandex compliant 3. fetch additional data (MESSAGES and RECENT) 4. support DBus Secret Service authentication method --- widget/imap.lua | 71 ++++++++++++++++++++++++++++--------------------- wiki | 2 +- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/widget/imap.lua b/widget/imap.lua index 7e83d36..3f4d9cc 100644 --- a/widget/imap.lua +++ b/widget/imap.lua @@ -17,63 +17,74 @@ local tonumber = tonumber -- lain.widget.imap local function factory(args) - local imap = { widget = wibox.widget.textbox() } - local args = args or {} - 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 followtag = args.followtag or false - local notify = args.notify or "on" - local settings = args.settings or function() end + local imap = { widget = wibox.widget.textbox() } + local args = args or {} + 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 pwdtimeout = args.pwdtimeout or 10 + local is_plain = args.is_plain or false + local followtag = args.followtag or false + local notify = args.notify or "on" + local settings = args.settings or function() end local head_command = "curl --connect-timeout 3 -fsm 3" - local request = "-X 'SEARCH (UNSEEN)'" + local request = "-X 'STATUS INBOX (MESSAGES RECENT UNSEEN)'" if not server or not mail or not password then return end + mail_notification_preset = { + icon = helpers.icons_dir .. "mail.png", + position = "top_left" + } + helpers.set_map(mail, 0) if not is_plain then if type(password) == "string" or type(password) == "table" then helpers.async(password, function(f) password = f:gsub("\n", "") end) elseif type(password) == "function" then - local p = password() + imap.pwdtimer = helpers.newtimer(mail .. "-password", pwdtimeout, function() + local retrieved_password, try_again = password() + if not try_again then + imap.pwdtimer:stop() -- stop trying to retrieve + password = retrieved_password or "" -- failsafe + end + end, true, true) end end - function update() - mail_notification_preset = { - icon = helpers.icons_dir .. "mail.png", - position = "top_left" - } + function imap.update() + -- do not update if the password has not been retrieved yet + if type(password) ~= "string" then return end - if followtag then - mail_notification_preset.screen = awful.screen.focused() - end - - local curl = string.format("%s --url imaps://%s:%s/INBOX -u %s:%q %s -k", + local curl = string.format("%s --url imaps://%s:%s/INBOX -u %s:'%s' %s -k", head_command, server, port, mail, password, request) helpers.async(curl, function(f) - mailcount = tonumber(f:match("UNSEEN (%d+)")) + imap_now = { ["MESSAGES"] = 0, ["RECENT"] = 0, ["UNSEEN"] = 0 } + + for s, d in f:gmatch("(%w+)%s+(%d+)") do imap_now[s] = tonumber(d) end + mailcount = imap_now["UNSEEN"] -- backwards compatibility + helpers.set_map(mail, mailcount) widget = imap.widget + settings() if notify == "on" and mailcount and mailcount >= 1 and mailcount > helpers.get_map(mail) then - local nt = mail .. " has " .. mailcount .. " new message" - if mailcount >= 1 then nt = nt .. "s" end - naughty.notify { preset = mail_notification_preset, text = nt } + if followtag then mail_notification_preset.screen = awful.screen.focused() end + naughty.notify { + preset = mail_notification_preset, + text = string.format("%s has %d new message%s", mail, mailcount, mailcount == 1 and "" or "s") + } end - - helpers.set_map(mail, mailcount) end) end - imap.timer = helpers.newtimer(mail, timeout, update, true, true) + imap.timer = helpers.newtimer(mail, timeout, imap.update, true, true) return imap end diff --git a/wiki b/wiki index 7c3a5bf..f03b097 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 7c3a5bfba6e779a86169a6cbb1eaf20bf19627f7 +Subproject commit f03b0979d5b3019979c58c6e4a649265e7951a10 From 8d15b03ecac62e4d9a0312ca7cd4ad0503692841 Mon Sep 17 00:00:00 2001 From: "Matsievskiy S.V" Date: Wed, 28 Nov 2018 17:17:08 +0300 Subject: [PATCH 08/15] fix imap notifications --- widget/imap.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widget/imap.lua b/widget/imap.lua index 3f4d9cc..75270f1 100644 --- a/widget/imap.lua +++ b/widget/imap.lua @@ -68,7 +68,6 @@ local function factory(args) for s, d in f:gmatch("(%w+)%s+(%d+)") do imap_now[s] = tonumber(d) end mailcount = imap_now["UNSEEN"] -- backwards compatibility - helpers.set_map(mail, mailcount) widget = imap.widget settings() @@ -80,6 +79,7 @@ local function factory(args) text = string.format("%s has %d new message%s", mail, mailcount, mailcount == 1 and "" or "s") } end + helpers.set_map(mail, mailcount) end) end From d9d5a464cb032c99085e7f8fa60c11612db7bef1 Mon Sep 17 00:00:00 2001 From: lcpz Date: Wed, 28 Nov 2018 15:07:42 +0000 Subject: [PATCH 09/15] wiki updated --- wiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wiki b/wiki index f03b097..39799f8 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit f03b0979d5b3019979c58c6e4a649265e7951a10 +Subproject commit 39799f8b08f55f567fd3f31db447d35f211bb5ce From 233768f0963167af1d2621d10157cd64a87c904c Mon Sep 17 00:00:00 2001 From: lcpz Date: Wed, 28 Nov 2018 19:43:04 +0000 Subject: [PATCH 10/15] API change: lain.widget.contrib.tpbat has been rewritten and renamed to lain.widget.contrib.tp_smapi lain.widget.cal: honour followtag argument lightened calls to libraries --- layout/termfair.lua | 4 +- util/quake.lua | 15 ++- util/separators.lua | 4 +- widget/alsa.lua | 3 +- widget/alsabar.lua | 14 +-- widget/bat.lua | 16 ++-- widget/cal.lua | 3 +- widget/contrib/moc.lua | 5 +- widget/contrib/redshift.lua | 1 + widget/contrib/smapi.lua | 145 +++++++++++++++++++++++++++++ widget/contrib/task.lua | 20 ++-- widget/contrib/tpbat/init.lua | 163 --------------------------------- widget/contrib/tpbat/smapi.lua | 98 -------------------- widget/cpu.lua | 5 +- widget/imap.lua | 5 +- widget/mpd.lua | 18 ++-- widget/net.lua | 2 +- widget/pulse.lua | 6 +- widget/pulsebar.lua | 14 +-- widget/weather.lua | 6 +- wiki | 2 +- 21 files changed, 213 insertions(+), 336 deletions(-) create mode 100644 widget/contrib/smapi.lua delete mode 100644 widget/contrib/tpbat/init.lua delete mode 100644 widget/contrib/tpbat/smapi.lua diff --git a/layout/termfair.lua b/layout/termfair.lua index f57f715..e33894e 100644 --- a/layout/termfair.lua +++ b/layout/termfair.lua @@ -8,9 +8,7 @@ --]] -local math = { ceil = math.ceil, - floor = math.floor, - max = math.max } +local math = math local screen = screen local tonumber = tonumber diff --git a/util/quake.lua b/util/quake.lua index 64aaca5..f41447f 100644 --- a/util/quake.lua +++ b/util/quake.lua @@ -7,14 +7,11 @@ --]] local awful = require("awful") -local capi = { client = client } - -local math = { floor = math.floor } -local string = { format = string.format } - +local client = client +local math = math +local string = string local pairs = pairs local screen = screen - local setmetatable = setmetatable -- Quake-like Dropdown application spawn @@ -80,7 +77,7 @@ function quake:display() client:raise() self.last_tag = self.screen.selected_tag client:tags({self.screen.selected_tag}) - capi.client.focus = client + client.focus = client else client.hidden = true local ctags = client:tags() @@ -140,12 +137,12 @@ function quake:new(config) local dropdown = setmetatable(conf, { __index = quake }) - capi.client.connect_signal("manage", function(c) + client.connect_signal("manage", function(c) if c.instance == dropdown.name and c.screen == dropdown.screen then dropdown:display() end end) - capi.client.connect_signal("unmanage", function(c) + client.connect_signal("unmanage", function(c) if c.instance == dropdown.name and c.screen == dropdown.screen then dropdown.visible = false end diff --git a/util/separators.lua b/util/separators.lua index e45b954..465132d 100644 --- a/util/separators.lua +++ b/util/separators.lua @@ -6,8 +6,8 @@ --]] -local wibox = require("wibox") -local gears = require("gears") +local wibox = require("wibox") +local gears = require("gears") -- Lain Cairo separators util submodule -- lain.util.separators diff --git a/widget/alsa.lua b/widget/alsa.lua index 2d4891d..3b6c6d6 100644 --- a/widget/alsa.lua +++ b/widget/alsa.lua @@ -9,8 +9,7 @@ local helpers = require("lain.helpers") local shell = require("awful.util").shell local wibox = require("wibox") -local string = { match = string.match, - format = string.format } +local string = string -- ALSA volume -- lain.widget.alsa diff --git a/widget/alsabar.lua b/widget/alsabar.lua index ea78ec5..9b9f4b9 100644 --- a/widget/alsabar.lua +++ b/widget/alsabar.lua @@ -6,12 +6,14 @@ --]] -local helpers = require("lain.helpers") -local awful = require("awful") -local naughty = require("naughty") -local wibox = require("wibox") - -local math, string, type, tonumber = math, string, type, tonumber +local helpers = require("lain.helpers") +local awful = require("awful") +local naughty = require("naughty") +local wibox = require("wibox") +local math = math +local string = string +local type = type +local tonumber = tonumber -- ALSA volume bar -- lain.widget.alsabar diff --git a/widget/bat.lua b/widget/bat.lua index b654948..5a301b5 100644 --- a/widget/bat.lua +++ b/widget/bat.lua @@ -6,14 +6,14 @@ --]] -local helpers = require("lain.helpers") -local fs = require("gears.filesystem") -local naughty = require("naughty") -local wibox = require("wibox") -local math = math -local string = string -local ipairs = ipairs -local tonumber = tonumber +local helpers = require("lain.helpers") +local fs = require("gears.filesystem") +local naughty = require("naughty") +local wibox = require("wibox") +local math = math +local string = string +local ipairs = ipairs +local tonumber = tonumber -- Battery infos -- lain.widget.bat diff --git a/widget/cal.lua b/widget/cal.lua index 50426ba..47e91a9 100644 --- a/widget/cal.lua +++ b/widget/cal.lua @@ -79,7 +79,7 @@ local function factory(args) cal.notification = nil end - function cal.show(timeout, month, year) + function cal.show(timeout, month, year, scr) cal.notification_preset.text = tconcat(cal.build(month, year)) if cal.three then @@ -95,6 +95,7 @@ local function factory(args) cal.hide() cal.notification = naughty.notify { preset = cal.notification_preset, + screen = cal.followtag and awful.screen.focused() or scr or 1, icon = cal.icon, timeout = timeout or cal.notification_preset.timeout or 5 } diff --git a/widget/contrib/moc.lua b/widget/contrib/moc.lua index 027cec3..f429c77 100644 --- a/widget/contrib/moc.lua +++ b/widget/contrib/moc.lua @@ -11,9 +11,8 @@ local focused = require("awful.screen").focused local escape_f = require("awful.util").escape local naughty = require("naughty") local wibox = require("wibox") -local os = { getenv = os.getenv } -local string = { format = string.format, - gmatch = string.gmatch } +local os = os +local string = string -- MOC audio player -- lain.widget.contrib.moc diff --git a/widget/contrib/redshift.lua b/widget/contrib/redshift.lua index 7b54611..d0e5eed 100644 --- a/widget/contrib/redshift.lua +++ b/widget/contrib/redshift.lua @@ -1,6 +1,7 @@ --[[ Licensed under GNU General Public License v2 + * (c) 2017, Luca CPZ * (c) 2014, blueluke --]] diff --git a/widget/contrib/smapi.lua b/widget/contrib/smapi.lua new file mode 100644 index 0000000..06b3cbd --- /dev/null +++ b/widget/contrib/smapi.lua @@ -0,0 +1,145 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2018, Luca CPZ + * (c) 2013, Conor Heine + +--]] + +local helpers = require("lain.helpers") +local focused = require("awful.screen").focused +local gears = require("gears") +local naughty = require("naughty") +local string = string + +-- ThinkPad battery infos and widget creator +-- http://www.thinkwiki.org/wiki/Tp_smapi +-- lain.widget.contrib.tp_smapi + +local function factory(apipath) + local tp_smapi = { + path = apipath or "/sys/devices/platform/tp_smapi" + } + + function tp_smapi.get(batid, feature) + return helpers.first_line(string.format("%s/%s/%s", tp_smapi.path, batid or "BAT0", feature or "")) + end + + function tp_smapi.installed(batid) + return tp_smapi.get(batid, "installed") == "1" + end + + function tp_smapi.status(batid) + return tp_smapi.get(batid, "state") + end + + function tp_smapi.percentage(batid) + return tp_smapi.get("remaining_percent") + end + + -- either running or charging time + function tp_smapi.time(batid) + local status = tp_smapi.status(batid) + local mins_left = tp_smapi.get(batid, string.match(string.lower(status), "discharging") and "remaining_running_time" or "remaining_charging_time") + if not string.find(mins_left, "^%d+") then return "N/A" end + return string.format("%02d:%02d", math.floor(mins_left / 60), mins_left % 60) -- HH:mm + end + + function tp_smapi.hide() + if not tp_smapi.notification then return end + naughty.destroy(tp_smapi.notification) + tp_smapi.notification = nil + end + + function tp_smapi.show(batid, seconds, scr) + if not tp_smapi.installed(batid) then return end + + local mfgr = tp_smapi.get(batid, "manufacturer") or "no_mfgr" + local model = tp_smapi.get(batid, "model") or "no_model" + local chem = tp_smapi.get(batid, "chemistry") or "no_chem" + local status = tp_smapi.get(batid, "state") + local time = tp_smapi.time(batid) + local msg = "" + + if status and status ~= "idle" then + msg = string.format("[%s] %s %s", status, time ~= "N/A" and time or "unknown remaining time", + string.lower(status):gsub(" ", ""):gsub("\n", "") == "charging" and " until charged" or " remaining") + else + msg = "On AC power" + end + + tp_smapi.hide() + tp_smapi.notification = naughty.notify { + title = string.format("%s: %s %s (%s)", batid, mfgr, model, chem), + text = msg, + timeout = seconds or 0, + screen = scr or focused() + } + end + + function tp_smapi.create_widget(args) + local args = args or {} + local pspath = args.pspath or "/sys/class/power_supply/" + local batteries = args.batteries or (args.battery and {args.battery}) or {} + local timeout = args.timeout or 30 + local settings = args.settings or function() end + + if #batteries == 0 then + helpers.line_callback("ls -1 " .. pspath, function(line) + local bstr = string.match(line, "BAT%w+") + if bstr then batteries[#batteries + 1] = bstr end + end) + end + + local all_batteries_installed = true + + for i, battery in ipairs(batteries) do + if not tp_smapi.installed(battery) then + naughty.notify { + preset = naughty.config.critical, + title = "tp_smapi: error while creating widget", + text = string.format("battery %s is not installed", battery) + } + all_batteries_installed = false + break + end + end + + if not all_batteries_installed then return end + + tpbat = { + batteries = batteries, + widget = args.widget or wibox.widget.textbox() + } + + function tpbat.update() + tpbat_now = { + n_status = {}, + n_perc = {}, + n_time = {}, + status = "N/A" + } + + for i = 1, #batteries do + tpbat_now.n_status[i] = tp_smapi.status(batteries[i]) or "N/A" + tpbat_now.n_perc[i] = tp_smapi.percentage(batteries[i]) + tpbat_now.n_time[i] = tp_smapi.time(batteries[i]) or "N/A" + + if not tpbat_now.n_status[i]:lower():match("full") then + tpbat_now.status = tpbat_now.n_status[i] + end + end + + widget = tpbat.widget -- backwards compatibility + settings() + end + + helpers.newtimer("thinkpad-batteries", timeout, tpbat.update) + + return tpbat + end + + return tp_smapi +end + +return factory diff --git a/widget/contrib/task.lua b/widget/contrib/task.lua index 7e1f3d8..536e006 100644 --- a/widget/contrib/task.lua +++ b/widget/contrib/task.lua @@ -10,7 +10,7 @@ local markup = require("lain.util").markup local awful = require("awful") local naughty = require("naughty") local mouse = mouse -local string = { format = string.format, gsub = string.gsub } +local string = string -- Taskwarrior notification -- lain.widget.contrib.task @@ -23,11 +23,7 @@ function task.hide() end function task.show(scr) - if task.followtag then - task.notification_preset.screen = awful.screen.focused() - elseif scr then - task.notification_preset.screen = scr - end + task.notification_preset.screen = task.followtag and awful.screen.focused() or scr or 1 helpers.async({ awful.util.shell, "-c", task.show_cmd }, function(f) local widget_focused = true @@ -44,12 +40,12 @@ function task.show(scr) if widget_focused then task.hide() - task.notification = naughty.notify({ - preset = task.notification_preset, - title = "task next", - text = markup.font(task.notification_preset.font, - awful.util.escape(f:gsub("\n*$", ""))) - }) + task.notification = naughty.notify { + preset = task.notification_preset, + title = "task next", + text = markup.font(task.notification_preset.font, + awful.util.escape(f:gsub("\n*$", ""))) + } end end) end diff --git a/widget/contrib/tpbat/init.lua b/widget/contrib/tpbat/init.lua deleted file mode 100644 index c62acd1..0000000 --- a/widget/contrib/tpbat/init.lua +++ /dev/null @@ -1,163 +0,0 @@ ---[[ - - tpbat.lua - Battery status widget for ThinkPad laptops that use SMAPI - lain.widget.contrib.tpbat - - More on tp_smapi: http://www.thinkwiki.org/wiki/Tp_smapi - - Licensed under GNU General Public License v2 - * (c) 2013, Conor Heine - * (c) 2013, Luca CPZ - * (c) 2010-2012, Peter Hofmann - ---]] - -local debug = { getinfo = debug.getinfo } -local newtimer = require("lain.helpers").newtimer -local first_line = require("lain.helpers").first_line -local naughty = require("naughty") -local wibox = require("wibox") -local string = { format = string.format } -local math = { floor = math.floor } -local tostring = tostring -local setmetatable = setmetatable -package.path = debug.getinfo(1,"S").source:match[[^@?(.*[\/])[^\/]-$]] .. "?.lua;" .. package.path -local smapi = require("smapi") - --- ThinkPad SMAPI-enabled battery info widget --- lain.widget.contrib.tpbat -local tpbat = {} - -function tpbat.hide() - if not tpbat.notification then return end - naughty.destroy(tpbat.notification) - tpbat.notification = nil -end - -function tpbat.show(t_out) - tpbat.hide() - - local bat = tpbat.bat - - if bat == nil or not bat:installed() then return end - - local t_out = t_out or 0 - local mfgr = bat:get('manufacturer') or "no_mfgr" - local model = bat:get('model') or "no_model" - local chem = bat:get('chemistry') or "no_chem" - local status = bat:get('state') or "nil" - local time = bat:remaining_time() - local msg = "\t" - - if status ~= "idle" and status ~= "nil" then - if time == "N/A" then - msg = "...Calculating time remaining..." - else - msg = time .. (status == "charging" and " until charged" or " remaining") - end - else - msg = "On AC Power" - end - - local str = string.format("%s : %s %s (%s)\n", bat.name, mfgr, model, chem) - .. string.format("\n%s \t\t\t %s", status:upper(), msg) - - tpbat.notification = naughty.notify({ - text = str, - timeout = t_out, - screen = client.focus and client.focus.screen or 1 - }) -end - -function tpbat.register(args) - local args = args or {} - local timeout = args.timeout or 30 - local battery = args.battery or "BAT0" - local bat_low_perc = args.bat_low_perc or 15 - local bat_critical_perc = args.bat_critical_perc or 5 - local settings = args.settings or function() end - - tpbat.bat = smapi:battery(battery) -- Create a new battery - local bat = tpbat.bat - - tpbat.widget = wibox.widget.textbox() - - bat_notification_low_preset = { - title = "Battery low", - text = "Plug the cable!", - timeout = 15, - fg = "#202020", - bg = "#CDCDCD" - } - - bat_notification_critical_preset = { - title = "Battery exhausted", - text = "Shutdown imminent", - timeout = 15, - fg = "#000000", - bg = "#FFFFFF" - } - - if bat:get('state') == nil - then - local n = naughty.notify({ - preset = bat_notification_low_preset, - title = "SMAPI Battery Warning: Unable to read battery state!", - text = "This widget is intended for ThinkPads. Is tp_smapi installed? Check your configs & paths.", - screen = client.focus and client.focus.screen or 1 - }) - end - - function tpbat.update() - bat_now = { - status = "Not present", - perc = "N/A", - time = "N/A", - watt = "N/A" - } - - if bat:installed() - then - bat_now.status = bat:status() or "N/A" - bat_now.perc = bat:percent() - bat_now.time = bat:remaining_time() - -- bat_now.watt = string.format("%.2fW", (VOLTS * AMPS) / 1e12) - - -- notifications for low and critical states (when discharging) - if bat_now.status == "discharging" - then - if bat_now.perc <= bat_critical_perc - then - tpbat.id = naughty.notify({ - preset = bat_notification_critical_preset, - replaces_id = tpbat.id, - screen = client.focus and client.focus.screen or 1 - }).id - elseif bat_now.perc <= bat_low_perc - then - tpbat.id = naughty.notify({ - preset = bat_notification_low_preset, - replaces_id = tpbat.id, - screen = client.focus and client.focus.screen or 1 - }).id - end - end - - bat_now.perc = tostring(bat_now.perc) - end - - widget = tpbat.widget - - settings() - end - - newtimer("tpbat-" .. bat.name, timeout, tpbat.update) - - widget:connect_signal('mouse::enter', function () tpbat.show() end) - widget:connect_signal('mouse::leave', function () tpbat.hide() end) - - return tpbat -end - -return setmetatable(tpbat, { __call = function(_, ...) return tpbat.register(...) end }) diff --git a/widget/contrib/tpbat/smapi.lua b/widget/contrib/tpbat/smapi.lua deleted file mode 100644 index a8867e4..0000000 --- a/widget/contrib/tpbat/smapi.lua +++ /dev/null @@ -1,98 +0,0 @@ ---[[ - - smapi.lua - Interface with thinkpad battery information - - Licensed under GNU General Public License v2 - * (c) 2013, Conor Heine - ---]] - -local first_line = require("lain.helpers").first_line - -local string = { format = string.format } -local tonumber = tonumber -local setmetatable = setmetatable - -local smapi = {} -local apipath = "/sys/devices/platform/smapi" - --- Most are readable values, but some can be written to (not implemented, yet?) -local readable = { - barcoding = true, - charging_max_current = true, - charging_max_voltage = true, - chemistry = true, - current_avg = true, - current_now = true, - cycle_count = true, - design_capacity = true, - design_voltage = true, - dump = true, - first_use_date = true, - force_discharge = false, - group0_voltage = true, - group1_voltage = true, - group2_voltage = true, - group3_voltage = true, - inhibit_charge_minutes = false, - installed = true, - last_full_capacity = true, - manufacture_date = true, - manufacturer = true, - model = true, - power_avg = true, - power_now = true, - remaining_capacity = true, - remaining_charging_time = true, - remaining_percent = true, - remaining_percent_error = true, - remaining_running_time = true, - remaining_running_time_now = true, - serial = true, - start_charge_thresh = false, - state = true, - stop_charge_thresh = false, - temperature = true, - voltage = true -} - -function smapi:battery(name) - local bat = {} - - bat.name = name - bat.path = apipath .. "/" .. name - - function bat:get(item) - return self.path ~= nil and readable[item] and first_line(self.path .. "/" .. item) or nil - end - - function bat:installed() - return self:get("installed") == "1" - end - - function bat:status() - return self:get('state') - end - - -- Remaining time can either be time until battery dies or time until charging completes - function bat:remaining_time() - local time_val = bat_now.status == 'discharging' and 'remaining_running_time' or 'remaining_charging_time' - local mins_left = self:get(time_val) - - if not mins_left:find("^%d+") then return "N/A" end - - local hrs = math.floor(mins_left / 60) - local min = mins_left % 60 - - return string.format("%02d:%02d", hrs, min) - end - - function bat:percent() - return tonumber(self:get("remaining_percent")) - end - - return setmetatable(bat, {__metatable = false, __newindex = false}) -end - -return smapi diff --git a/widget/cpu.lua b/widget/cpu.lua index 6c6e77a..81638c2 100644 --- a/widget/cpu.lua +++ b/widget/cpu.lua @@ -8,9 +8,8 @@ local helpers = require("lain.helpers") local wibox = require("wibox") -local math = { ceil = math.ceil } -local string = { format = string.format, - gmatch = string.gmatch } +local math = math +local string = string local tostring = tostring -- CPU usage diff --git a/widget/imap.lua b/widget/imap.lua index 75270f1..b3d9dc7 100644 --- a/widget/imap.lua +++ b/widget/imap.lua @@ -66,7 +66,7 @@ local function factory(args) helpers.async(curl, function(f) imap_now = { ["MESSAGES"] = 0, ["RECENT"] = 0, ["UNSEEN"] = 0 } - for s, d in f:gmatch("(%w+)%s+(%d+)") do imap_now[s] = tonumber(d) end + for s,d in f:gmatch("(%w+)%s+(%d+)") do imap_now[s] = tonumber(d) end mailcount = imap_now["UNSEEN"] -- backwards compatibility widget = imap.widget @@ -79,7 +79,8 @@ local function factory(args) text = string.format("%s has %d new message%s", mail, mailcount, mailcount == 1 and "" or "s") } end - helpers.set_map(mail, mailcount) + + helpers.set_map(mail, imap_now["UNSEEN"]) end) end diff --git a/widget/mpd.lua b/widget/mpd.lua index ff45179..01f28e6 100644 --- a/widget/mpd.lua +++ b/widget/mpd.lua @@ -6,16 +6,14 @@ --]] -local helpers = require("lain.helpers") -local shell = require("awful.util").shell -local escape_f = require("awful.util").escape -local focused = require("awful.screen").focused -local naughty = require("naughty") -local wibox = require("wibox") -local os = { getenv = os.getenv } -local string = { format = string.format, - gmatch = string.gmatch, - match = string.match } +local helpers = require("lain.helpers") +local shell = require("awful.util").shell +local escape_f = require("awful.util").escape +local focused = require("awful.screen").focused +local naughty = require("naughty") +local wibox = require("wibox") +local os = os +local string = string -- MPD infos -- lain.widget.mpd diff --git a/widget/net.lua b/widget/net.lua index 987f047..805b577 100644 --- a/widget/net.lua +++ b/widget/net.lua @@ -9,7 +9,7 @@ local helpers = require("lain.helpers") local naughty = require("naughty") local wibox = require("wibox") -local string = { format = string.format, match = string.match } +local string = string -- Network infos -- lain.widget.net diff --git a/widget/pulse.lua b/widget/pulse.lua index d37e83a..f63fe55 100644 --- a/widget/pulse.lua +++ b/widget/pulse.lua @@ -8,10 +8,8 @@ local helpers = require("lain.helpers") local shell = require("awful.util").shell local wibox = require("wibox") -local string = { gmatch = string.gmatch, - match = string.match, - format = string.format } -local type = type +local string = string +local type = type -- PulseAudio volume -- lain.widget.pulse diff --git a/widget/pulsebar.lua b/widget/pulsebar.lua index a7c0666..317468f 100644 --- a/widget/pulsebar.lua +++ b/widget/pulsebar.lua @@ -6,12 +6,14 @@ --]] -local helpers = require("lain.helpers") -local awful = require("awful") -local naughty = require("naughty") -local wibox = require("wibox") - -local math, string, type, tonumber = math, string, type, tonumber +local helpers = require("lain.helpers") +local awful = require("awful") +local naughty = require("naughty") +local wibox = require("wibox") +local math = math +local string = string +local type = type +local tonumber = tonumber -- PulseAudio volume bar -- lain.widget.pulsebar diff --git a/widget/weather.lua b/widget/weather.lua index a9b886a..f35ca68 100644 --- a/widget/weather.lua +++ b/widget/weather.lua @@ -10,8 +10,10 @@ local json = require("lain.util").dkjson local focused = require("awful.screen").focused local naughty = require("naughty") local wibox = require("wibox") - -local math, os, string, tonumber = math, os, string, tonumber +local math = math +local os = os +local string = string +local tonumber = tonumber -- OpenWeatherMap -- current weather and X-days forecast diff --git a/wiki b/wiki index 39799f8..f52c906 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 39799f8b08f55f567fd3f31db447d35f211bb5ce +Subproject commit f52c9068f4e64effe8a3f38e7531beef3fec3388 From 5321eb485ad559ffa72f6cc804c9dff657a40f0d Mon Sep 17 00:00:00 2001 From: BarbUk Date: Sat, 1 Dec 2018 16:03:56 +0400 Subject: [PATCH 11/15] Rename smapi to ts_smapi To follow to documentation available at https://github.com/lcpz/lain/wiki/tp_smapi smapi is renamed tp_smapi --- widget/contrib/{smapi.lua => tp_smapi.lua} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename widget/contrib/{smapi.lua => tp_smapi.lua} (100%) diff --git a/widget/contrib/smapi.lua b/widget/contrib/tp_smapi.lua similarity index 100% rename from widget/contrib/smapi.lua rename to widget/contrib/tp_smapi.lua From dec9e7b1eba77e8012e4ffc0c43acc5e28167d7c Mon Sep 17 00:00:00 2001 From: BarbUk Date: Sat, 1 Dec 2018 16:05:47 +0400 Subject: [PATCH 12/15] Include wibox --- widget/contrib/tp_smapi.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/widget/contrib/tp_smapi.lua b/widget/contrib/tp_smapi.lua index 06b3cbd..e6da918 100644 --- a/widget/contrib/tp_smapi.lua +++ b/widget/contrib/tp_smapi.lua @@ -10,6 +10,7 @@ local helpers = require("lain.helpers") local focused = require("awful.screen").focused local gears = require("gears") local naughty = require("naughty") +local wibox = require("wibox") local string = string -- ThinkPad battery infos and widget creator From 1046cf6ce9b6a96ab6d6ef3ea7e9ffca07e12822 Mon Sep 17 00:00:00 2001 From: BarbUk Date: Sat, 1 Dec 2018 16:06:12 +0400 Subject: [PATCH 13/15] tp_smapi.get need a batid param --- widget/contrib/tp_smapi.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widget/contrib/tp_smapi.lua b/widget/contrib/tp_smapi.lua index e6da918..7192990 100644 --- a/widget/contrib/tp_smapi.lua +++ b/widget/contrib/tp_smapi.lua @@ -35,7 +35,7 @@ local function factory(apipath) end function tp_smapi.percentage(batid) - return tp_smapi.get("remaining_percent") + return tp_smapi.get(batid, "remaining_percent") end -- either running or charging time From 6c3a211991600f1fce54e7655c75d046b983fdeb Mon Sep 17 00:00:00 2001 From: lcpz Date: Sat, 1 Dec 2018 18:35:44 +0000 Subject: [PATCH 14/15] util.quake: revert previous commit; closes #415 --- util/quake.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/quake.lua b/util/quake.lua index f41447f..01891b0 100644 --- a/util/quake.lua +++ b/util/quake.lua @@ -7,7 +7,7 @@ --]] local awful = require("awful") -local client = client +local capi = { client = client } local math = math local string = string local pairs = pairs @@ -77,7 +77,7 @@ function quake:display() client:raise() self.last_tag = self.screen.selected_tag client:tags({self.screen.selected_tag}) - client.focus = client + capi.client.focus = client else client.hidden = true local ctags = client:tags() @@ -137,12 +137,12 @@ function quake:new(config) local dropdown = setmetatable(conf, { __index = quake }) - client.connect_signal("manage", function(c) + capi.client.connect_signal("manage", function(c) if c.instance == dropdown.name and c.screen == dropdown.screen then dropdown:display() end end) - client.connect_signal("unmanage", function(c) + capi.client.connect_signal("unmanage", function(c) if c.instance == dropdown.name and c.screen == dropdown.screen then dropdown.visible = false end From 8d1a9054798accb9dfe754fcaf6264609787868d Mon Sep 17 00:00:00 2001 From: lcpz Date: Sat, 1 Dec 2018 19:03:58 +0000 Subject: [PATCH 15/15] tp_smapi: correct default apipath --- widget/contrib/tp_smapi.lua | 2 +- wiki | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/widget/contrib/tp_smapi.lua b/widget/contrib/tp_smapi.lua index 7192990..4f43e44 100644 --- a/widget/contrib/tp_smapi.lua +++ b/widget/contrib/tp_smapi.lua @@ -19,7 +19,7 @@ local string = string local function factory(apipath) local tp_smapi = { - path = apipath or "/sys/devices/platform/tp_smapi" + path = apipath or "/sys/devices/platform/smapi" } function tp_smapi.get(batid, feature) diff --git a/wiki b/wiki index f52c906..11ea6b6 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit f52c9068f4e64effe8a3f38e7531beef3fec3388 +Subproject commit 11ea6b6bc6661396e6d29f362f94c5561a94eb44