Set the battery charging mode for ideapad laptop batteries, to extend battery lifespan
A plugin for Noctalia Shell to control the battery preservation mode on Ideapad laptops, helping extend battery lifespan. This plugin only works if your laptop supports battery conservation mode (as exported by the kernel in sysfs). The plugin looks like this in action:

Add the bar widget to your bar. Click to open the panel and toggle the battery preservation mode using the switch.
This plugin requires write access to the battery conservation mode sysfs file. The included setup_rules.sh script configures a udev rule that grants write permission to members of the battery_ctl group:
$ sudo ./setup_rules.sh
This script will:
/sys/class/power_supply/BAT0/extensions/ideapad_laptop/conservation_mode)battery_ctl group (if it doesn't exist)battery_ctl group99-battery-preservation.rules) to /etc/udev/rules.d/Note: A reboot may be required for write access to take effect.
# Toggle panel
qs -c noctalia-shell ipc call plugin:ideapad-battery-health togglePanel
# Set preservation mode (0 for disabled, 1 for enabled)
qs -c noctalia-shell ipc call plugin:ideapad-battery-health set <value>
battery_ctl group/sys/class/power_supply/BAT0/extensions/ideapad_laptop/conservation_mode existsThis plugin consists of the following files:
Main.qml: Main entry point and IPC handlerBatteryPreservationService.qml: Core service for managing battery preservationBarWidget.qml: Widget displayed in the top barPanel.qml: Panel interface for toggling preservation modemanifest.json: Plugin metadata and configurationsettings.json: Default settingssetup_rules.sh: Script to configure udev rules for write access99-battery-preservation.rules: Udev rule fileREADME.md: This documentationpreview.png: Preview imageDerived from battery-threshold by Wilfred Mallawa