My laptop unplugged stands 1 minute. Previous week my laptop cable, started not connecting good with the laptop.
I would like to play a certain sound everytime it gets's unplugged so I can hurry and connect them good.. Anyone?
My laptop unplugged stands 1 minute. Previous week my laptop cable, started not connecting good with the laptop.
I would like to play a certain sound everytime it gets's unplugged so I can hurry and connect them good.. Anyone?
As explained in this answer, you have to:
cd
into your home folder and create the directory.local/share/sounds
:cd
into the newly created directory:place the desired sound inside the directory, renaming it as
power-unplug.wav
(for example in this way):test the event with:
I suppose that, at this point, you have to logout and log back in to have the event work properly. Try it and see if it works. You can find more events and sound names here.
On my Ubuntu 16.04 system, the sounds didn't fire in response to the actual events, although they would play from the test.
Eventually I wrote a script: ~/checkpower.sh
chmod +x ~/checkpower.sh
And setup a service: /etc/systemd/system/checkpower.service
Obviously, change
<myusername>
to your actual username or change that path to wherever you put the script. Should probably be in /usr/bin. Then:sudo systemctl start checkpower
and then unplug the laptop... wait until it screams. I could
systemctl status checkpower
to see the echos and errors. 'q' out of the status and go back in to update. There is probably a better way to do that.So once that worked, (and I had to change the BAT1 to BAT0 on mine) then I did a
sudo systemctl enable checkpower
and it seems to be working ok.Things I wanted to do and couldn't:
/usr/bin/notify-send -u critical "Monitoring Battery"
to display a notification. It can't find the display, and there is some weird problem with DBUS_SESSION_BUS_ADDRESS... see: Notify-send doesn't work from crontabYou can use 'cuttlefish' and 'vlc' (for example) from the Ubuntu-Software-Centre. With this fine little application you can use diffrent situations as a trigger for specific actions to be carried out.
Like for you it would be:
start cuttlefish
Now your sound should be played every time you unplug your power cable.
Download here.