Linux MInt 19.x Mate Sounds

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
zaileion
Level 4
Level 4
Posts: 226
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

Sorry for the delay, Family time is a thing... Anyway...

I changed it to SUBSYSTEMS==

No luck.

I will leave it with an S and try the few things above and change things around and see if it works...

User avatar
MrEen
Level 18
Level 18
Posts: 8119
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

Sounds good.

I'm gone for the night. I'll check in tomorrow to see if there's any progress.

Good luck!

zaileion
Level 4
Level 4
Posts: 226
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

Ok. So. When i change the script to contain the below content it doesn't play a sound chen i run the script by itself, nor does it run when i plug the phone in.

I also changed it back to SUBSYSTEM w/o the S and tried it again and still no luck.

Code: Select all

#!/bin/bash
sudo -u zaileion canberra-gtk-play -i device-added
So i changed back to this...

Code: Select all

#!/bin/bash
XAUTHORITY="/home/zaileion/.Xauthority"
XDG_RUNTIME_DIR="/run/user/1000"
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
canberra-gtk-play -i device-added

Changing to

Code: Select all

RUN==
doesn't seem to work either with SUBSYSTEM or (S)...

rickNS
Level 5
Level 5
Posts: 698
Joined: Tue Jan 25, 2011 11:59 pm

Re: Linux MInt 19.x Mate Sounds

Post by rickNS »

MrEen wrote:
Fri Nov 01, 2019 7:03 pm
Your screenshot looks perfect.

