Closed andynu closed 2 years ago
Hi, this is definitely interesting and I'm willing to consider it — however I don't have any familiarity with libnotify so I'm not sure how this would be used. Could you add some documentation, like a section in the readme, to this pull request?
Thank you. Those methods behave essentially the same as the growl convenience methods of the same names -- popping up a temporary notification in the corner of the screen.
I'll add some further documentation.
On Mon, Jan 27, 2020 at 1:58 PM Gabriel Gilder notifications@github.com wrote:
Hi, this is definitely interesting and I'm willing to consider it — however I don't have any familiarity with libnotify so I'm not sure how this would be used. Could you add some documentation, like a section in the readme, to this pull request?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/commander-rb/commander/pull/84?email_source=notifications&email_token=AAAONGIOIPGIK3YLS4APTKTQ74VGLA5CNFSM4KKY7WPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKAU2LI#issuecomment-578899245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAONGO3GZE2FNRAKGHW4WDQ74VGLANCNFSM4KKY7WPA .
Yeah, I guess what I'm not understanding is how someone would activate libnotify in their commander program.
Oh, I imported them the same way you did the growl convenience methods. And since someone can either have one or the other, there shouldn't be a problem of conflict/shadowing, if there were I think the order of the include would handle whichever precedence you preferred.
So exact same syntax as using the growl commands.
e.g.
#!/usr/bin/env ruby
require 'commander/import'
program :name, 'hello'
program :version, '1.0.0'
program :description, 'demo/test'
default_command :hi
command :hi do |c|
c.syntax = 'hello'
c.action do |args, options|
notify 'bare msg'
notify_info 'info msg'
notify_ok 'ok msg'
notify_warning 'warning msg'
notify_error 'error msg'
end
end
On Mon, Jan 27, 2020 at 2:04 PM Gabriel Gilder notifications@github.com wrote:
Yeah, I guess what I'm not understanding is how someone would activate libnotify in their commander program.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/commander-rb/commander/pull/84?email_source=notifications&email_token=AAAONGMA5P6JZFT4XT7UXYDQ74V3BA5CNFSM4KKY7WPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKAVNLY#issuecomment-578901679, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAONGLFJDR32TZTE3KF6QDQ74V3BANCNFSM4KKY7WPA .
I have updated it to check for the existence of the folder and to simply not include the icon if it is not present. The notification is still displayed.
(If you do specify a bogus icon the notice displays with a broken image icon).
On Fri, Jan 31, 2020 at 11:53 AM Gabriel Gilder notifications@github.com wrote:
@ggilder commented on this pull request.
In lib/commander/user_interaction.rb https://github.com/commander-rb/commander/pull/84#discussion_r373580631:
@@ -24,6 +24,44 @@ module UI include Growl end
--
Mimic growl in linux with libnotify
++
- begin
- require 'libnotify'
- rescue LoadError
Do nothing
- else
- Libnotify.icon_dirs << '/usr/share/icons/gnome/*/'
I guess this is probably fine... what is the failure mode if that directory is not present or if the requested icon image can't be found? Does the notice still display, just without an icon? Or is there an error of some kind?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/commander-rb/commander/pull/84?email_source=notifications&email_token=AAAONGIVURLPZ75XI3DLKMDRARJSNA5CNFSM4KKY7WPKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCT2ZTHQ#discussion_r373580631, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAONGMWVE36HX52X6GI4XTRARJSNANCNFSM4KKY7WPA .
I'd like to see this, sooner rather than later :D
@IotaSpencer if you'd like to open a PR with these changes and resolve the remaining issues, please do! 🥇
Hi, This is just an idea to consider. I realize that linux desktop users are in the minority compared to the macos community, but we're out there.
Provides notify, notify_info, notify_ok, notify_warning, and notify_error.