Set battery charge limit

In Windows I have an official program to set a battery charge limit to 80%, is it possible to do something similar in Linux?

Yes.

But it can depend on your system.

Btw im using the live usb for testing before real installation

System:
  Kernel: 6.1.30-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 12.2.1
    parameters: BOOT_IMAGE=/boot/vmlinuz-x86_64 lang=es_MX keytable=us
    tz=America/Mexico_City misobasedir=manjaro misolabel=MANJARO_KDEM_2213
    quiet systemd.show_status=1 splash driver=free nouveau.modeset=1
    i915.modeset=1 radeon.modeset=1
  Desktop: KDE Plasma v: 5.27.4 tk: Qt v: 5.15.9 wm: kwin_x11 vt: 1 dm: SDDM
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: Acer product: Aspire A515-56 v: V1.30
    serial: <superuser required>
  Mobo: TGL model: Iris_TL v: V1.30 serial: <superuser required> UEFI: Insyde
    v: 1.30 date: 07/29/2022
Battery:
  ID-1: BAT1 charge: 35.4 Wh (79.4%) condition: 44.6/47.8 Wh (93.2%)
    volts: 11.9 min: 11.2 model: LGC AP18C8K type: Li-ion serial: <filter>
    status: not charging cycles: 25
Memory:
  System RAM: available: 11.47 GiB used: 2.53 GiB (22.0%)
  RAM Report: permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: 11th Gen Intel Core i7-1165G7 bits: 64 type: MT MCP
    arch: Tiger Lake gen: core 11 level: v4 note: check built: 2020
    process: Intel 10nm family: 6 model-id: 0x8C (140) stepping: 1
    microcode: 0xA6
  Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache:
    L1: 320 KiB desc: d-4x48 KiB; i-4x32 KiB L2: 5 MiB desc: 4x1.2 MiB L3: 12 MiB
    desc: 1x12 MiB
  Speed (MHz): avg: 2411 high: 2800 min/max: 400/4700 scaling:
    driver: intel_pstate governor: powersave cores: 1: 2800 2: 2800 3: 2800
    4: 1209 5: 2800 6: 2800 7: 2800 8: 1284 bogomips: 44864
  Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat
    arch_capabilities arch_perfmon art avx avx2 avx512_bitalg avx512_vbmi2
    avx512_vnni avx512_vp2intersect avx512_vpopcntdq avx512bw avx512cd
    avx512dq avx512f avx512ifma avx512vbmi avx512vl bmi1 bmi2 bts cat_l2
    cdp_l2 clflush clflushopt clwb cmov constant_tsc cpuid cpuid_fault cx16
    cx8 de ds_cpl dtes64 dtherm dts epb ept ept_ad erms est f16c flexpriority
    flush_l1d fma fpu fsgsbase fsrm fxsr gfni ht hwp hwp_act_window hwp_epp
    hwp_notify hwp_pkg_req ibpb ibrs ibrs_enhanced ibt ida intel_pt invpcid
    invpcid_single lahf_lm lm mca mce md_clear mmx monitor movbe movdir64b
    movdiri msr mtrr nonstop_tsc nopl nx ospke pae pat pbe pcid pclmulqdq pdcm
    pdpe1gb pebs pge pku pln pni popcnt pse pse36 pts rdpid rdrand rdseed
    rdt_a rdtscp rep_good sdbg sep sha_ni smap smep split_lock_detect ss ssbd
    sse sse2 sse4_1 sse4_2 ssse3 stibp syscall tm tm2 tpr_shadow tsc
    tsc_adjust tsc_deadline_timer tsc_known_freq umip vaes vme vmx vnmi
    vpclmulqdq vpid x2apic xgetbv1 xsave xsavec xsaveopt xsaves xtopology xtpr
  Vulnerabilities:
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Enhanced IBRS, IBPB: conditional, RSB
    filling, PBRSB-eIBRS: SW sequence
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel TigerLake-LP GT2 [Iris Xe Graphics]
    vendor: Acer Incorporated ALI driver: i915 v: kernel arch: Gen-12.1
    process: Intel 10nm built: 2020-21 ports: active: eDP-1 empty: HDMI-A-1
    bus-ID: 0000:00:02.0 chip-ID: 8086:9a49 class-ID: 0300
  Device-2: Chicony HD User Facing driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-8:4 chip-ID: 04f2:b64f
    class-ID: 0e02 serial: <filter>
  Display: x11 server: X.Org v: 21.1.8 with: Xwayland v: 23.1.1
    compositor: kwin_x11 driver: X: loaded: modesetting alternate: fbdev,vesa
    dri: iris gpu: i915 display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
    s-diag: 582mm (22.93")
  Monitor-1: eDP-1 model: BOE Display 0x07cb built: 2018 res: 1920x1080
    hz: 60 dpi: 142 gamma: 1.2 size: 344x193mm (13.54x7.6") diag: 394mm (15.5")
    ratio: 16:9 modes: 1920x1080
  API: OpenGL v: 4.6 Mesa 23.0.3 renderer: Mesa Intel Xe Graphics (TGL GT2)
    direct-render: Yes
Audio:
  Device-1: Intel Tiger Lake-LP Smart Sound Audio vendor: Acer Incorporated ALI
    driver: sof-audio-pci-intel-tgl
    alternate: snd_hda_intel,snd_sof_pci_intel_tgl bus-ID: 0000:00:1f.3
    chip-ID: 8086:a0c8 class-ID: 0401
  API: ALSA v: k6.1.30-1-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: JACK v: 1.9.22 status: off tools: N/A
  Server-2: PipeWire v: 0.3.70 status: off with: wireplumber status: off
    tools: pw-cli,wpctl
  Server-3: PulseAudio v: 16.1 status: active with: pulseaudio-alsa
    type: plugin tools: pacat,pactl
Network:
  Device-1: Intel Wi-Fi 6 AX201 driver: iwlwifi v: kernel bus-ID: 0000:00:14.3
    chip-ID: 8086:a0f0 class-ID: 0280
  IF: wlp0s20f3 state: up mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  IP v6: <filter> type: noprefixroute scope: link
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Acer Incorporated ALI driver: r8169 v: kernel port: 3000
    bus-ID: 0000:01:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp1s0 state: down mac: <filter>
  WAN IP: <filter>
Bluetooth:
  Device-1: Intel AX201 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0
    speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-10:5 chip-ID: 8087:0026
    class-ID: e001
  Report: rfkill ID: hci0 rfk-id: 2 state: up address: see --recommends
Logical:
  Message: No logical block device data found.
RAID:
  Hardware-1: Intel Volume Management Device NVMe RAID Controller driver: vmd
    v: 0.6 port: N/A bus-ID: 0000:00:0e.0 chip-ID: 8086:9a0b rev: class-ID: 0104
Drives:
  Local Storage: total: 505.76 GiB used: 0 KiB (0.0%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: SK Hynix
    model: HFM512GDJTNI-82A0A size: 476.94 GiB block-size: physical: 512 B
    logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: 11000C00 temp: 45.9 C scheme: GPT
  ID-2: /dev/sda maj-min: 8:0 vendor: Kingston model: DataTraveler 3.0
    size: 28.82 GiB block-size: physical: 512 B logical: 512 B type: USB rev: 3.2
    spd: 5 Gb/s lanes: 1 mode: 3.2 gen-1x1 tech: N/A serial: <filter>
    scheme: MBR
  SMART Message: Unknown USB bridge. Flash drive/Unsupported enclosure?
  Message: No optical or floppy data found.
Partition:
  Message: No partition data found.
Swap:
  Alert: No swap data was found.
Unmounted:
  ID-1: /dev/nvme0n1p1 maj-min: 259:1 size: 100 MiB fs: vfat label: ESP
    uuid: E0C4-AA8D
  ID-2: /dev/nvme0n1p2 maj-min: 259:2 size: 475.09 GiB fs: ntfs label: SNX
    uuid: 10D2C522D2C50CC2
  ID-3: /dev/nvme0n1p3 maj-min: 259:3 size: 747 MiB fs: ntfs label: N/A
    uuid: 01D9932EF809A2A0
  ID-4: /dev/nvme0n1p4 maj-min: 259:4 size: 1024 MiB fs: ntfs label: Recovery
    uuid: 2E44C5E844C5B33F
  ID-5: /dev/sda1 maj-min: 8:1 size: 2.97 GiB fs: iso9660
  ID-6: /dev/sda2 maj-min: 8:2 size: 4 MiB fs: vfat label: MISO_EFI
    uuid: E572-40ED
USB:
  Hub-1: 1-0:1 info: hi-speed hub with single TT ports: 12 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Device-1: 1-4:2 info: Pixart Imaging Optical Mouse type: mouse
    driver: hid-generic,usbhid interfaces: 1 rev: 2.0 speed: 1.5 Mb/s (183 KiB/s)
    lanes: 1 mode: 1.0 power: 100mA chip-ID: 093a:2510 class-ID: 0301
  Device-2: 1-7:3 info: Elan Micro ELAN:Fingerprint type: <vendor specific>
    driver: N/A interfaces: 1 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s) lanes: 1
    mode: 1.1 power: 100mA chip-ID: 04f3:0c4f class-ID: 0000
  Device-3: 1-8:4 info: Chicony HD User Facing type: video driver: uvcvideo
    interfaces: 2 rev: 2.0 speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0
    power: 500mA chip-ID: 04f2:b64f class-ID: 0e02 serial: <filter>
  Device-4: 1-10:5 info: Intel AX201 Bluetooth type: bluetooth driver: btusb
    interfaces: 2 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1
    power: 100mA chip-ID: 8087:0026 class-ID: e001
  Hub-2: 2-0:1 info: super-speed hub ports: 4 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900
  Device-1: 2-3:2 info: Kingston DataTraveler 100 G3/G4/SE9 G2/50
    type: mass storage driver: usb-storage interfaces: 1 rev: 3.2
    speed: 5 Gb/s (596.0 MiB/s) lanes: 1 mode: 3.2 gen-1x1 power: 296mA
    chip-ID: 0951:1666 class-ID: 0806 serial: <filter>
Sensors:
  System Temperatures: cpu: 45.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Info:
  Processes: 236 Uptime: 3m wakeups: 63 Init: systemd v: 252 default: graphical
  tool: systemctl Compilers: gcc: 12.2.1 clang: 15.0.7 Packages: pm: pacman
  pkgs: 1147 libs: 319 tools: pamac Shell: Zsh v: 5.9 default: Bash v: 5.1.16
  running-in: konsole inxi: 3.3.27

So it appears you were using a KDE ISO.
KDE has options in System Settings > Power Management > Advanced Power Settings :

It really is device dependent. This entry doesn’t appear on my Advanced Power Settings, but the battery trayicon stays at whatever limit set in Lenovo Vantage (my laptop is Lenovo Legion 5 2022). So I think it’s somewhere in the firmware, but not exposed to the kernel or somewhere KDE System Settings can read.

The option is as @leledumbo points out - device dependent.

If your device does not support this you need to remove the charger when your threshold has been reached - however this is easily forgotten.

The question has been around for years and the following topic builds upon previous topics from around the net.

Thanks, and is posible to do that in XFCE Edition?
I also want to try that edition

I’m not sure about XFCE having a built-in function.
But agnostic tools exist … such as TLP has options … in TLP conf:

START_CHARGE_THRESH_BAT0=30
STOP_CHARGE_THRESH_BAT0=90

And there is a GUI for configuring TLP: tlpui

1 Like

It’s something device dependent, as said, and usually desktop independent.
In lenovo, I have a terminal command to limit (in that case to 56%, that’s what the Lenovo system states as sure if used switched to AC supply).

You’re on Asus system, so you’ll have to look for options for your system. A fast Google gives me this as first result, for example:

Acer actually, so this might work. I really hope Thinkpad solution is standardized, but sadly it isn’t, it’s even Thinkpad specific that other models from Lenovo doesn’t have the required sys path.

Yes.

Follow the step:

run cmd “sudo crontab -e” then add this line : @reboot sleep 3; echo 90 > /sys/class/power_supply/BAT0/charge_control_end_threshold where 90 is the limit of charging. Now on next reboot it will work. :zap:

To undo just remove this line from crontab. :sunglasses: