Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1881ac9

Browse files
feat(notifications): Show icon in cron notify-send notification
1 parent 62a4106 commit 1881ac9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lua/orgmode/notifications/init.lua

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ local Date = require('orgmode.objects.date')
22
local config = require('orgmode.config')
33
local utils = require('orgmode.utils')
44
local NotificationPopup = require('orgmode.notifications.notification_popup')
5+
local current_file_path = string.sub(debug.getinfo(1, 'S').source, 2)
6+
local root_path = vim.fn.fnamemodify(current_file_path, ':p:h:h:h:h')
57

68
---@class OrgNotifications
79
---@field timer table
@@ -79,11 +81,17 @@ function Notifications:_cron_notifier(tasks)
7981
local date = string.format('%s: %s', task.type, task.time:to_string())
8082

8183
if vim.fn.executable('notify-send') == 1 then
82-
vim.loop.spawn('notify-send', { args = { string.format('%s\n%s\n%s', title, subtitle, date) } })
84+
vim.system({
85+
'notify-send',
86+
('--icon=%s/assets/nvim-orgmode-small.png'):format(root_path),
87+
'--app-name=orgmode',
88+
title,
89+
string.format('%s\n%s', subtitle, date),
90+
})
8391
end
8492

8593
if vim.fn.executable('terminal-notifier') == 1 then
86-
vim.loop.spawn('terminal-notifier', { args = { '-title', title, '-subtitle', subtitle, '-message', date } })
94+
vim.system({ 'terminal-notifier', '-title', title, '-subtitle', subtitle, '-message', date })
8795
end
8896
end
8997
end

0 commit comments

Comments
 (0)