Skip to content

Commit

Permalink
feat(notifications): Show icon in cron notify-send notification
Browse files Browse the repository at this point in the history
  • Loading branch information
kristijanhusak committed Jan 22, 2025
1 parent 62a4106 commit 1881ac9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lua/orgmode/notifications/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ local Date = require('orgmode.objects.date')
local config = require('orgmode.config')
local utils = require('orgmode.utils')
local NotificationPopup = require('orgmode.notifications.notification_popup')
local current_file_path = string.sub(debug.getinfo(1, 'S').source, 2)
local root_path = vim.fn.fnamemodify(current_file_path, ':p:h:h:h:h')

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

if vim.fn.executable('notify-send') == 1 then
vim.loop.spawn('notify-send', { args = { string.format('%s\n%s\n%s', title, subtitle, date) } })
vim.system({
'notify-send',
('--icon=%s/assets/nvim-orgmode-small.png'):format(root_path),
'--app-name=orgmode',
title,
string.format('%s\n%s', subtitle, date),
})
end

if vim.fn.executable('terminal-notifier') == 1 then
vim.loop.spawn('terminal-notifier', { args = { '-title', title, '-subtitle', subtitle, '-message', date } })
vim.system({ 'terminal-notifier', '-title', title, '-subtitle', subtitle, '-message', date })
end
end
end
Expand Down

0 comments on commit 1881ac9

Please sign in to comment.