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
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)
--]]
-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")
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({
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
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
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")
.. 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
end
widget = tpbat.widget
+
settings()
end
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)
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 {