GUI 方法

GUI 方法

我为我的笔记本电脑买了新电池。它运行的是 Ubuntu MATE 16.04.5 LTS。

这款新电池容量正常,充电正常,使用寿命长:)

但我有一个小问题:当电池电量低于某个水平时,笔记本电脑会立即关机。我记得,使用旧电池时它通常会进入挂起状态。

使用新电池,我可以手动暂停,并且所有与暂停相关的测试(例如pm-is-supported --suspend,,)都返回 0,因此这些操作是受支持的。pm-is-supported --hibernatepm-is-supported --suspend-hybrid

为了获得更多的预测结果,我已重置所有设置

gsettings reset-recursively org.mate.power-manager

因此我的 GSettings 报告以下内容:

$ gsettings list-recursively | egrep "critical|action|low|time" | grep -i power | sort -u
org.mate.power-manager action-critical-battery 'hibernate'
org.mate.power-manager action-critical-ups 'shutdown'
org.mate.power-manager action-low-ups 'hibernate'
org.mate.power-manager action-sleep-type-ac 'suspend'
org.mate.power-manager action-sleep-type-battery 'hibernate'
org.mate.power-manager idle-dim-time 10
org.mate.power-manager info-history-time 21600
org.mate.power-manager notify-low-capacity true
org.mate.power-manager notify-low-power true
org.mate.power-manager percentage-action 2
org.mate.power-manager percentage-critical 3
org.mate.power-manager percentage-low 10
org.mate.power-manager show-actions true
org.mate.power-manager time-action 120
org.mate.power-manager time-critical 300
org.mate.power-manager time-low 1200
org.mate.power-manager use-time-for-policy true

/etc/UPower/UPower.conf有默认值:

$ cat /etc/UPower/UPower.conf | grep -v ^# | egrep "Critical|Low|Action|Time"
PercentageLow=10
PercentageCritical=3
PercentageAction=2
TimeLow=1200
TimeCritical=300
TimeAction=120
CriticalPowerAction=HybridSleep

MATE 电源管理首选项 ( mate-power-preferences) 没有用于设置临界电池电量的 GUI 元素:

配偶权力偏好

我应该在哪里从 MATE GUI 设置休眠或挂起的临界电池电量?
通过 GSettings 或 Dconf 更改值会更改中的值UPower.conf吗?
我还应该在哪里设置临界电池电量的操作?


更新:
1. 笔记本电脑型号为 Asustek UX32A。
输出cat /sys/class/power_supply/BAT0/uevent

POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=481
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=7400000
POWER_SUPPLY_VOLTAGE_NOW=7400000
POWER_SUPPLY_POWER_NOW=11151000
POWER_SUPPLY_ENERGY_FULL_DESIGN=48248000
POWER_SUPPLY_ENERGY_FULL=50038000
POWER_SUPPLY_ENERGY_NOW=46346000
POWER_SUPPLY_CAPACITY=92
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_MODEL_NAME=UX32-65
POWER_SUPPLY_MANUFACTURER=ASUSTeK
POWER_SUPPLY_SERIAL_NUMBER= 

并输出upower --dump

