Giter VIP home page Giter VIP logo

gnome-shell-extension-ideapad's Introduction

gnome-shell-extension-ideapad

Lenovo IdeaPad goodies for GNOME Shell

At the moment the extension only provides an easy and user-friendly way to toggle the battery conservation mode available on Levono Ideapad laptops and visually get its current state.

Installation

Simply install the extension from the official GNOME extensions website (recommended). Alternatively, manually download or clone the repository under ~/.local/share/gnome-shell/extensions/[email protected]

In both cases, few additional steps are required. Please check the dedicate following section.

In case you would like to have a look at the code, please consider that master branch targets the latest stable version of GNOME Shell. Previous versions are still supported in dedicated branches (e.g. pre-43).

Usage

The extension adds a new entry Toggle Conservation Mode to the panel and shows an icon on the status menu to indicate when the battery conservation mode is enabled.

If your particular laptop model supports it, the conservation mode limits battery charging to 55-60% of its capacity to improve battery life. It is particularly useful when the laptop runs on external power most of the time.

GNOME Shell < 43 GNOME Shell >= 43

Additional Required Settings

Your desktop user needs read-and-write access to a specific sysfs file that is normally owned by the root user. The easiest way to achieve that is using sudo. The following steps have been tested on Debian, but they should work on any modern GNU/Linux system. In case of doubts, please refer to your specific distribution documentation.

  • Depending on your distro, you need to use the group sudo (e.g. Debian and Ubuntu) or wheel (e.g. Arch and Fedora) here. In case of doubt, run the command groups in a terminal and see which of the two is listed in the output.

    Add the following entry to your system sudoers configuration (e.g. /etc/sudoers.d/ideapad). Make sure to replace %sudo with %wheel if needed.

    %sudo ALL=(ALL) NOPASSWD: /usr/bin/tee /sys/bus/platform/drivers/ideapad_acpi/VPC????\:??/conservation_mode
    
  • To make sure the ideapad_laptop kernel module gets loaded automatically at boot, simply add it to the file /etc/modules

To summarize and for easy reference...

# Don't forget to replace %sudo with %wheel if needed!
#
$ echo "%sudo ALL=(ALL) NOPASSWD: /usr/bin/tee /sys/bus/platform/drivers/ideapad_acpi/VPC????\:??/conservation_mode" | sudo tee /etc/sudoers.d/ideapad
$ echo "ideapad_laptop" | sudo tee -a /etc/modules

Wrong battery estimation displayed

Depending on the kernel version you are running, a minor cosmetic issue might still exist. However, if the permanent "Estimating..." battery status displayed in GNOME bugs you, there is also a solution.

Actually, this issue should be fixed in kernels 5.19+. If you are running an older kernel, you can try applying the patch here. Thanks to Martino Fontana for pointing this out.

Alternatively, you could use the patch I initially suggested in this uPower merge request. However, I would personally advice to go for the kernel patch. It is a much cleaner solution.

gnome-shell-extension-ideapad's People

Contributors

777raim avatar arnaud-feldmann avatar cewbdex avatar laurento avatar lz-coder avatar oscfdezdz avatar theweirddev avatar thislight avatar ulville avatar vibe-hu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gnome-shell-extension-ideapad's Issues

Syntax error when following the readme.md

For the line

%wheel ALL=(ALL) NOPASSWD: /usr/bin/tee /sys/bus/platform/drivers/ideapad_acpi/VPC????\:??/conservation_mode

It returns

