Sound effects question...

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
invex
Level 4
Level 4
Posts: 219
Joined: Sun Aug 14, 2016 12:38 pm

Sound effects question...

Post by invex »

I like to have sound effects enabled.
Is it to possible to add more sound effects?
Namely a sound effect when notifications are cleared.
TIA
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Sound effects question...

Post by catweazel »

invex wrote: Sat Sep 15, 2018 11:00 pm Is it to possible to add more sound effects?
Please post the output of this terminal command:

Code: Select all

inxi -S
Enclose the results between [ⅽode] and [/ⅽode] code markers by selecting </> from the mini toolbar above the textbox where you type your reply.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
User avatar
invex
Level 4
Level 4
Posts: 219
Joined: Sun Aug 14, 2016 12:38 pm

Re: Sound effects question...

Post by invex »

Code: Select all

System:    Host: Invex-Mint Kernel: 4.15.0-041500-generic x86_64 bits: 64
           Desktop: Cinnamon 3.8.9  Distro: Linux Mint 19 Tara
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Sound effects question...

Post by smurphos »

invex wrote: Sat Sep 15, 2018 11:00 pm Is it to possible to add more sound effects?
Namely a sound effect when notifications are cleared.
Open the Sound settings module, navigate to the Sounds tab and switch the toggle for Notification sounds on.

Image
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
invex
Level 4
Level 4
Posts: 219
Joined: Sun Aug 14, 2016 12:38 pm

Re: Sound effects question...

Post by invex »

Thx.
I have Notification sound on.
I'd like to add a sound effect when I click on Clear notifications.
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Sound effects question...

Post by smurphos »

That's not quite so simple.... :)

You'll need to modify the default notification tray applet to do that.

Step 1:

Copy the default applet folder /usr/share/cinnamon/applets/notifications@cinnamon.org to ~/.local/share/cinnamon/applets/notifications@cinnamon.org

Step 2:

Open ~/.local/share/cinnamon/applets/notifications@cinnamon.org/applet.js in your favorite text editor - ideally one that supports line numbers (The default editor xed does if you turn them on in it's preferences)

Navigate to line 195 - you will see a function that looks like this

Code: Select all

_clear_all() {
        let count = this.notifications.length;
        if (count > 0) {
            for (let i = count-1; i >=0; i--) {
                this._notificationbin.remove_actor(this.notifications[i].actor);
                this.notifications[i].destroy(NotificationDestroyedReason.DISMISSED);
            }
        }
        this.notifications = [];
        this.update_list();
    }
Add the line Main.soundManager.play('notification'); so it looks like this. Save the file. Hit Ctrl-Alt-Escape to restart Cinnamon. if it hangs for a bit just hit Ctrl-Alt-Escape again. You'll get the same notification sound on clearing notifications as you do when a new one comes in. If you want to pick a different sound the valid values are - "switch", "close", "map", "minimize", "maximize", "unmaximize", "tile", "login", "plug", "unplug", "notification"

Code: Select all

_clear_all() {
        let count = this.notifications.length;
        if (count > 0) {
            for (let i = count-1; i >=0; i--) {
                this._notificationbin.remove_actor(this.notifications[i].actor);
                this.notifications[i].destroy(NotificationDestroyedReason.DISMISSED);
            }
        }
        this.notifications = [];
        this.update_list();
        Main.soundManager.play('notification');
    }
I'm sure you can also set a totally custom sound, just not quite sure how at time of writing. If I work it out I'll post back.... :)
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Sound effects question...

Post by smurphos »

To add a completely custom sound for clear notifications the line to add is

Main.soundManager.playSoundFile(0, '/path/to/soundfile');

e.g...

Main.soundManager.playSoundFile(0, '/usr/share/sounds/freedesktop/stereo/trash-empty.oga');
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
invex
Level 4
Level 4
Posts: 219
Joined: Sun Aug 14, 2016 12:38 pm

Re: Sound effects question...

Post by invex »

Thanks a lot.

I'm sure I didn't make a mistake when I added:
Main.soundManager.playSoundFile(0, '/usr/share/mint-artwork/sounds/clearnotification.oga');

