-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
_: { | ||
imports = [ | ||
./notify.nix | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
_: { | ||
programs.nixvim = { | ||
plugins.notify = { | ||
enable = true; | ||
backgroundColour = "#000000"; | ||
fps = 60; | ||
render = "default"; | ||
timeout = 500; | ||
topDown = true; | ||
}; | ||
keymaps = [ | ||
{ | ||
mode = "n"; | ||
key = "<leader>un"; | ||
action = '' | ||
<cmd>lua require("notify").dismiss({ silent = true, pending = true })<cr> | ||
''; | ||
options = { | ||
desc = "Dismiss All Notifications"; | ||
}; | ||
} | ||
]; | ||
extraConfigLua = '' | ||
local notify = require("notify") | ||
local filtered_message = { "No information available" } | ||
-- Override notify function to filter out messages | ||
---@diagnostic disable-next-line: duplicate-set-field | ||
vim.notify = function(message, level, opts) | ||
local merged_opts = vim.tbl_extend("force", { | ||
on_open = function(win) | ||
local buf = vim.api.nvim_win_get_buf(win) | ||
vim.api.nvim_buf_set_option(buf, "filetype", "markdown") | ||
end, | ||
}, opts or {}) | ||
for _, msg in ipairs(filtered_message) do | ||
if message == msg then | ||
return | ||
end | ||
end | ||
return notify(message, level, merged_opts) | ||
end | ||
''; | ||
}; | ||
} |