no need to set naughty.config.defaults as preset, because it's implicit; closes #290
This commit is contained in:
parent
ddbf283f0e
commit
49a4df385e
7 changed files with 41 additions and 26 deletions
15
helpers.lua
15
helpers.lua
|
@ -185,6 +185,21 @@ function helpers.make_widget_textbox()
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- shallow copy a table
|
||||||
|
function helpers.table_shallowcopy(orig)
|
||||||
|
local orig_type = type(orig)
|
||||||
|
local copy
|
||||||
|
if orig_type == 'table' then
|
||||||
|
copy = {}
|
||||||
|
for orig_key, orig_value in pairs(orig) do
|
||||||
|
copy[orig_key] = orig_value
|
||||||
|
end
|
||||||
|
else -- number, string, boolean, etc
|
||||||
|
copy = orig
|
||||||
|
end
|
||||||
|
return copy
|
||||||
|
end
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers
|
return helpers
|
||||||
|
|
|
@ -50,8 +50,8 @@ local function worker(args)
|
||||||
alsabar.notification_preset = args.notification_preset
|
alsabar.notification_preset = args.notification_preset
|
||||||
|
|
||||||
if not alsabar.notification_preset then
|
if not alsabar.notification_preset then
|
||||||
alsabar.notification_preset = naughty.config.defaults
|
alsabar.notification_preset = {}
|
||||||
alsabar.notification_preset.font = "Monospace 11"
|
alsabar.notification_preset.font = "Monospace 10"
|
||||||
end
|
end
|
||||||
|
|
||||||
local format_cmd = string.format("%s get %s", alsabar.cmd, alsabar.channel)
|
local format_cmd = string.format("%s get %s", alsabar.cmd, alsabar.channel)
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
|
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local async = require("lain.helpers").async
|
local helpers = require("lain.helpers")
|
||||||
local icons_dir = require("lain.helpers").icons_dir
|
|
||||||
local markup = require("lain.util.markup")
|
local markup = require("lain.util.markup")
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local naughty = require("naughty")
|
local naughty = require("naughty")
|
||||||
|
@ -67,7 +66,7 @@ function calendar.show(t_out, inc_offset, scr)
|
||||||
calendar.notification_preset.screen = src or 1
|
calendar.notification_preset.screen = src or 1
|
||||||
end
|
end
|
||||||
|
|
||||||
async(f, function(ws)
|
helpers.async(f, function(ws)
|
||||||
fg, bg = calendar.notification_preset.fg, calendar.notification_preset.bg
|
fg, bg = calendar.notification_preset.fg, calendar.notification_preset.bg
|
||||||
ws = ws:gsub("%c%[%d+[m]?%d+%c%[%d+[m]?", markup.bold(markup.color(bg, fg, today)))
|
ws = ws:gsub("%c%[%d+[m]?%d+%c%[%d+[m]?", markup.bold(markup.color(bg, fg, today)))
|
||||||
calendar.notification = naughty.notify({
|
calendar.notification = naughty.notify({
|
||||||
|
@ -83,14 +82,15 @@ function calendar.attach(widget, args)
|
||||||
local args = args or {}
|
local args = args or {}
|
||||||
calendar.cal = args.cal or "/usr/bin/cal --color=always"
|
calendar.cal = args.cal or "/usr/bin/cal --color=always"
|
||||||
calendar.followtag = args.followtag or false
|
calendar.followtag = args.followtag or false
|
||||||
calendar.icons = args.icons or icons_dir .. "cal/white/"
|
calendar.icons = args.icons or helpers.icons_dir .. "cal/white/"
|
||||||
calendar.notification_preset = args.notification_preset
|
calendar.notification_preset = args.notification_preset
|
||||||
|
|
||||||
if not calendar.notification_preset then
|
if not calendar.notification_preset then
|
||||||
calendar.notification_preset = naughty.config.defaults
|
calendar.notification_preset = {
|
||||||
calendar.notification_preset.font = "Monospace 10"
|
font = "Monospace 10",
|
||||||
calendar.notification_preset.fg = "#FFFFFF"
|
fg = "#FFFFFF",
|
||||||
calendar.notification_preset.bg = "#000000"
|
bg = "#000000"
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if widget then
|
if widget then
|
||||||
|
|
|
@ -66,9 +66,10 @@ function task.attach(widget, args)
|
||||||
task.notification_preset = args.notification_preset
|
task.notification_preset = args.notification_preset
|
||||||
|
|
||||||
if not task.notification_preset then
|
if not task.notification_preset then
|
||||||
task.notification_preset = naughty.config.defaults
|
task.notification_preset = {
|
||||||
task.notification_preset.font = "Monospace 10"
|
font = "Monospace 10",
|
||||||
task.notification_preset.icon = helpers.icons_dir .. "/taskwarrior.png"
|
icon = helpers.icons_dir .. "/taskwarrior.png"
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if widget then
|
if widget then
|
||||||
|
|
|
@ -51,10 +51,8 @@ function tpbat.show(t_out)
|
||||||
local time = bat:remaining_time()
|
local time = bat:remaining_time()
|
||||||
local msg = "\t"
|
local msg = "\t"
|
||||||
|
|
||||||
if status ~= "idle" and status ~= "nil"
|
if status ~= "idle" and status ~= "nil" then
|
||||||
then
|
if time == "N/A" then
|
||||||
if time == "N/A"
|
|
||||||
then
|
|
||||||
msg = "...Calculating time remaining..."
|
msg = "...Calculating time remaining..."
|
||||||
else
|
else
|
||||||
msg = time .. (status == "charging" and " until charged" or " remaining")
|
msg = time .. (status == "charging" and " until charged" or " remaining")
|
||||||
|
@ -67,7 +65,6 @@ function tpbat.show(t_out)
|
||||||
.. string.format("\n%s \t\t\t %s", status:upper(), msg)
|
.. string.format("\n%s \t\t\t %s", status:upper(), msg)
|
||||||
|
|
||||||
tpbat.notification = naughty.notify({
|
tpbat.notification = naughty.notify({
|
||||||
preset = naughty.config.defaults,
|
|
||||||
text = str,
|
text = str,
|
||||||
timeout = t_out,
|
timeout = t_out,
|
||||||
screen = client.focus and client.focus.screen or 1
|
screen = client.focus and client.focus.screen or 1
|
||||||
|
@ -150,6 +147,7 @@ function tpbat.register(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
widget = tpbat.widget
|
widget = tpbat.widget
|
||||||
|
|
||||||
settings()
|
settings()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -61,10 +61,11 @@ local function worker(args)
|
||||||
fs.notification_preset = args.notification_preset
|
fs.notification_preset = args.notification_preset
|
||||||
|
|
||||||
if not fs.notification_preset then
|
if not fs.notification_preset then
|
||||||
fs.notification_preset = naughty.config.defaults
|
fs.notification_preset = {
|
||||||
fs.notification_preset.font = "Monospace 10"
|
font = "Monospace 10",
|
||||||
fs.notification_preset.fg = "#FFFFFF"
|
fg = "#FFFFFF",
|
||||||
fs.notification_preset.bg = "#000000"
|
bg = "#000000"
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
helpers.set_map(partition, false)
|
helpers.set_map(partition, false)
|
||||||
|
|
|
@ -51,8 +51,8 @@ local function worker(args)
|
||||||
pulsebar.notifications = args.notification_preset
|
pulsebar.notifications = args.notification_preset
|
||||||
|
|
||||||
if not pulsebar.notification_preset then
|
if not pulsebar.notification_preset then
|
||||||
pulsebar.notification_preset = naughty.config.defaults
|
pulsebar.notification_preset = {}
|
||||||
pulsebar.notification_preset.font = "Monospace 11"
|
pulsebar.notification_preset.font = "Monospace 10"
|
||||||
end
|
end
|
||||||
|
|
||||||
pulsebar.bar = wibox.widget {
|
pulsebar.bar = wibox.widget {
|
||||||
|
|
Loading…
Add table
Reference in a new issue