bash: syntax error near unexpected token `('

I'm on Fedora 35 stable up to date.

Update to Gnome 42

Hello again!
Since Gnome 42 is shaping up and starting to become available on many distros, it would be nice if this extension was updated to support it.

Many thanks in advance!

Extension not working properly

I installed this extension on my Lenovo ideaPad Y700-15ISK with Ubuntu 20.04 and it is not working properly.

When the extension is on, the leaf appears next to the battery, but when I 'toggle' it, it doesn't deactivate the conservation mode.

I have dual boot with Windows 10 and I realized that if I set the 'conservation mode' in Windows, the battery configuration is the same in Ubuntu.

May be 'Lenovo Vantage' tools in windows overrides this extension?

Doesn't work with Lenovo IdeaPad Gaming 3

Hello, I've installed the extension on a Lenovo IdeaPad Gaming 3 laptop (GNOME 40/Fedora 34 beta) and nothing happens when I press "Turn Conservation Mode On" in the System menu. I even created the /etc/sudoers.d/ideapad file as instructed.

Conservation mode not "enable-able"

Greetings,

I'm using openSUSE Tumbleweed and have applied all of the settings in the README including %wheel instead of %sudo, but the toggle in the extension is not working. It is only able to show me if conservation mode is enabled or disabled, but nothing more. I know that the ideapad_laptop module is loaded for two reasons:

  1. This extension is working and the reason why I don't want to use it is because it prompts me with a password prompt each time I want to switch Conservation Mode on and off. Yours doesn't.
  2. Changing the value between 0 and 1 in /sys/bus/platform/drivers/ideapad_acpi/VPC2004\:00/conservation_mode enables/disables Conservation Mode respectively.

Expected behavior:
Extension should enable and disable Conservation Mode on-demand from GUI.

System info
OS: openSUSE Tumbleweed x86_64 (fully updated)
Host: 82A1 Yoga Slim 7 14IIL05
Kernel: 5.15.5-1-default
DE: GNOME 41.1
CPU: Intel i7-1065G7 (8) @ 3.900GHz
GPU: Intel Iris Plus Graphics G7
GPU: NVIDIA GeForce MX350
Memory: 3618MiB / 15731MiB

Thanks in advance!

Cannot change conservation mode on Ideapad S540 13ARE

I was able to change conservation mode, however, it doesn't work after I upgraded the kernel to 5.12 (via mainline).
I tried the commands but got Input/Output error...

$ ls /sys/bus/platform/drivers/ideapad_acpi/
bind  module  uevent  unbind  VPC2004:00

$ echo "0" | sudo tee /sys/bus/platform/drivers/ideapad_acpi/VPC2004\:00/conservation_mode > /dev/null
tee: '/sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode': Input/output error

OS: Ubuntu 20.04
Kernel: 5.12.1

GNOME 41 Support

I've been using this extension in Fedora 35 Beta and it works as it should with GNOME 41.
I could test it because I disabled extension version validation.

Battery keeps charging in conservation mode

Hi again laurento.

After finally fixing all the config, the extension works like a charm... Or so I thought...

I left the laptop without charging to drop the battery down to 50% and toggled the conservation mode.

The leaf appeared instantly but the battery keeps charging until 100%!!

Shouldn't stay in conservation mode around that 50-60% without charging?

Use Polkit instead of Sudo

Currently, it is required to tinker with the sudoers file in order to use this extension.
With polkit (pkexec) instead, by default the extension would work out of the box: it would require inserting the password each time, but it's possible to be configured so that it wouldn't be necessary anymore (the configuration procedure would be different, of course).

Not working on Debian 12

It's been a few days since I installed Debian 12 on my Lenovo IdeaPad 3i.
The extension never worked on this Debian. I already checked /etc/sudoers.d/ideapad
I also checked /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode
Everything seems to be correct

I tried echo "ideapad_laptop" | sudo tee -a /etc/modules
I tried another Kernel version...
But nothing works

I tried and works on Fedora 37, Arch Linux and Ubuntu 22.04 and 22.10

I can turn Conservation Mode on or off with sudo bash -c 'echo 0 > /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode or sudo bash -c 'echo 1 > /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode but not with extension.


These are some errors I encountered when trying to use the extension:

image

monitor on sysfs doesn't work

I found out that using a file monitor on sysfs does not work, so it might as well be removed.

A workaround would be to to call _syncState as final action in _setConservationMode, as well as on opening the menu.

This would also warn users that the desired setting could not be applied (for example when the permissions are not setup properly)

Managing keyboard

I am not a GNOME extension developer, so this idea might be irrelevant/not possible. I have thought that this extension could add new keyboard settings in the settings app. Specifically managing switching fn lock mode (4.18+). Maybe also toggle USB always on in power settings (5.12+).

Source

Infinite loop when toggling the PopupSwitchMenuItem

In Extension.js at line 82:

if (this._item.state != active) this._item.toggle(); // Emits a 'toggled' signal

A 'toggled' signal is emitted, triggering an infinite loop where _syncStatus and _setConservationMode are called again and again.

Changing the said line to prevent emitting a 'toggled' signal solves the issue :

this._item.setToggleState(active); // Does not emit a 'toggled' signal

Getting incorrect status value

I've been combing through the extension and have found out that it seems to be one step behind what is actually in the conservation_mode file when using the extension on my Lenovo Yoga C940 with Fedora 34 and GNOME 40. This means that the icon is displaying when conservation mode is actually off and the label for the toggle is 'On' when it will turn conservation mode off and vice versa.

I have also noticed that the first time I click the toggle, it will toggle, but neither the indicator nor the toggle label will change. I suspect that this is where the issue lies as on every subsequent toggle it will in fact both toggle and update the indicator and label, effectively putting them one step behind.

I would perhaps hazard a guess at the fetching of the status getting old information, although I do not know how that would come to be. Or that the icon and label are updated before the actual toggle, but that would seem unlikely as the sync should trigger on a change-event?

Sorry to bother you.

Best regards.

mumblingdrunkard

what is the command?

Uninstalled GNOME DE recently and had forgotten about this extension, now I'm on cinnamon with battery at 59%. That is to say, I forgot to deactivate the energy conservation mode🌚

Battery stabilizes at its current level

When I activate the conservation mode, the battery stabilizes at its current level, so the charge/discharge cycle works fine, but it doesn't initially discharge to the optimal level of 55-60%.

$> sudo dmidecode | grep -A3 '^System Information'
System Information
	Manufacturer: LENOVO
	Product Name: 81W1
	Version: IdeaPad 3 15ADA05
$> inxi
CPU: Quad Core AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx (-MT MCP-) 
Kernel: 5.10.42-1-MANJARO x86_64
$> upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               CPT-COS
  model:                L16C2PB1
  serial:               3050
  power supply:         yes
  updated:              sab 26 giu 2021, 21:22:02 (26 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    warning-level:       none
    energy:              31,75 Wh
    energy-empty:        0 Wh
    energy-full:         35,55 Wh
    energy-full-design:  35,3 Wh
    energy-rate:         0 W
    voltage:             8,425 V
    percentage:          89%
    capacity:            100%
    technology:          lithium-polymer
    icon-name:          'battery-full-charging-symbolic'

Please tell me if you need more specific logs. Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.