Closed j-hui closed 2 years ago
Came here to make an issue specifically for that last bit.
Btw are you thinking about using notify to render fidget?
@RaafatTurki yes (:
Is it possible expose options to display the notification window in a different corner of the editor window?
Currently the workaround is to copy one of the built-in stages and hack it to work, but this seems like it could be made easier with an option.
I've purposefully not made the stages have configurable options because there are plenty of options that people could want tweaked. I'd prefer they used the (IMO) simple DSL provided directly. If there's a common use case then it could be added to the built-in stages or be provided by another plugin. I'm not absolutely against the idea I just don't see much of an advantage to it.
Furthermore, would it be possible to use a different stages animation per-notification?
Each of the built-in stages take into account the existing notification windows to place themselves. You'd have to have handle which windows will collide with others as there's no way nvim-notify would know which windows are grouped together.
As you're trying to use this for your own plugin, you could provide users with a custom stages definition that could wrap the stages that they use by default and handle the splitting up of windows. I'd be happy to help with any issues, I believe this would be completely feasible with the current implementation (but could be wrong ofc :sweat_smile:)
@rcarriga
You'd have to have handle which windows will collide with others as there's no way nvim-notify would know which windows are grouped together.
I was thinking of a much simpler solution where one could setup multiple instances of nvim_notify
with each having its own z-index.
I like the separate instances idea actually. I've created a PR #96 with the implementation. Please try it out and if you have any thoughts please let me know.
I've merged the ability to add to have separate notify instances. This allows for separate configs to send notifications that won't interfere with each other, which should be sufficient for your use case (fidget.nvim)
So how to move it to a corner other than top-right one? It's still not clear after reading.
You have to use custom animation stages as described here https://github.com/rcarriga/nvim-notify#animation-style. The built-in stages are just meant to be out of the box solutions/examples not fully fleshed out/configurable.
@rcarriga For example say I have looked up fade_in_slide_out.lua, where should I put the return value in the config?
Here's an example for fade in slide out but starting from the bottom right.
The only difference is the stages_util.DIRECTION.BOTTOM_UP
passed to the util function to get the next available row on the screen.
local stages_util = require("notify.stages.util")
require("notify").setup({
stages = {
function(state)
local next_height = state.message.height + 2
local next_row = stages_util.available_slot(
state.open_windows,
next_height,
stages_util.DIRECTION.BOTTOM_UP
)
if not next_row then
return nil
end
return {
relative = "editor",
anchor = "NE",
width = state.message.width,
height = state.message.height,
col = vim.opt.columns:get(),
row = next_row,
border = "rounded",
style = "minimal",
opacity = 0,
}
end,
function()
return {
opacity = { 100 },
col = { vim.opt.columns:get() },
}
end,
function()
return {
col = { vim.opt.columns:get() },
time = true,
}
end,
function()
return {
width = {
1,
frequency = 2.5,
damping = 0.9,
complete = function(cur_width)
return cur_width < 3
end,
},
opacity = {
0,
frequency = 2,
complete = function(cur_opacity)
return cur_opacity <= 4
end,
},
col = { vim.opt.columns:get() },
}
end,
},
})
Going to close this as I believe the requirements are met.
Is it possible expose options to display the notification window in a different corner of the editor window?
Currently the workaround is to copy one of the built-in stages and hack it to work, but this seems like it could be made easier with an option.
Furthermore, would it be possible to use a dfiferent
stages
animation per-notification?