Yes, there are sounds that will not work. If it's the same as on Xfce, the main issue is that canberra-gtk-module.c only has this:
Apparently there are some differences between XFCE, and MATE as mate has no "canberra-gtk-module.c" file (that I could find?)
the closest file is; canberra-gtk-module.desktop
MrEen wrote:
Fri Nov 01, 2019 7:03 pm
Other apps or the OS itself can add event sounds that aren't in that list. Such as Thunderbird having a sound play when new mail arrives. How each go about this, I don't know.
Yes I have got thunderbird to play a recording when new mail arrives "you've got mail.wav" (my own voice recording)
MrEen wrote:
Fri Nov 01, 2019 7:03 pm
I'm sure there's a way to capture the device connected event (ACPI listening maybe, or a udev rule?) that you could then simply play a sound file of your choosing when it occurs, but that's above my pay grade. I'll try searching and see if I find something that seems simple enough.
I'm sure too.
Couple of things I might suggest; 1) use a sound that works all the time, (I'm not able to play /usr/share/sounds/freedesktop/stereo/device-added.oga)
maybe try /usr/share/sounds/linuxmint-logout.wav, or record your own sounds.
If OP uses a sound that is further down the tree move it up to at least /usr/share/sounds, and include that full path in your code?
Mint 19.0 mate on 2 identical Thinkpad T420's

rickNS
Level 5
Level 5
Posts: 698
Joined: Tue Jan 25, 2011 11:59 pm

Re: Linux MInt 19.x Mate Sounds

Post by rickNS »

zaileion wrote:
Thu Oct 31, 2019 11:23 am
I want to add some system sounds, or activate existing but disabled system sounds.

EDIT: OK so I found several sound files in the /usr/share/sounds directory. How do I "activate" them? Screen capture, camera shutter, power connection, and many others that I would like to implement...
So you have "enable window, and button sounds" selected, do you hear the shutter when you press the "print screen" key ?

Your right many of the system sounds don't play in MATE, but that is one that does. If it's not working for you, maybe you have a deeper problem ?


sounds that do work are: print screen, volume up/down, sure there is one more , but I can't think of it.
Mint 19.0 mate on 2 identical Thinkpad T420's

zaileion
Level 4
Level 4
Posts: 226
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

Thank you. Many sounds play. Power cord connected/disconnected, Shutter, pop-out (or contextual) / right click, and others... I'm using a different sound theme (i dont like it but i checked and all the sound files do play a sound, thats why im using it for now. after we get it working ill find or build my own sound theme. Funny thing is there are many sounds in the sound theme folder but only a few actually work... See screenshot

Apparently I'm not the only one trying to do this. it goes back quite a bit... viewtopic.php?t=160437 and https://ubuntuforums.org/showthread.php?t=380002

Maybe something here will help... https://askubuntu.com/questions/14790/h ... s-inserted I noticed there are udev rules described in the 3rd post down.

Code: Select all

ACTION=="add",    RUN+="/bin/bash /path/to/my-udev-notify.sh -a add    -p '%p' -b '$attr{busnum}' -d '$attr{devnum}'"
 ACTION=="remove", RUN+="/bin/bash /path/to/my-udev-notify.sh -a remove -p '%p' -b '$attr{busnum}' -d '$attr{devnum}'"
Attachments
Selection_005.png

User avatar
MrEen
Level 18
Level 18
Posts: 8119
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

rickNS wrote:
Sat Nov 02, 2019 8:54 am
Apparently there are some differences between XFCE, and MATE as mate has no "canberra-gtk-module.c" file (that I could find?)
the closest file is; canberra-gtk-module.desktop
The .c is a source file, not a system file. It's part of the group of files that are then compiled into that .desktop and probably a similarly named .ko file. Xfce system sounds are only possible due to GTK/canberra. There's nothing in the OS itself that provides the functionality. That's what I wasn't sure about if it's the same for MATE.
rickNS wrote:
Sat Nov 02, 2019 8:54 am
I'm sure too.
Couple of things I might suggest; 1) use a sound that works all the time, (I'm not able to play /usr/share/sounds/freedesktop/stereo/device-added.oga)
maybe try /usr/share/sounds/linuxmint-logout.wav, or record your own sounds.
If OP uses a sound that is further down the tree move it up to at least /usr/share/sounds, and include that full path in your code?
That was why I used the command canberra-gtk-play -i device-added after mentioning /usr/share/sounds/freedesktop/stereo/device-added.oga must be in the selected sound theme folder. If the file exists in the folder, canberra-gtk-play will play it, as the OP found when running the script manually.
rickNS wrote:
Sat Nov 02, 2019 9:02 am
So you have "enable window, and button sounds" selected, do you hear the shutter when you press the "print screen" key ?

Your right many of the system sounds don't play in MATE, but that is one that does. If it's not working for you, maybe you have a deeper problem ?


sounds that do work are: print screen, volume up/down, sure there is one more , but I can't think of it.
I was somewhat thinking there could be an issue as well when an earlier post mentioned window minimizing and maximizing, that do work on my Xfce install, weren't working. However, we had already moved on to the udev idea so didn't pursue that, so thanks for bringing that up again, as it is worthy of investigation. And more eyes on this gives a better chance for a resolution.
zaileion wrote:
Sat Nov 02, 2019 9:24 am
Maybe something here will help... https://askubuntu.com/questions/14790/h ... s-inserted I noticed there are udev rules described in the 3rd post down.

Code: Select all

ACTION=="add",    RUN+="/bin/bash /path/to/my-udev-notify.sh -a add    -p '%p' -b '$attr{busnum}' -d '$attr{devnum}'"
 ACTION=="remove", RUN+="/bin/bash /path/to/my-udev-notify.sh -a remove -p '%p' -b '$attr{busnum}' -d '$attr{devnum}'"
That might be worth a try. They dropped the SUBSYSTEM(S) completely. See if changing your .rules file to this makes it work:

Code: Select all

ACTION=="add", RUN+="/usr/local/bin/99-deviceconnected.sh"
I still feel like that's the area preventing this from working for you. I also wonder if there're any errors generated when it doesn't work. After making the change and testing, if it doesn't work, see if journalctl | tail or dmesg | tail gives us anything useful. I have no idea if those are the appropriate places to check for this.

zaileion
Level 4
Level 4
Posts: 226
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

changed the .rules to reflect the removal of SUBSYSTEM as you specified.

No luck still...

Here is one output:
$ journalctl | tail
Nov 02 13:08:08 Dell-Latitude-7480 lircd[875]: lircd-0.10.0[875]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]*/event[0-9]*
Nov 02 13:08:08 Dell-Latitude-7480 lircd-0.10.0[875]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]*/event[0-9]*
Nov 02 13:08:09 Dell-Latitude-7480 lircd[875]: lircd-0.10.0[875]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]*/event[0-9]*
Nov 02 13:08:09 Dell-Latitude-7480 lircd-0.10.0[875]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]*/event[0-9]*
Nov 02 13:08:10 Dell-Latitude-7480 lircd[875]: lircd-0.10.0[875]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]*/event[0-9]*
Nov 02 13:08:10 Dell-Latitude-7480 lircd-0.10.0[875]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]*/event[0-9]*
Nov 02 13:08:11 Dell-Latitude-7480 ModemManager[702]: <warn> Modem couldn't be initialized: Couldn't check unlock status: Couldn't get SIM lock status after 6 retries
Nov 02 13:08:11 Dell-Latitude-7480 ModemManager[702]: <warn> couldn't initialize the modem: 'Operation was cancelled'
Nov 02 13:08:11 Dell-Latitude-7480 lircd[875]: lircd-0.10.0[875]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]*/event[0-9]*
Nov 02 13:08:11 Dell-Latitude-7480 lircd-0.10.0[875]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]*/event[0-9]*

