T
T
tarker2013-04-06 11:56:50
linux
tarker, 2013-04-06 11:56:50

power management in ubuntu

Good day to all)
Please tell me some alternative to the standard power management programs from gnome-control-center in Ubuntu 12.10 (unity), or just another solution to the problem described below.
It is necessary that when the laptop is disconnected from the power, a warning is instantly displayed (preferably with a sound). In the power and brightness options there is a checkbox "Reduce brightness to save power", and this would be enough in principle, but it only works in case of low battery. It is necessary that it signal immediately =(
Unity itself, of course, notifies about a power outage with an icon on the panel, but with a delay and inconspicuous)

Thank you in advance!

Answer the question

In order to leave comments, you need to log in

5 answer(s)
J
jcmvbkbc, 2013-04-07
@jcmvbkbc

Place the 10-mains-alert.sh script in /etc/pm/power.d:

#! /bin/bash

if ! /usr/bin/on_ac_power
then
    # код предупреждения здесь, например
    xmessage '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
fi

T
tarker, 2013-04-07
@tarker

Thanks for the advice, and sorry for the ignorance) but for some reason this method does not work.
I placed the script, gave it rights 777, just in case) And the script works if run manually (when the power is off, it displays a message), but on the machine it doesn’t = (what could be the trouble?

J
jcmvbkbc, 2013-04-07
@jcmvbkbc

or just another solution

In KDE: System Settings -> Power Management -> Advanced Settings -> Configure Notifications -> AC Adapter unplugged

F
Fantiney, 2013-06-15
@Fantiney

You can also set up alerts via power.sh and notify

sudo gedit /etc/acpi/power.sh

add
if on_ac_power; then
 notify-send "Система электропитания" "Питание подключено" -i gtk-info
else
 notify-send "Система электропитания" "Питание отключено" -i gtk-info
fi

You can add it right after the line #! / bin / sh
After saving and executing
sudo chmod +x /etc/acpi/power.sh

Should work, didn't test it myself

F
Fantiney, 2013-06-15
@Fantiney

uh… I didn’t understand how to edit the written message here…
in short, here is the code for power.sh with sound:

if on_ac_power; then
 notify-send "Система электропитания" "Питание подключено" -i gtk-info
 /usr/bin/canberra-gtk-play --id="service-login" --volume=7
else
 notify-send "Система электропитания" "Питание отключено" -i gtk-info
 /usr/bin/canberra-gtk-play --id="service-logout" --volume=7
fi

You can choose any standard sound from /usr/share/sounds/ubuntu/stereo or push your own

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question