Great extension!
My IdeaPad is missing .../usb_charging
, so the extension has an error at startup:
Gio.IOErrorEnum: Error opening file /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/usb_charging: No such file or directory
I guess an easy way to fix this is something like:
function addOptionsToMenu(menu) {
let settings = ExtensionUtils.getSettings('org.gnome.shell.extensions.ideapad-controls');
// Create a switch item for each option
for (let i = 0; i < options.length; i++) {
// Convert option title to schema key, i.e. "Camera Lock" becomes "camera-lock-option"
const optionKey = options[i].toLowerCase().replace(" ", "-") + "-option";
try {
// should fail at this point
let optionSwitch = new PopupMenu.PopupSwitchMenuItem(options[i], getOptionValue(i) === "1");
// etc...
} catch (e) {
logError(e, `Failed to read option ${options[i]}`);
// Error has occurred, so remove the item and decrement the position before the next iteration
options.splice(i--, 1);
}
}
}