and the 2nd output (1st the disconnect then the reconnect are listed):

$ dmesg | tail
[44652.020469] usb 1-3: USB disconnect, device number 15
[44652.020621] cdc_acm 1-3:1.1: failed to set dtr/rts
[44652.594976] usb 1-3: new high-speed USB device number 16 using xhci_hcd
[44652.747269] usb 1-3: New USB device found, idVendor=04e8, idProduct=6860
[44652.747270] usb 1-3: New USB device strings: Mfr=7, Product=8, SerialNumber=9
[44652.747271] usb 1-3: Product: SAMSUNG_Android
[44652.747272] usb 1-3: Manufacturer: SAMSUNG
[44652.747272] usb 1-3: SerialNumber: 273176a005217ece
[44652.750847] cdc_acm 1-3:1.1: ttyACM0: USB ACM device
[44797.458962] usb 1-3: USB disconnect, device number 16
zaileion@Dell-Latitude-7480:~$ dmesg | tail
[44805.887815] cdc_acm 1-3:1.1: ttyACM0: USB ACM device
[44807.721816] usb 1-3: USB disconnect, device number 17
[44807.722701] cdc_acm 1-3:1.1: failed to set dtr/rts
[44808.287372] usb 1-3: new high-speed USB device number 18 using xhci_hcd
[44808.439041] usb 1-3: New USB device found, idVendor=04e8, idProduct=6860
[44808.439049] usb 1-3: New USB device strings: Mfr=7, Product=8, SerialNumber=9
[44808.439055] usb 1-3: Product: SAMSUNG_Android
[44808.439059] usb 1-3: Manufacturer: SAMSUNG
[44808.439063] usb 1-3: SerialNumber: 273176a005217ece
[44808.445089] cdc_acm 1-3:1.1: ttyACM0: USB ACM device


If you would prefer to persue this in a different route I am all for it. Building udev rule will work on this box but will not fix it for all future installs. If there is something else we can look at that may prove to be a better resolution I'm down...
Last edited by zaileion on Sat Nov 02, 2019 1:23 pm, edited 1 time in total.

User avatar
MrEen
Level 18
Level 18
Posts: 8119
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

Nope, nothing helpful from those. I would assume a reboot takes care of it, but try running sudo udevadm control --reload then plug something in, then check dmesg again.

zaileion
Level 4
Level 4
Posts: 226
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

If you would prefer to persue this in a different route I am all for it. Building udev rule will work on this box but will not fix it for all future installs. If there is something else we can look at that may prove to be a better resolution I'm down... Its strange that some sounds work and others don't as you suggested above...

$ dmesg | tail
[45612.125322] cdc_acm 1-3:1.1: ttyACM0: USB ACM device
[45614.205367] usb 1-3: USB disconnect, device number 20
[45614.206319] cdc_acm 1-3:1.1: failed to set dtr/rts
[45614.760733] usb 1-3: new high-speed USB device number 21 using xhci_hcd
[45614.913582] usb 1-3: New USB device found, idVendor=04e8, idProduct=6860
[45614.913589] usb 1-3: New USB device strings: Mfr=7, Product=8, SerialNumber=9
[45614.913594] usb 1-3: Product: SAMSUNG_Android
[45614.913597] usb 1-3: Manufacturer: SAMSUNG
[45614.913601] usb 1-3: SerialNumber: 273176a005217ece
[45614.919578] cdc_acm 1-3:1.1: ttyACM0: USB ACM device


Yes, i was rebooting and running a udev reset command slightly different that the one you suggested... i was running sudo /etc/init.d/udev restart

zaileion
Level 4
Level 4
Posts: 226
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

just to post where I am at to make sure I'm not confused...


Also, Cinnamon has a nice system sounds GUI. Is there a way to port it to Mate?
Attachments
Selection_007.png

User avatar
MrEen
Level 18
Level 18
Posts: 8119
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

zaileion wrote:
Sat Nov 02, 2019 1:25 pm
If you would prefer to persue this in a different route I am all for it. Building udev rule will work on this box but will not fix it for all future installs. If there is something else we can look at that may prove to be a better resolution I'm down... Its strange that some sounds work and others don't as you suggested above...
We may need to change the course of action unless someone with more knowledge has a way around this.

The some sounds work while other don't is very common. Back in 2012 Lennart Poettering (sp?) declared the GTK system sounds spec complete. I honestly don't know anyone that knows how all of it is to be implemented, but there have always been issues with the canberra implementation of it, which the big one is in that list of sounds I posted earlier. Notice it doesn't include device-added. One weirdness I've discovered is trash-empty isn't in the list, but it does work for some, though I'm not one of them. I wonder if there might be a distro change causing things like that. Here's the list so you don't have to scroll back:

Code: Select all

/*
   We generate these sounds:

   dialog-error
   dialog-warning
   dialog-information
   dialog-question
   window-new
   window-close
   window-minimized
   window-unminimized
   window-maximized
   window-unmaximized
   notebook-tab-changed
   dialog-ok
   dialog-cancel
   item-selected
   link-pressed
   link-released
   button-pressed
   button-released
   menu-click
   button-toggle-on
   button-toggle-off
   menu-popup
   menu-popdown
   menu-replace
   tooltip-popup
   tooltip-popdown
   drag-start
   drag-accept
   drag-fail
   expander-toggle-on
   expander-toggle-off

   TODO:
   scroll-xxx
   window-switch
   window-resize-xxx
   window-move-xxx

*/
Also notice the "TODO" section? That was written 11 years ago, and still exists as is. So I guess it's now TODONT.

I assume it's also possible to change that .c file and compile it manually to add functionality, but that's something I'll never learn how to do. For anyone that wants a crack at it, the source is here: http://git.0pointer.net/libcanberra.git ... k-module.c

The one hack I was able to accomplish in Xfce, was to add a Startup sound and Shutdown sound, without the usual workarounds, but it required copying a file from Debian sources that Ubuntu (and therefore Mint) dropped (canberra-boot) and create one config file to make use of it.

And to give you an idea how big a task adding a GUI for System Sounds can be, here a link to the way MX Linux implements theirs: https://github.com/MX-Linux/mx-system-sounds

That's a heck of a lot of code just so their users can adjust system sounds. If I had a throwaway OS installed, I'd try cloning that and see if it works on Mint. Then see if it could also be adjusted/added to.

I'll give your issue some thought today and see if I can come up with another path. Hopefully someone else may have ideas as well.

User avatar
MrEen
Level 18
Level 18
Posts: 8119
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

zaileion wrote:
Sat Nov 02, 2019 1:36 pm

Also, Cinnamon has a nice system sounds GUI. Is there a way to port it to Mate?
That's a good question. I assume it's doable, but don't know how involved it would be. A lot of it's config stuff is in .org.cinnamon.sounds or similar. I think MATE uses a similar structure.

zaileion
Level 4
Level 4
Posts: 226
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

So i live booted Ubuntu Live USB and connected a tablet to it. It did not make any sound but did show a notification that a device was connected. Where as Linux Mint Mate used to have awesome notifications in the top right corner but does not show them any more. I wish it did...

I was also able to get start up / shut down sound by adding a start up script.

As far as cloning the MS sounds and seeing if it would work on Mint, all of the code says "MX" this or "MX" that. It seems that it would not work. but i do have a few laptops with backups made. I could clone and try to implement it.

I know how to clone into a git repo so no prob there, i just dont know how i would "implement" it into my OS. So if you had a few lines to suggest how..
lets say i have a clone in my downloads folder... how would i make that active in my current OS?

