mirror of https://github.com/lcpz/lain.git
show notification window in focused screen
This commit is contained in:
parent
0f5ce4dd76
commit
4b634be781
|
@ -54,22 +54,22 @@ local alsabar =
|
||||||
function alsabar.notify()
|
function alsabar.notify()
|
||||||
alsabar.update()
|
alsabar.update()
|
||||||
|
|
||||||
local preset =
|
local preset =
|
||||||
{
|
{
|
||||||
title = "",
|
title = "",
|
||||||
text = "",
|
text = "",
|
||||||
timeout = 4,
|
timeout = 4,
|
||||||
font = alsabar.notifications.font .. " " ..
|
font = alsabar.notifications.font .. " " ..
|
||||||
alsabar.notifications.font_size,
|
alsabar.notifications.font_size,
|
||||||
fg = alsabar.notifications.color
|
fg = alsabar.notifications.color
|
||||||
}
|
}
|
||||||
|
|
||||||
if alsabar._muted
|
if alsabar._muted
|
||||||
then
|
then
|
||||||
preset.title = alsabar.channel .. " - Muted"
|
preset.title = alsabar.channel .. " - Muted"
|
||||||
else
|
else
|
||||||
preset.title = alsabar.channel .. " - " .. alsabar._current_level * 100 .. "%"
|
preset.title = alsabar.channel .. " - " .. alsabar._current_level * 100 .. "%"
|
||||||
end
|
end
|
||||||
|
|
||||||
int = math.modf(alsabar._current_level * alsabar.notifications.bar_size)
|
int = math.modf(alsabar._current_level * alsabar.notifications.bar_size)
|
||||||
preset.text = "["
|
preset.text = "["
|
||||||
|
@ -78,15 +78,17 @@ function alsabar.notify()
|
||||||
.. "]"
|
.. "]"
|
||||||
|
|
||||||
if alsabar._notify ~= nil then
|
if alsabar._notify ~= nil then
|
||||||
alsabar._notify = naughty.notify ({
|
alsabar._notify = naughty.notify ({
|
||||||
replaces_id = alsabar._notify.id,
|
replaces_id = alsabar._notify.id,
|
||||||
preset = preset
|
preset = preset,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
alsabar._notify = naughty.notify ({
|
alsabar._notify = naughty.notify ({
|
||||||
preset = preset
|
preset = preset,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function worker(args)
|
local function worker(args)
|
||||||
|
|
|
@ -129,13 +129,15 @@ local function worker(args)
|
||||||
then
|
then
|
||||||
bat.id = naughty.notify({
|
bat.id = naughty.notify({
|
||||||
preset = bat_notification_critical_preset,
|
preset = bat_notification_critical_preset,
|
||||||
replaces_id = bat.id
|
replaces_id = bat.id,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
}).id
|
}).id
|
||||||
elseif nperc <= 15
|
elseif nperc <= 15
|
||||||
then
|
then
|
||||||
bat.id = naughty.notify({
|
bat.id = naughty.notify({
|
||||||
preset = bat_notification_low_preset,
|
preset = bat_notification_low_preset,
|
||||||
replaces_id = bat.id
|
replaces_id = bat.id,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
}).id
|
}).id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -98,7 +98,8 @@ function calendar:show(t_out, inc_offset)
|
||||||
position = calendar.position,
|
position = calendar.position,
|
||||||
fg = calendar.fg,
|
fg = calendar.fg,
|
||||||
bg = calendar.bg,
|
bg = calendar.bg,
|
||||||
timeout = tims
|
timeout = tims,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,9 @@ function task:show()
|
||||||
position = task.position,
|
position = task.position,
|
||||||
fg = task.fg,
|
fg = task.fg,
|
||||||
bg = task.bg,
|
bg = task.bg,
|
||||||
timeout = task.timeout })
|
timeout = task.timeout,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function task:prompt_add()
|
function task:prompt_add()
|
||||||
|
@ -72,7 +74,8 @@ function task:prompt_add()
|
||||||
position = task.position,
|
position = task.position,
|
||||||
fg = task.fg,
|
fg = task.fg,
|
||||||
bg = task.bg,
|
bg = task.bg,
|
||||||
timeout = task.timeout
|
timeout = task.timeout,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
nil,
|
nil,
|
||||||
|
@ -105,7 +108,8 @@ function task:prompt_search()
|
||||||
position = task.position,
|
position = task.position,
|
||||||
fg = task.fg,
|
fg = task.fg,
|
||||||
bg = task.bg,
|
bg = task.bg,
|
||||||
timeout = task.timeout
|
timeout = task.timeout,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
nil,
|
nil,
|
||||||
|
|
|
@ -75,7 +75,8 @@ function tpbat:show(t_out)
|
||||||
tpbat_notification = naughty.notify({
|
tpbat_notification = naughty.notify({
|
||||||
preset = { fg = beautiful.fg_normal },
|
preset = { fg = beautiful.fg_normal },
|
||||||
text = str,
|
text = str,
|
||||||
timeout = t_out
|
timeout = t_out,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -111,7 +112,8 @@ function tpbat.register(args)
|
||||||
local n = naughty.notify({
|
local n = naughty.notify({
|
||||||
preset = bat_notification_low_preset,
|
preset = bat_notification_low_preset,
|
||||||
title = "SMAPI Battery Warning: Unable to read battery state!",
|
title = "SMAPI Battery Warning: Unable to read battery state!",
|
||||||
text = "This widget is intended for ThinkPads. Is tp_smapi installed? Check your configs & paths."
|
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
|
end
|
||||||
|
|
||||||
|
@ -137,13 +139,15 @@ function tpbat.register(args)
|
||||||
then
|
then
|
||||||
tpbat.id = naughty.notify({
|
tpbat.id = naughty.notify({
|
||||||
preset = bat_notification_critical_preset,
|
preset = bat_notification_critical_preset,
|
||||||
replaces_id = tpbat.id
|
replaces_id = tpbat.id,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
}).id
|
}).id
|
||||||
elseif bat_now.perc <= 15
|
elseif bat_now.perc <= 15
|
||||||
then
|
then
|
||||||
tpbat.id = naughty.notify({
|
tpbat.id = naughty.notify({
|
||||||
preset = bat_notification_low_preset,
|
preset = bat_notification_low_preset,
|
||||||
replaces_id = tpbat.id
|
replaces_id = tpbat.id,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
}).id
|
}).id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,7 +46,8 @@ function fs:show(t_out)
|
||||||
notification = naughty.notify({
|
notification = naughty.notify({
|
||||||
preset = fs_notification_preset,
|
preset = fs_notification_preset,
|
||||||
text = ws,
|
text = ws,
|
||||||
timeout = t_out
|
timeout = t_out,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -66,7 +67,6 @@ local function worker(args)
|
||||||
function update()
|
function update()
|
||||||
fs_info = {}
|
fs_info = {}
|
||||||
fs_now = {}
|
fs_now = {}
|
||||||
|
|
||||||
local f = io.popen("LC_ALL=C df -kP " .. partition)
|
local f = io.popen("LC_ALL=C df -kP " .. partition)
|
||||||
|
|
||||||
for line in f:lines() do -- Match: (size) (used)(avail)(use%) (mount)
|
for line in f:lines() do -- Match: (size) (used)(avail)(use%) (mount)
|
||||||
|
@ -99,7 +99,8 @@ local function worker(args)
|
||||||
text = partition .. " ran out!\nmake some room",
|
text = partition .. " ran out!\nmake some room",
|
||||||
timeout = 8,
|
timeout = 8,
|
||||||
fg = "#000000",
|
fg = "#000000",
|
||||||
bg = "#FFFFFF"
|
bg = "#FFFFFF",
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
})
|
})
|
||||||
helpers.set_map("fs", true)
|
helpers.set_map("fs", true)
|
||||||
else
|
else
|
||||||
|
|
|
@ -74,7 +74,11 @@ local function worker(args)
|
||||||
else
|
else
|
||||||
nt = mail .. " has <b>" .. mailcount .. "</b> new messages"
|
nt = mail .. " has <b>" .. mailcount .. "</b> new messages"
|
||||||
end
|
end
|
||||||
naughty.notify({ preset = mail_notification_preset, text = nt })
|
naughty.notify({
|
||||||
|
preset = mail_notification_preset,
|
||||||
|
text = nt,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
helpers.set_map(mail, mailcount)
|
helpers.set_map(mail, mailcount)
|
||||||
|
|
|
@ -92,7 +92,8 @@ local function worker(args)
|
||||||
mpd.id = naughty.notify({
|
mpd.id = naughty.notify({
|
||||||
preset = mpd_notification_preset,
|
preset = mpd_notification_preset,
|
||||||
icon = "/tmp/mpdcover.png",
|
icon = "/tmp/mpdcover.png",
|
||||||
replaces_id = mpd.id
|
replaces_id = mpd.id,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
}).id
|
}).id
|
||||||
end
|
end
|
||||||
elseif mpd_now.state ~= "pause"
|
elseif mpd_now.state ~= "pause"
|
||||||
|
|
|
@ -87,7 +87,8 @@ local function worker(args)
|
||||||
timeout = 7,
|
timeout = 7,
|
||||||
position = "top_left",
|
position = "top_left",
|
||||||
icon = helpers.icons_dir .. "no_net.png",
|
icon = helpers.icons_dir .. "no_net.png",
|
||||||
fg = notify_fg or "#FFFFFF"
|
fg = notify_fg or "#FFFFFF",
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
})
|
})
|
||||||
helpers.set_map(iface, false)
|
helpers.set_map(iface, false)
|
||||||
end
|
end
|
||||||
|
|
|
@ -161,7 +161,8 @@ function yawn.show(t_out)
|
||||||
preset = yawn_notification_preset,
|
preset = yawn_notification_preset,
|
||||||
text = weather_data,
|
text = weather_data,
|
||||||
icon = sky,
|
icon = sky,
|
||||||
timeout = t_out
|
timeout = t_out,
|
||||||
|
screen = client.focus and client.focus.screen or 1
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue