no need to set naughty.config.defaults as preset, because it's implicit; closes #290

This commit is contained in:
copycat-killer 2017-01-25 17:28:37 +01:00
parent ddbf283f0e
commit 49a4df385e
7 changed files with 41 additions and 26 deletions

View File

@ -185,6 +185,21 @@ function helpers.make_widget_textbox()
return t
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

View File

@ -50,8 +50,8 @@ local function worker(args)
alsabar.notification_preset = args.notification_preset
if not alsabar.notification_preset then
alsabar.notification_preset = naughty.config.defaults
alsabar.notification_preset.font = "Monospace 11"
alsabar.notification_preset = {}
alsabar.notification_preset.font = "Monospace 10"
end
local format_cmd = string.format("%s get %s", alsabar.cmd, alsabar.channel)

View File

@ -6,8 +6,7 @@
--]]
local async = require("lain.helpers").async
local icons_dir = require("lain.helpers").icons_dir
local helpers = require("lain.helpers")
local markup = require("lain.util.markup")
local awful = require("awful")
local naughty = require("naughty")
@ -67,7 +66,7 @@ function calendar.show(t_out, inc_offset, scr)
calendar.notification_preset.screen = src or 1
end
async(f, function(ws)
helpers.async(f, function(ws)
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)))
calendar.notification = naughty.notify({
@ -83,14 +82,15 @@ function calendar.attach(widget, args)
local args = args or {}
calendar.cal = args.cal or "/usr/bin/cal --color=always"
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
if not calendar.notification_preset then
calendar.notification_preset = naughty.config.defaults
calendar.notification_preset.font = "Monospace 10"
calendar.notification_preset.fg = "#FFFFFF"
calendar.notification_preset.bg = "#000000"
calendar.notification_preset = {
font = "Monospace 10",
fg = "#FFFFFF",
bg = "#000000"
}
end
if widget then

View File

@ -66,9 +66,10 @@ function task.attach(widget, args)
task.notification_preset = args.notification_preset
if not task.notification_preset then
task.notification_preset = naughty.config.defaults
task.notification_preset.font = "Monospace 10"
task.notification_preset.icon = helpers.icons_dir .. "/taskwarrior.png"
task.notification_preset = {
font = "Monospace 10",
icon = helpers.icons_dir .. "/taskwarrior.png"
}
end
if widget then

View File

@ -51,10 +51,8 @@ function tpbat.show(t_out)
local time = bat:remaining_time()
local msg = "\t"
if status ~= "idle" and status ~= "nil"
then
if time == "N/A"
then
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")
@ -67,10 +65,9 @@ function tpbat.show(t_out)
.. string.format("\n%s \t\t\t %s", status:upper(), msg)
tpbat.notification = naughty.notify({
preset = naughty.config.defaults,
text = str,
text = str,
timeout = t_out,
screen = client.focus and client.focus.screen or 1
screen = client.focus and client.focus.screen or 1
})
end
@ -150,6 +147,7 @@ function tpbat.register(args)
end
widget = tpbat.widget
settings()
end

View File

@ -61,10 +61,11 @@ local function worker(args)
fs.notification_preset = args.notification_preset
if not fs.notification_preset then
fs.notification_preset = naughty.config.defaults
fs.notification_preset.font = "Monospace 10"
fs.notification_preset.fg = "#FFFFFF"
fs.notification_preset.bg = "#000000"
fs.notification_preset = {
font = "Monospace 10",
fg = "#FFFFFF",
bg = "#000000"
}
end
helpers.set_map(partition, false)

View File

@ -51,8 +51,8 @@ local function worker(args)
pulsebar.notifications = args.notification_preset
if not pulsebar.notification_preset then
pulsebar.notification_preset = naughty.config.defaults
pulsebar.notification_preset.font = "Monospace 11"
pulsebar.notification_preset = {}
pulsebar.notification_preset.font = "Monospace 10"
end
pulsebar.bar = wibox.widget {