Also Cinnamon already has a very similar implementation for sounds as MX from what i can see. Would it be possible to just pull the necessary files from cinnamon and paste them into Mate? I guess you would have already said to do that if it were possible.

Well, I'll keep trying and if you or someone else thinks of any ideas, I'll be here trying to work this out... Honestly a sound events implementation for Mint Mate (only the best GUI ever) would be the best way to go, then its done for every future release... I wish i learned how to code when I was a kid (should be part of every curriculum today)... things were so much easier to learn 40+ years ago.

User avatar
MrEen
Level 18
Level 18
Posts: 8119
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

zaileion wrote:
Sat Nov 02, 2019 2:41 pm
So i live booted Ubuntu Live USB and connected a tablet to it. It did not make any sound but did show a notification that a device was connected. Where as Linux Mint Mate used to have awesome notifications in the top right corner but does not show them any more. I wish it did...
There should be a way to get that working. Not being a MATE user, I don't know how, but I'm pretty sure the functionality is there.
zaileion wrote:
Sat Nov 02, 2019 2:41 pm
As far as cloning the MS sounds and seeing if it would work on Mint, all of the code says "MX" this or "MX" that. It seems that it would not work. but i do have a few laptops with backups made. I could clone and try to implement it.

I know how to clone into a git repo so no prob there, i just dont know how i would "implement" it into my OS. So if you had a few lines to suggest how..
lets say i have a clone in my downloads folder... how would i make that active in my current OS?
Not something I've done before, but I'm sure it involves make, checkinstall and such.
zaileion wrote:
Sat Nov 02, 2019 2:41 pm
Also Cinnamon already has a very similar implementation for sounds as MX from what i can see. Would it be possible to just pull the necessary files from cinnamon and paste them into Mate? I guess you would have already said to do that if it were possible.
Again, it would involve some changes to the code before compiling. The What and Where I don't know.
zaileion wrote:
Sat Nov 02, 2019 2:41 pm
I wish i learned how to code when I was a kid (should be part of every curriculum today)... things were so much easier to learn 40+ years ago.
I did learn some back then (Fortran4, BASIC, VB6) but have forgotten almost everything after not using any of it for over a decade, well, many decades for the first two. I now wish I had stuck with it!

zaileion
Level 4
Level 4
Posts: 226
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

I booted a Live USB of Cinnamon and the funniest thing... it has the sound for device connection / disconnection... and it has a valid sound file that plays a sound... but... when i connect a device it doesn't play... seems like its broken across all Ubuntu based distros...

Edit. I was wrong. It does work! minimize, maximize, close, device connection, etc... they all work!

User avatar
MrEen
Level 18
Level 18
Posts: 8119
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

I still believe the .rules content is essentially correct, as well as the .sh content. I'm almost certain we just have an environment and/or permissions issue for the one to call the other, or for the .sh to call canberra-gtk-play. Why not try this; change the .sh file to this:

Code: Select all

#!/bin/bash
aplay /usr/share/sounds/alsa/Front_Center.wav
or this:

Code: Select all

#!/bin/bash
XAUTHORITY="/home/zaileion/.Xauthority"
XDG_RUNTIME_DIR="/run/user/1000"
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
aplay /usr/share/sounds/alsa/Front_Center.wav

zaileion
Level 4
Level 4
Posts: 226
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

HOLY SMOKES!!!

That worked!!

It said front center 3 times in a row!

I used this

Code: Select all

#!/bin/bash
XAUTHORITY="/home/zaileion/.Xauthority"
XDG_RUNTIME_DIR="/run/user/1000"
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
aplay /usr/share/sounds/alsa/Front_Center.wav

User avatar
MrEen
Level 18
Level 18
Posts: 8119
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

All right!!!

You can change that path to a sound of your choosing. Be aware that aplay cannot play oga/ogg files, but you can play any .wav file you wish.

EDIT: You should try to choose a relatively short wav file, as udev will be locked until the file is finished playing, as I understand it.

zaileion
Level 4
Level 4
Posts: 226
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

Thank you very much!!! I appreciate your effort!!

It is an excellent workaround!

Post Reply

Return to “Newbie Questions”