Device: /org/freedesktop/UPower/devices/line_power_AC0
  native-path:          AC0
  power supply:         yes
  updated:              Sun Nov  4 12:43:52 2018 (233 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              no
    icon-name:          'ac-adapter-symbolic'

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               ASUSTeK
  model:                UX32-65
  power supply:         yes
  updated:              Sun Nov  4 12:45:52 2018 (113 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              46.509 Wh
    energy-empty:        0 Wh
    energy-full:         46.916 Wh
    energy-full-design:  48.248 Wh
    energy-rate:         11.514 W
    voltage:             7.4 V
    time to empty:       4.0 hours
    percentage:          92%
    capacity:            81.4562%
    technology:          lithium-ion
    icon-name:          'battery-full-symbolic'
  History (charge):
    1541324752  92.000  discharging
  History (rate):
    1541324752  11.514  discharging

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         yes
  updated:              Sun Nov  4 12:45:52 2018 (113 seconds ago)
  has history:          no
  has statistics:       no
  battery
    present:             yes
    state:               discharging
    warning-level:       none
    energy:              46.509 Wh
    energy-full:         46.916 Wh
    energy-rate:         11.514 W
    time to empty:       4.0 hours
    percentage:          92%
    icon-name:          'battery-full-symbolic'

Daemon:
  daemon-version:  0.99.4
  on-battery:      yes
  lid-is-closed:   no
  lid-is-present:  yes
  critical-action: HybridSleep

2. 我的系统上没有安装 TLP。3
. 我重置了所有设置,但还是不行。今天我问Ubuntu-MATE.community 上的问题

答案1

GUI 方法

从:在 Linux Mint 18 Cinnamon 中更改关键电池电量和操作 您可以dconf-editor使用以下方式安装:

$ sudo apt-get install dconf-editor

然后转到org -> cinnamon -> 设置守护进程 -> 插件 -> 电源

mate gsettings 电源.png

  • 默认设置为(以 %):
  • 关键电池操作:休眠
  • 危急:2
  • 行动:2
  • 低:10

谨慎行事,随心所欲地调整

答案2

我仍然找不到问题的 GUI 解决方案。因此我转而使用半 GUI 解决方案。

我通过使用其他电池电量指示器解决了这个问题 - 它的名字是fdpowermon

描述:带有 ACPI 的笔记本电脑的简单电池电量监视器

fdpowermon是一个简单的 perl 脚本,它在与 freedesktop.org 规范兼容的系统托盘中安装一个图标。
每三秒钟fdpowermon调用一次acpi以查明当前电池电量。它将命令的输出设置acpi为工具提示文本,并根据需要更新使用的图标。
此外,fdpowermon当电量达到给定水平时,可以选择调用 perl 子例程。但是,默认情况下不提供或启用此类子例程。

所以我已经安装了它

sudo apt-get install fdpowermon

并为此应用程序创建了配置文件夹,其中包含:

mkdir -p ~/.config/fdpowermon/

并在这里放置了两个文件:

1. 包含我修改过的主题的文件(discharging注意数组中的第 3 个元素20:battery-low.png,它将用于在 Perl 脚本中暂停):

cat << \EOF > ~/.config/fdpowermon/theme.cfg 
[mytheme]
steps = 8
dir = /usr/share/icons/oxygen/22x22/status
# The below line makes fdpowermon not show an icon when the power is
# connected and the battery is completely full. This is by design,
# because that's how the author likes to use the software, and he is of
# the opinion that it's easier to ship software configured just the way
# he likes it rather than to have to reconfigure things.
#
# Requests are often made to change this default. This will not happen,
# but it's an easy change: just change the last entry in this "charging"
# configuration so that it says "100:battery-charging.png" rather than
# "99:battery-charging.png", and you're done!
charging = 0:battery-charging-low.png, 10:battery-charging-low.png, 20:battery-charging-caution.png, 30:battery-charging-caution.png, 50:battery-charging-040.png, 70:battery-charging-060.png, 90:battery-charging-080.png,100:battery-charging.png
discharging = 2:battery-missing.png:battery-low.png,10:battery-low.png, 20:battery-low.png,30:battery-caution.png,50:battery-040.png,70:battery-060.png,90:battery-080.png,100:battery-100.png
EOF

2. 具有 dbus 暂停操作的 Perl 脚本文件:

cat << \EOF > ~/.config/fdpowermon/theme.pl
# Copy this file to ~/.config/fdpowermon/theme.pl.
#
# If you don't like the 'default' theme, define a new one by copying
# /etc/fdpowermon/theme.cfg to ~/.config/fdpowermon/theme.cfg and
# renaming/adjusting the 'default' theme there to something new.
# Don't forget to replace "default" below with your new theme name.
#
# See the manpage fdpowermon(1) for full details on what you can do
# here.

# define a suspend action
sub suspend {
    system("dbus-send --print-reply --system --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Suspend boolean:true");
}

# initialize our theme, from /etc/fdpowermon/theme.cfg or
# ~/.config/fdpowermon/theme.cfg
my $theme = fdpowermon::theme::get_theme("mytheme");

# on the discharge event for the lowest element in the list of steps (0 = first
# in the index, "d" for discharge), call the "suspend" sub defined above
$theme->set_event( 2, \&suspend, 'd' );
EOF

(DBus暂停命令来自这个很好的答案)。

最后,我禁用了 MATE Power Manager 电池指示器

gsettings set org.mate.power-manager icon-policy 'never'

并创建自动启动桌面文件以fdpowermon显示在托盘中:

mkdir -p ~/.config/autostart

cat << EOF > ~/.config/autostart/fdpowermon.desktop 
[Desktop Entry]
Type=Application
Exec=fdpowermon
Hidden=false
X-MATE-Autostart-enabled=true
Name[en_US]=fdpowermon
Name=fdpowermon
Comment[en_US]=
Comment=
EOF

结果我在托盘中看到了好看的电池图标电池充电电池警告电量不足并且系统在电池电量为 20% 时自动暂停(该电量水平是可配置的,但我的新电池似乎错误地报告了低值)。

相关内容