Slimbook-Team / slimbookbattery

Slimbook Battery 4
https://slimbook.es/en/tutoriales/aplicaciones-slimbook/398-slimbook-battery-3-application-for-optimize-battery-of-your-laptop
GNU General Public License v3.0
252 stars 18 forks source link

Restore TLP config when turned off #88

Open siddhpant opened 2 years ago

siddhpant commented 2 years ago

Is your feature request related to a problem? Please describe. Turning off Slimbook Battery (SBAT henceforth) doesn't restore my previous TLP settings and neither does it turn it on. I expected SBAT to pass control to TLP solely when I turn SBAT off, rather than stop power management in the laptop altogether.

Describe the solution you'd like Turn on TLP and restore old config when I turn off SBAT.

Describe alternatives you've considered Manually restoring from backup and running sudo tlp start.

Additional context I also had set some settings in TLP which SBAT maybe seems to override, like disabling radio devices like BT on startup. I think it should not do that, there is more power saving in them disabled on start, and since it is set by user, high performance should not enable it either (it doesn't depend on it anyways).

slimbook commented 2 years ago

That's a good request, there should be a backup copy of your old custom TLP settings, to leave the system as it was when application is turned off. I'll try to implement it soon.

I also had set some settings in TLP which SBAT maybe seems to override, like disabling radio devices like BT on startup.

There is a setting on each mode that does this, so if the switch is off, when you click the accept button it will override that parameter with the selected setting. When you install the app default settings are shown, maybe it should use your custom settings if exist.

siddhpant commented 2 years ago

There is a setting on each mode that does this, so if the switch is off, when you click the accept button it will override that parameter with the selected setting. When you install the app default settings are shown, maybe it should use your custom settings if exist.

I only see the General tab on 4.0.4. I installed the latest from repo*, and now I can see the options.

I guess it's due to the below keyerror which was fixed:

Traceback (most recent call last):
  File "/usr/share/slimbookbattery/src/slimbookbatterypreferences.py", line 1688, in __init__
    self.set_ui()
  File "/usr/share/slimbookbattery/src/slimbookbatterypreferences.py", line 1871, in set_ui
    SettingsGrid(self, data.get('filename'))
  File "/usr/share/slimbookbattery/src/slimbookbatterypreferences.py", line 1172, in __init__
    super(SettingsGrid, self).__init__(parent, *args, **kwargs)
  File "/usr/share/slimbookbattery/src/slimbookbatterypreferences.py", line 108, in __init__
    self.complete_values()
  File "/usr/share/slimbookbattery/src/slimbookbatterypreferences.py", line 1344, in complete_values
    button = self.content['governor']
KeyError: 'governor'

* There are some problems with deploy script, I will try to send a fix.

siddhpant commented 2 years ago

Also, is there any way to set default profile (or settings to apply automatically when on AC)?

slimbook commented 2 years ago

Do you mean this default tlp settings which has all params commented? If not, there is a button that says "restore default values" which sets our default settings for each mode. You can see them at /usr/share/slimbookbattery/default/, the three files contain default setting for each mode, sorry for not having translated the names, ahorrodeenergia = low, equilibrado = balanced, and maximorendimiento = high.

siddhpant commented 2 years ago

Do you mean this default tlp settings which has all params commented? If not, there is a button that says "restore default values" which sets our default settings for each mode. You can see them at /usr/share/slimbookbattery/default/, the three files contain default setting for each mode.

I mean when I connect AC, can SBAT automatically switch settings / mode (like change to high performance), like how TLP automatically changes settings and governor when I connect charger?

sorry for not having translated the names, ahorrodeenergia = low, equilibrado = balanced, and maximorendimiento = high.

np, and thanks!

slimbook commented 2 years ago

The only settings applied on AC and BAT are the ones in the second column, but we listen to any requests about adding 'ac only' parameters, there is always room for improvement.

slimbook commented 2 years ago

I mean when I connect AC, can SBAT automatically switch settings / mode (like change to high performance), like how TLP automatically changes settings and governor when I connect charger?

Now I understand. That's because there are params that only act when batt is connected, for example, the governor settings. In this case, we only set the ones which act when battery is used, so, once you connect the ac, governor will switch to performance and stop using the battery settings (1st column). You can check it with sudo tlp-stat -p

siddhpant commented 2 years ago

Edit: Moved to #90.

Click here to uncollapse original comment > once you connect the ac, governor will switch to performance , and stop using the bat settings (1st column). You can check it with `sudo tlp stat -p` It doesn't change when I connect AC. I will use monitor mode of `auto-cpufreq` to show this (since it uses an update loop and shows battery status). I set energy saving mode, and the output is as below which is expected (ignore suggestion): ![image](https://user-images.githubusercontent.com/25429745/200299724-f51378df-4513-4d85-87d5-12ffd7adf1cc.png) Now when I connect battery, the output is as below: ![image](https://user-images.githubusercontent.com/25429745/200299895-ee39692f-644c-420a-b3b6-0771a609bc8b.png) So it didn't change. If I change the mode to maximum performance, the output still remains the same, because the 1st column settings don't apply when on AC: ![image](https://user-images.githubusercontent.com/25429745/200300478-7655668d-e032-4f5f-ad78-f5cca1a12964.png) Here is the max performance setting for reference: ![image](https://user-images.githubusercontent.com/25429745/200301765-d43ccf3f-57ae-4e10-86a0-a27bf51c814b.png) Also, it seems the "Disable animation" switch has negative logic. If I turn it on, then animations are enabled. Maybe it was intended to be yes/no, but then implemented as a switch. --- I guess this all should be in a new issue...