fix(ideapad-conservation-mode): use bind action in udev rule instead of add|change to avoid boot race (#61)

This commit is contained in:
notiant
2026-07-20 21:08:00 -04:00
committed by GitHub
parent fa7dd13f8a
commit 16fec532ad
4 changed files with 5 additions and 6 deletions
@@ -62,7 +62,7 @@ local function readState()
end
local function render(on, enabled)
shortcut.setLabel(noctalia.tr(if on then "shortcut.on" else "shortcut.off"))
shortcut.setLabel(noctalia.tr("shortcut.label"))
shortcut.setIcon("battery-charging", "battery")
shortcut.setActive(on)
shortcut.setEnabled(enabled)
+1 -1
View File
@@ -1,6 +1,6 @@
id = "lux/ideapad-conservation-mode"
name = "IdeaPad Conservation Mode"
version = "0.3.0"
version = "0.3.1"
plugin_api = 3
author = "lux"
license = "MIT"
@@ -41,11 +41,11 @@ usermod -aG "$GROUP_NAME" "$TARGET_USER"
echo "Writing $RULE_FILE..."
cat >"$RULE_FILE" <<EOF
ACTION=="add|change", SUBSYSTEM=="platform", DRIVER=="ideapad_acpi", RUN+="$CHGRP_BIN $GROUP_NAME /sys%p/conservation_mode", RUN+="$CHMOD_BIN 664 /sys%p/conservation_mode"
ACTION=="bind", SUBSYSTEM=="platform", DRIVER=="ideapad_acpi", RUN+="$CHGRP_BIN $GROUP_NAME /sys%p/conservation_mode", RUN+="$CHMOD_BIN 664 /sys%p/conservation_mode"
EOF
echo "Reloading udev rules..."
udevadm control --reload-rules
udevadm trigger --subsystem-match=platform
udevadm trigger --action=bind --subsystem-match=platform
echo "Done."
@@ -12,8 +12,7 @@
},
"shortcut": {
"na": "Conservation N/A",
"off": "Conservation",
"on": "Conservation"
"label": "Conservation"
},
"title": "Conservation mode"
}