corebird icon indicating copy to clipboard operation
corebird copied to clipboard

Feature request: audible alert on new tweet.

Open mr-blobbyyy opened this issue 8 years ago • 19 comments

Hello, I don't know if this has been requested before and I'm sorry if it has. I have a multi-monitor setup and have quite a bit of windows open at once so it would be nice to have Corebird sit in the system tray and issue an audible "chirp" when a new tweet comes in. Something unobtrusive, ideally 1-5 short sounds to select from. A reference sound is the chirp in Tweetz for Windows...I've grown accustomed to that sound and almost don't even hear it anymore so that's why the request for possible more sounds to choose from.

I'm in LM18 x64 MATE beta -- it has built-in pulseaudio "alert sounds" but they are semi-broken and they'll be changing over to use theming sounds instead (like in Cinnamon currently) so using something like the "default alert system sound" probably isn't going to work.

Thank you.

mr-blobbyyy avatar Jun 28 '16 12:06 mr-blobbyyy

+1 for this request. Would be very helpful for me also.

mclaborn avatar Jun 28 '16 13:06 mclaborn

I found the actual Tweetz chirp itself (for reference), Mike opened up Tweetz on github some time ago and I believe all the WPF code is there. Here it is: https://github.com/mike-ward/tweetz-desktop/blob/master/tweetz/tweetz5/Resources/notify.wav -- like I said, unobtrusive but noticeable.

mr-blobbyyy avatar Jul 01 '16 16:07 mr-blobbyyy

I still don't understand why your Desktop Environment (or the notification server rather) can't do that when showing a notification. I don't really want to work around broken sounds in MATE.

baedert avatar Jul 01 '16 17:07 baedert

@baedert I don't understand your post. Are you talking about the built-in "popup notifications" in MATE, or are you simply asking about why the default "alert sounds" are buggy in general in MATE? I have no idea...developer Clem from LM has stated they're moving away from "sound themes" and this was already done in Cinnamon. I use MATE over Cinnamon because it includes a better window manager imo (Compton) that efficiently gets rid of screen tearing, but that's beside the point.

mr-blobbyyy avatar Jul 01 '16 19:07 mr-blobbyyy

You can already configure corebird to send a notification on new tweet(s), so you could just use that and let your DE play the sound.

baedert avatar Jul 01 '16 19:07 baedert

@baedert I'm afraid "popup notifications" don't include audio alerts -- at least in MATE. Additionally, I'm seeing the option notifications -> "on new tweets" get greyed out if "auto scroll on new tweets" is enabled. I'd like to keep auto-scrolling on, just with the additional notification sound. Don't really care about "popup notifications" as they're mostly annoying anyway:)

mr-blobbyyy avatar Jul 01 '16 20:07 mr-blobbyyy

Had the same problem, so I made a patch, works fine. Anyone who wishes to use it just need to change a path to the sound file.

--- a/src/NotificationManager.vala  2016-07-15 04:06:14.866755000 +0200
+++ b/src/NotificationManager.vala  2016-07-15 21:02:28.774513076 +0200
@@ -17,6 +17,7 @@

 public class NotificationManager : GLib.Object {
   private unowned Account account;
+  private Gst.Element src;

   public NotificationManager (Account account) {
     this.account = account;
@@ -36,6 +37,9 @@
     n.set_default_action_and_target_value ("app.show-window", account.id);

     GLib.Application.get_default ().send_notification (id, n);
+   this.src = Gst.ElementFactory.make ("playbin", "sound");
+   this.src.set ("uri", "file:///home/kajzer/Documents/notify.ogg");
+   this.src.set_state (Gst.State.PLAYING);

     return id;
   }

kopr12 avatar Jul 15 '16 20:07 kopr12

Thanks for the code @kajzersoze, I'm assuming this requires a full re"make" of the app? Can you please point me in the direction for doing that?

mr-blobbyyy avatar Jul 16 '16 02:07 mr-blobbyyy

Yes, I don't know which distro you are using but I guess you didn't manually compile it. You might need to install git package and some others maybe, I'm not sure. You have instructions on main github page, under Compiling. In terminal type "git clone https://github.com/baedert/corebird" , then "cd corebird" Make a new text file in that directory and in that file put content of that patch above, save that file as sound.patch Don't forget to change the path to your desired sound file in this line : "this.src.set ("uri", "file:///home/kajzer/Documents/notify.ogg");" so change "home/kajzer/Documents/notify.ogg" to something else.

Then in terminal type "patch -p1 < sound.patch" Now you're ready to compile it , in terminal type commands below one after another, this should work : "./autogen.sh --prefix=/usr" "make" "make install"

btw I'll make a system tray patch as well, because I miss that feature too.

kopr12 avatar Jul 16 '16 11:07 kopr12

Actually using libcanberra is a proper and better way to do it so here it is :

--- a/configure.ac  2016-07-15 02:18:45.999340000 +0200
+++ b/configure.ac  2016-07-17 22:28:46.380168104 +0200
@@ -49,6 +49,7 @@
              rest-0.7 >= 0.7.93
              libsoup-2.4
              json-glib-1.0
+        libcanberra
              sqlite3"

 if test "$disable_video" = "no"; then
@@ -64,6 +65,7 @@
   --pkg rest-0.7 \
   --pkg sqlite3 \
   --pkg libsoup-2.4 \
+  --pkg libcanberra \
   --pkg glib-2.0 \
   --target-glib=2.38"
 # }}}

--- a/src/NotificationManager.vala  2016-07-15 04:06:14.866755000 +0200
+++ b/src/NotificationManager.vala  2016-07-15 21:02:28.774513076 +0200
@@ -17,6 +17,7 @@

 public class NotificationManager : GLib.Object {
   private unowned Account account;
+  private static Canberra.Context? sound_context = null;

   public NotificationManager (Account account) {
     this.account = account;
@@ -36,6 +37,9 @@
     n.set_default_action_and_target_value ("app.show-window", account.id);

     GLib.Application.get_default ().send_notification (id, n);
+   if (sound_context == null)
+     Canberra.Context.create(out sound_context);
+    sound_context.play (0, Canberra.PROP_EVENT_ID, "twitter-notify");

     return id;
   }

Sound file from mr-blobbyyy's post (https://github.com/mike-ward/tweetz-desktop/blob/master/tweetz/tweetz5/Resources/notify.wav) is very good and I'm using that one. You need to copy that one in /usr/share/sounds and name it "twitter-notify.wav" , or use any other sound file you want. I can make a commit and include in settings optional use of this feature under Notifications tab, but since author is against this feature then why bother.

Tried to do system tray, but I have some problems and honestly I don't get it at the moment. Idea was to hide the window and open it again on left click, that works but for some odd reason feeds are not updated in that case, hence no notifications etc. It does that even if I do minimize instead of close (iconify) , really odd. So I opted to remove close button from the app instead.

kopr12 avatar Jul 18 '16 17:07 kopr12

@baedert I encourage you to adopt some kind of capability of this kind. I also have the problem in that notify "On New Tweets" is disabled when "Auto scroll on new tweets" is on. Even if that works, I don't know if XFCE can trigger a sound on a notification.

The patches by @kajzersoze look decent, or you could provide a generic "run this command line on new tweet" feature. Then you wouldn't have to worry about various desktop environments, sound managers, etc.

mclaborn avatar Jul 18 '16 17:07 mclaborn

I finished implementing system tray feature, it's working great. If anyone needs it let me know.

kopr12 avatar Jul 21 '16 23:07 kopr12

@kajzersoze I see that your commit has been "verified"...I'm afraid I don't know much about github nomenclature but does that mean your change was incorporated into the latest release because I finally got around to compiling it on LM18 and still not seeing audio alerts...is your patch going to still work considering the line numbers are likely different in the 1.3 release?

@baedert It took me a while to find all the right dependencies to build 1.3 (edit: not 1.3...the current master through git cloning), but I made a list in case Ubuntu 16.04 people would like a reference to the correct packages to install, and this is probably not a comprehensive list but it might be worth it to list them on the front page as these were not installed by default on my distro:

libgtk-3-dev
libgstreamer-plugins-base1.0-dev
librest-dev
libjson-glib-dev
libsqlite3-dev
libxml2-utils

Also I had to do a sudo make install ...I'm now prepped for the newb bashing. Feel free to lay it on me.

mr-blobbyyy avatar Aug 22 '16 19:08 mr-blobbyyy

"verifed" just means I signed the commit. It wasn't incorporated, I did my best, but @baedert doesn't care about other DE's, just Gnome. I don't know if patch would still work with current master.

kopr12 avatar Aug 22 '16 19:08 kopr12

@mr-blobbyyy, btw sound will not play if "On New Tweets" is set to "Never", in all other cases it will.

Edit : in Settings under Notifications tab.

kopr12 avatar Aug 22 '16 20:08 kopr12

kajzersoze:

but @baedert doesn't care about other DE's, just Gnome.

Yes, being passive-aggressive will increase your chances of getting a workaround

...to DEs that don't support sound on notifications properly. This doesn't seem GNOME-specific at all - rather the simple fact that a notification should be just a message, and the DE should take care of grabbing the icon, playing a sound, etc.

Stop blaming developers for being reluctant to work around limitations in other people's products. If that were a general rule, none of us would ever get any of our own work done.

db-src avatar Oct 25 '16 13:10 db-src

@db0451 , I'm not blaming anybody, this was open issue and still is, I found that to be a problem as well, I proposed solution and that's it, other way would be to just set a sound-hint prior to sending a notification, much simpler solution. If there is something offensive in "doesn't care about other DE's, just Gnome." then I don't know what to say, that's my opinion and it's not based just on this specific issue. If this is not an issue then it should be closed.

kopr12 avatar Oct 25 '16 14:10 kopr12

After several months and not seeing an update on this, I'd like to ask if this is still being considered, as it's not even labeled as anything. I went distro-hopping again after getting supremely annoyed at MATE due to unrelated Caja issues and landed on XFCE which I thought was dead but pleasantly surprised by some new updates...but just getting the notification sound enabled properly is such a butt-pain. I'm not even sure the latest Ubuntu MATE supports audio notifications. I like the redmond look of gnome2, but if gnome3 is really the only practical answer to getting audio notifications, then I'll be willing to try it. Just let me push all the unnecessary windows to workspace#2 so I can get my screen real-estate back :joy: :joy:

mr-blobbyyy avatar Jan 02 '17 18:01 mr-blobbyyy

I would love to see this too! :D

BloodyIron avatar Feb 08 '18 15:02 BloodyIron