But it didn't work. No sound effect when I click 'Clear notifications'.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Sound effects question...

Post by MrEen »

invex wrote: Mon Sep 17, 2018 12:16 am But it didn't work. No sound effect when I click 'Clear notifications'.
Did you restart Cinnamon?
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Sound effects question...

Post by smurphos »

There isn't a clearnotifications.oga in that location. You need to provide the path to an existing sound file. That might be one that is preinstalled or might be one you have downloaded, or might be one you've created from scratch.

The default sound files available on a Mint 19 systems are in 3 locations.

Code: Select all

$ ls -1 /usr/share/mint-artwork/sounds
close.oga
login.oga
logout.ogg
map.oga
maximize.oga
minimize.oga
notification.oga
plug.oga
switch.oga
tile.oga
trash.oga
unmaximize.oga
unplug.oga
volume.oga
&

Code: Select all

$ ls -1 /usr/share/sounds/LinuxMint/stereo
button-pressed.ogg
button-toggle-off.ogg
button-toggle-on.ogg
desktop-login.ogg
desktop-logout.ogg
dialog-error.ogg
dialog-information.ogg
dialog-question.ogg
dialog-question.wav
dialog-warning.ogg
phone-incoming-call.ogg
system-ready.ogg
window-slide.ogg
&

Code: Select all

$ ls -1 /usr/share/sounds/freedesktop/stereo
alarm-clock-elapsed.oga
audio-channel-front-center.oga
audio-channel-front-left.oga
audio-channel-front-right.oga
audio-channel-mono.oga
audio-channel-rear-center.oga
audio-channel-rear-left.oga
audio-channel-rear-right.oga
audio-channel-side-left.oga
audio-channel-side-right.oga
audio-test-signal.oga
audio-volume-change.oga
bell.oga
camera-shutter.oga
complete.oga
device-added.oga
device-removed.oga
dialog-error.oga
dialog-information.oga
dialog-warning.oga
message-new-instant.oga
message.oga
network-connectivity-established.oga
network-connectivity-lost.oga
onboard-key-feedback.oga
phone-incoming-call.oga
phone-outgoing-busy.oga
phone-outgoing-calling.oga
power-plug.oga
power-unplug.oga
screen-capture.oga
service-login.oga
service-logout.oga
suspend-error.oga
trash-empty.oga
window-attention.oga
window-question.oga
You can find additional sound-themes in the repos to get more choices e.g. apt install oxygen-sounds ubuntu-sounds

You can also look here for more user-created sound-themes - https://www.opendesktop.org/browse/cat/316/order/latest
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
invex
Level 4
Level 4
Posts: 219
Joined: Sun Aug 14, 2016 12:38 pm

Re: Sound effects question...

Post by invex »

Thank you again.
I feel so stupid.
No, I didn't restart Cinnamon.
When I did, everything worked fine.
Thank you VERY much!
You have no idea how happy this small tweak makes me :)
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Sound effects question...

Post by smurphos »

You are welcome - I learnt a few new things myself checking this out... :), and I like having a few more sound-effects too.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
invex
Level 4
Level 4
Posts: 219
Joined: Sun Aug 14, 2016 12:38 pm

Re: Sound effects question...

Post by invex »

I'd like to create a script which would display notifications (the same like clicking the notification icon in the panel), display them for 1 second, delete them and exit.
I didn't get very far :)
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Sound effects question...

Post by MrEen »

Not sure of the purpose, but you can use notify-send in a script or the terminal like this: notify-send --expire-time=1000 My 1 second notification is better than Hello World!

This works on Xfce, but the Ubuntu man page shows this for --expire-time: The duration, in milliseconds, for the notification to appear on screen. (Ubuntu's Notify OSD and GNOME Shell both ignore this parameter.) I'm not sure if this affects Cinnamon or not.
User avatar
invex
Level 4
Level 4
Posts: 219
Joined: Sun Aug 14, 2016 12:38 pm

Re: Sound effects question...

Post by invex »

Thank you but it's not the same as clicking on the panel notification icon.
And the purpose?
I have to clear notifications many, many times a day. I'd like to bring the mouse cursor to the bottom left corner (hot corner) to execute a script which would show me notifications for 1 second and then automatically delete them (the same as clicking Clear notifications) .
User avatar
invex
Level 4
Level 4
Posts: 219
Joined: Sun Aug 14, 2016 12:38 pm

Re: Sound effects question...

Post by invex »

Thank you very much.
I had no idea that the sounds are in 3 different locations.
However, how would I enable for example trash-empty.oga?
Sound/Sounds has only 13 sound effects available. No Trash Empty.
smurphos wrote: Mon Sep 17, 2018 12:50 am There isn't a clearnotifications.oga in that location. You need to provide the path to an existing sound file. That might be one that is preinstalled or might be one you have downloaded, or might be one you've created from scratch.

The default sound files available on a Mint 19 systems are in 3 locations.

Code: Select all

$ ls -1 /usr/share/mint-artwork/sounds
close.oga
login.oga
logout.ogg
map.oga
maximize.oga
minimize.oga
notification.oga
plug.oga
switch.oga
tile.oga
trash.oga
unmaximize.oga
unplug.oga
volume.oga
&

Code: Select all

$ ls -1 /usr/share/sounds/LinuxMint/stereo
button-pressed.ogg
button-toggle-off.ogg
button-toggle-on.ogg
desktop-login.ogg
desktop-logout.ogg
dialog-error.ogg
dialog-information.ogg
dialog-question.ogg
dialog-question.wav
dialog-warning.ogg
phone-incoming-call.ogg
system-ready.ogg
window-slide.ogg
&

Code: Select all

$ ls -1 /usr/share/sounds/freedesktop/stereo
alarm-clock-elapsed.oga
audio-channel-front-center.oga
audio-channel-front-left.oga
audio-channel-front-right.oga
audio-channel-mono.oga
audio-channel-rear-center.oga
audio-channel-rear-left.oga
audio-channel-rear-right.oga
audio-channel-side-left.oga
audio-channel-side-right.oga
audio-test-signal.oga
audio-volume-change.oga
bell.oga
camera-shutter.oga
complete.oga
device-added.oga
device-removed.oga
dialog-error.oga
dialog-information.oga
dialog-warning.oga
message-new-instant.oga
message.oga
network-connectivity-established.oga
network-connectivity-lost.oga
onboard-key-feedback.oga
phone-incoming-call.oga
phone-outgoing-busy.oga
phone-outgoing-calling.oga
power-plug.oga
power-unplug.oga
screen-capture.oga
service-login.oga
service-logout.oga
suspend-error.oga
trash-empty.oga
window-attention.oga
window-question.oga
You can find additional sound-themes in the repos to get more choices e.g. apt install oxygen-sounds ubuntu-sounds

You can also look here for more user-created sound-themes - https://www.opendesktop.org/browse/cat/316/order/latest
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Sound effects question...

Post by smurphos »

invex wrote: Mon Sep 17, 2018 7:23 pm Thank you very much.
I had no idea that the sounds are in 3 different locations.
However, how would I enable for example trash-empty.oga?
Sound/Sounds has only 13 sound effects available. No Trash Empty.
Yeah it looks like Cinnamon only implements a subset of the available sounds. Enabling trash noises I think would probably require modification to Nemo's source code which is a step above hacking some extra noise into Cinnamon applets.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
ckonn
Level 3
Level 3
Posts: 180
Joined: Wed Oct 01, 2014 7:03 pm

Re: Sound effects question...

Post by ckonn »

smurphos wrote: Sun Sep 16, 2018 12:02 am
invex wrote: Sat Sep 15, 2018 11:00 pm Is it to possible to add more sound effects?
Namely a sound effect when notifications are cleared.
Open the Sound settings module, navigate to the Sounds tab and switch the toggle for Notification sounds on.

Image
is there the same ' Sound settings module' for linux mint mate edition also like in Cinnemon?
there is 'Sound' in menu---> control center in mate edition but it does not have the same options like Cinnemon's one.
Locked

Return to “Cinnamon”