Giter Site home page Giter Site logo

tlpui's Introduction

TLP UI

TLP UI

The Python scripts in this project generate a GTK-UI to change TLP configuration files easily. It has the aim to protect users from setting bad configuration and to deliver a basic overview of all the valid configuration values.

Screenshot

Install and run instructions 📒

Download on Flathub

Current status 🌄

  • Supports TLP versions 1.3-1.6 - older TLP versions are supported by 1.6.1
  • Requires Python 3.8 or greater
  • Configuration can be read and displayed
  • Shows information about configuration changes (defaults/unsaved and drop-in/user config)
  • Changes can be saved with user and sudo permissions (/etc/tlp.conf)
  • tlp-stat can be load in ui (simple and complete)

To be done 🏗️

  • Weblate translations - #121
  • Mobile UI - #111
  • Implement package build pipeline - #90

tlpui's People

Contributors

blipk avatar d4nj1 avatar dmvolod avatar edyounis avatar ghyde avatar hellzevir avatar kamikazow avatar linrunner avatar lrespublica avatar nitrooxid avatar tioguda avatar xnand avatar zocker-160 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tlpui's Issues

Crash when missing element in config file

TLP 1.0 will remove the parameter RUNTIME_PM_ALL completely. When i start tlpui.py with a config file without RUNTIME_PM_ALL (no commented line either) i get:

Traceback (most recent call last):
  File "./tlpui.py", line 26, in <module>
    window.add(create_main_box(window, defaultconfigpath, tlpconfig))
  File "/srv/share/project/Ubuntu/Package/tlp/tlpui.git/mainui.py", line 136, in create_main_box
    configbox = create_config_box(tlp_config_items)
  File "/srv/share/project/Ubuntu/Package/tlp/tlpui.git/configui.py", line 22, in create_config_box
    tlp_categories = get_tlp_categories(tlp_config_items)
  File "/srv/share/project/Ubuntu/Package/tlp/tlpui.git/configui.py", line 177, in get_tlp_categories
    tlpitem = tlpconfig[id]
KeyError: 'RUNTIME_PM_ALL'

What are the requirements?

Hi @d4nj1,

I'm trying to help with the development but I can't even install the project. Can you help me to setup me environment?

And what are the requirements? I try to install and I got this error:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/luiz/Projects/TLPUI/tlpui/__main__.py", line 2, in <module>
    import gi
ModuleNotFoundError: No module named 'gi'

About adding some features

Hi! I am author of the same project tlp-gui https://github.com/ZaMaZaN4iK/tlp-gui . And only today i had seen your beautiful utility. I think, that your utilite is much better, than my. Maybe, my code help you to add some features in your tlpui :
0) Add profiles in TLP. Only two profiles (AC and battery) is very little list of profiles. Pls add more profiles and feature of creating new profiles in the program.

  1. Add support system tray and switching between profiles in tray. It is very useful function in my opinion.
  2. Add checker for existing profiles for TLP. User can edit config with Kate, for example and make a mistake. And tlpui can check profile and show warning, for example.
    etc.

Sorry for my poor English.
Good luck with your program!

installation problem

Hello. I was trying to install TLPUI only that the following appears in the terminal:

Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/andrea/Scaricati/TLPUI-master/tlpui/main.py", line 8, in
from . import settings
File "/home/andrea/Scaricati/TLPUI-master/tlpui/settings.py", line 53, in
tlpconfigfile = config['default']['tlpconfigfile']
File "/usr/lib/python3.5/configparser.py", line 1230, in getitem
raise KeyError(key)
KeyError: 'tlpconfigfile'

What could be the problem?
I can not tell if Gtk3 libs is installed. How can I check?

Settings not showing when clicking on "edit" in DISK_DEVICES_ID

After making settings for multiple disks ([tab]Disks->[section]DISK_DEVICES_ID->edit), window jumps from tab "Disks" to tab "General".

When trying to click on "edit" in Disks again nothing happens.

Console shows this:

Traceback (most recent call last):
File "/opt/tlpui/tlpui/ui_config_objects/gtkdisklist.py", line 30, in edit_list
existingdisks = read_existing_disk_config()
File "/opt/tlpui/tlpui/ui_config_objects/gtkdisklist.py", line 216, in read_existing_disk_config
existingdiskconfig[device] = [apmlevelonac[index], apmlevelonbat[index], spindowntimeoutonac[index], spindowntimeoutonbat[index], iosched[index]]
IndexError: list index out of range

(can I provide anything else thats useful?)

Enumerate space separated config items

Situation: config items that have to provide values for multiple device instances use spaces to separate instances e.g. DISK_*, *_BLACKLIST/WHITELIST

Problem of the current approach:

  • Visually confusing
  • Mimics TLP's approach in /etc/default/tlp without any GUI benefit

Solution:

  • Spin button field to count the instances
  • Split up the input box (horizontally) according to the current instance count
  • Re-concatenate the instances with spaces when saving to /etc/default/tlp
  • Visually group (frame) all items belonging to the spin button

Add item type "integer" with range

Situation: items of type integer are implemented as pure text "entry".

Problems of the current approach:

  • User can save invalid entries

Solution:

  • New type "integer" with attributes "range_min", "range_max"

Suggestion:

  • Spin button +1/-1

set permanent hdd spin down via TLP-UI so the disk won't spin up/wake up by itself until command will be used

Is this option possible using TLP configuration? I had no problems with using hdparm app in Manjaro KDE linux to spin down hdd as I have whole system on ssd disk and hdd is used only as additional storage, no anything there is which system would treat as dependency to be run....so the command was used once and all worked and when I wanted to use this hdd disk it automatically spun up when disk icon was clicked...anyway since a week or two disk started to spin up same way like under Windows 10 which means something constantly wakes up this disk but I can't find what as I did no any changes in system only updates and new kernels (now kernel 5.5.2-1 version)

fetch tlp-stats works only with non-graphical sudo

The program is supposed to call tlp-stat with a graphical sudo (thus get_graphical_sudo() in statui.py).
But for me only the regular sudo works when called from within the program. I'd commit, but it seems to work for everyone else as it is. Why is that ?
I'm on manjaro linux (arch based).

Show changed items

  • Show config items differing from the default so users known what they changed

Darker icons

The icons on the app are too light is hard to see it, they need to be a bit darker.

Simple Stat runs only with sudo

The button Simple at Stats tab does not work for me. I get the same error as in #34

Traceback (most recent call last):
  File "/home/lousapetr/bin/TLPUI-master/tlpui/statui.py", line 24, in fetch_simple_stats
    tlpstat = check_output(simple_stat_command, stderr=STDOUT).decode(sys.stdout.encoding)
  File "/usr/lib64/python3.7/subprocess.py", line 395, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.7/subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['tlp-stat', '-g', '-r', '-t', '-c', '-s', '-u']' returned non-zero exit status 1.

The Complete Stats work perfectly.

So, I tried to run the command

$ tlp-stat -g -r -t -c -s -u
Error: missing root privilege.

Finally, I resolved the issue by adding sudo to the Simple Stats as well. Line 24 in statui.py:

    sudo_cmd = get_graphical_sudo()
    tlpstat = check_output([sudo_cmd]+simple_stat_command, stderr=STDOUT).decode(sys.stdout.encoding)

The only issue remaining is that even Simple Stats ask for my password.

Support TLP version 1.2

As TLP version 1.2 seems to become ready sometime soon TLP-UI should support it ootb.
See linrunner/TLP#380 for upcoming TLP 1.2 discussions.

DoD:

  • Provide config and schema support for TLP 1.2

AppImage of TLPUI would be nice

This will things make things lot easier as we wont have to deal with dependencies and installation.
Will just need to chmod +x TLPUI.AppImage and then just double click to run it.

PPA/Flatpak

Any chance of making a PPA or flatpak for this app?

Refactor code and apply pycodestyle and pydocstyle (PEP8, PEP257)

As the project is relatively stable it seems to be ok releasing the first version after some code quality and standardization improvements.
This means code should be linted following pycodestyle and pydocstyle rules. The result should bring up some refactorings.

Code is currently rated 8.+/10 by pylint.

Task:

  • Advance code rating as near as possible to 10/10.

Support different configuration scheme in Clear Linux

Clear Linux stores TLP's configuration file in a different folder, namely /usr/share/defaults/tlp. By trivially changing line 41 in settings.py to /usr/share/defaults/tlp insetad of /etc/default/tlp I was able to make TLPUI work fine.

Could distro detection be implemented and used to make this work automatically?

Import config schema from TLP

Situation: currently TLPUI itself provides the schema that declares all of TLP's config values e.g. configcategories.json

Problem of the current approach:

  • New releases of TLP containing new config items necessitate new TLPUI release to update the schema

Solution:

  1. Look into /usr/share/tlp-pm/ for a schema provided by TLP
  2. If none found, use TLPUI's own schema (to facilitate the migration)

Suggestion:

  • change configcategories.json to a more intuitive configschema.json

Left align all input fields

Current situation:

  • Alignment varies whether there is an AC/BAT icon or not
  • No alignment for some tabs, especially Radio, Radio Device Wizard

Proposal:

  • Left align all fields for all tabs to the same position, for example at 2/3 of the dialog width

configui.py bug

In configui.py line 120: tlpobject = settings.tlpconfig[configname]

If configname is not in settings.tlpconfig, then you will fail in creating GUI with the error message like KeyError: 'USB_BLACKLIST_PRINTER'. Move the statement into try...except block.

Statistics tab does nothing

None of the buttons on the statistics tab does anything for me. Clicking "Simple" nothing happens at all. Clicking "complete" I'm asked for su privileges but nothing happens after I enter the password.

Any help appreciated.

Kubuntu 18.04
KDE Plasma 5.12.7
KDE Frameworks 5.47.0
QT 5.9.5
Kernel 4.15.0-45-generic

Question on the UI

Is this limited to Radeon GPUs?
Also there's an option for Lenovo batteries, I'm not on Lenovo so how does this affect me?

WOL setting wrong

I recently installed tlpui and I'm loving it. Great work!

I've found a little bug though: if you turn the switch for WOL_DISABLE to "on" (default off), it actually does not disable WOL but instead appears to enable it.

Specifically: when the switch is on, WOL_DISABLE is set to "N", and various documentation seems to indicate that will cause wake-on-LAN to be enabled.

TLPUI is not requesting root permissions to write to file on Wayland

I use Fedora 28 and when i run the command python3 -m tlpui the window comes up as it should. Problem is when i am trying to save my changes nothing happens, it doesn't request root password through pkexec, the application doesn't respond and I have to force end it.

If I run the following command everything works (workaround): pkexec cd ~/Downloads/TLPUI && python3 -m tlpui

(Very nice app btw!)

UI unreadable with dark Plasma style

I recently changed my Plasma-design to Aritim-Dark and now TLPUI looks like this.
Screenshot_20200417_133813

I don't experience this in any other application I use. Is it possible to fix this somehow without changing the global style?

Fetch Simple Stats error

Hello,

I have this error when I'm trying to fetch simple stats :
File "/..../TLPUI-master/tlpui/statui.py", line 19, in fetch_simple_stats tlpstat = check_output(["tlp-stat", "-g", "-r", "-t", "-c", "-s", "-u"]).decode(sys.stdout.encoding) File "/usr/lib/python3.6/subprocess.py", line 336, in check_output **kwargs).stdout File "/usr/lib/python3.6/subprocess.py", line 418, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['tlp-stat', '-g', '-r', '-t', '-c', '-s', '-u']' returned non-zero exit status 3.
... and nothing is happening.

Fetching complete stats works well. An authentication is prompted.

Kind Regards

Description markup

Implement markup support for long descriptions: bold/italic chars, lists, ...

Group config items

Situation: many of TLP's configuration items come in pairs e.g.

SOMETHING_ON_AC
SOMETHING_ON_BAT

some even in quadruples like CPU_SCALING_MIN/MAX_FREQ_ON_AC/BAT. These tuples always share a long description in /etc/default/tlp.

TLPUI currently doesn't know about these tuples and just duplicates the long descriptions for all items.

Problems of the current appoach:

  • Uses very much UI space
  • Difficult for the user to visually recognize the relationship between the parts

Solution:

  • Implement grouping in configcategories.json
  • Multiple items can share one "title" (new attribute) and "description"
  • Place values not below but after "id" in UI

The resulting UI could look as follows

------------------------------------------------------
Title

SOMETHING_ON_AC   [ value ]
SOMETHING_ON_BAT  [ value ]

Long description

JSON schema 1.1

TLP have some update tonight.
FileNotFoundError: [Errno 2] Нет такого файла или каталога: '/home/bigforcegun/source/TLPUI/configschema/1_1.json'

Can we help with new settings schema?

configschema/1_2_1.json not found

Instaling on Ubuntu 18.10 and got error FileNotFoundError: '/home/myuser/TLPUI/tlpui/configschema/1_2_1.json'. There is only 1_2.json file in configschema folder.

Add default values and activation state

Situation: current implementation provides no means for the user to reset a single config item to it's default state

Solution: add two new attributes to the config schema

  • default_value
  • default_state – e.g. item commented or not by default

x window props missing

It doesn't look like the window props are set in x. My main issue is with WM_CLASS(STRING) = "__main__.py", "__main__.py". i3wm users rely on information like that one to configure things like whether the window should be floating.

When inspecting the TLPUI window with xprop this is the information displayed:

_NET_WM_DESKTOP(CARDINAL) = 1
_NET_WM_STATE(ATOM) = 
WM_STATE(WM_STATE):
		window state: Normal
		icon window: 0x0
WM_HINTS(WM_HINTS):
		Client accepts input or input focus: True
		Initial state is Normal State.
		window id # of group leader: 0x4e00001
_GTK_THEME_VARIANT(UTF8_STRING) = 
XdndAware(ATOM) = BITMAP
_NET_WM_OPAQUE_REGION(CARDINAL) = 2, 0, 1890, 2, 0, 2, 1894, 2074
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 81788939, 81788940
_NET_WM_USER_TIME(CARDINAL) = 33685065
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x4e0000a
WM_CLIENT_LEADER(WINDOW): window id # 0x4e00001
_NET_WM_PID(CARDINAL) = 13329
WM_LOCALE_NAME(STRING) = "en_GB.UTF-8"
WM_CLIENT_MACHINE(STRING) = "work"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
		program specified minimum size: 434 by 779
		program specified base size: 0 by 0
		window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "__main__.py", "__main__.py"
WM_ICON_NAME(STRING) = "TLP-UI"
_NET_WM_ICON_NAME(UTF8_STRING) = "TLP-UI"
WM_NAME(STRING) = "TLP-UI"
_NET_WM_NAME(UTF8_STRING) = "TLP-UI"

[Advance Notice] New configuration scheme in TLP 1.3

Hi,

i really don't want to pull away the carpet under TLPUI's feet, so some information in advance.

Configuration is split into several files, read in the following order:

  1. /usr/share/tlp/defaults.conf – Intrinsic defaults
  2. /etc/tlp.conf.d/*.conf – Drop-in customizations
  3. /etc/tlp.conf – User configuration

In case of identical parameters, the last occurence has precedence.

Reading and merging the files is done by tlp-readconfs, feel free to make use of it.

In addition tlp subcommands init, auto, start, bat, ac, suspend
and resume will write the merged configuration to /run/tlp/run.conf.

There is no release date for 1.3 yet and i would be grateful for your comments and suggestions. Note that the feature isn't even in the master branch yet.

References:

Grüsse / Regards, Thomas

Cannot run on elementary os Loki

when trying to run TLPUI with ./tlpui.py
I get this error message 👍
Traceback (most recent call last): File "./TLP/tlpui.py", line 10, in <module> from mainui import create_main_box, close_window File "/home/harisvsulaiman/TLP/mainui.py", line 6, in <module> from configui import create_config_box File "/home/harisvsulaiman/TLP/configui.py", line 13, in <module> trans = gettext.translation('configdescriptions', 'lang/', languages=['de_DE', 'en_EN']) File "/usr/lib/python3.5/gettext.py", line 432, in translation raise OSError(ENOENT, 'No translation file found for domain', domain) FileNotFoundError: [Errno 2] No translation file found for domain: 'configdescriptions'

error at start ./tlpui.py

[joks@joks-pc TLPUI-master]$ ./tlpui.py
Traceback (most recent call last):
File "./tlpui.py", line 26, in
window.add(create_main_box(window, defaultconfigpath, tlpconfig))
File "/home/joks/Pobrane/TLPUI-master/mainui.py", line 136, in create_main_box
configbox = create_config_box(tlp_config_items)
File "/home/joks/Pobrane/TLPUI-master/configui.py", line 22, in create_config_box
tlp_categories = get_tlp_categories(tlp_config_items)
File "/home/joks/Pobrane/TLPUI-master/configui.py", line 177, in get_tlp_categories
tlpitem = tlpconfig[id]
KeyError: 'TLP_DEFAULT_MODE'

Error while building setup.py

$ python3 -m tlpui
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/tlpui/__main__.py", line 8, in <module>
    from . import settings
  File "/usr/lib/python3/dist-packages/tlpui/settings.py", line 73, in <module>
    tlpconfigfile = get_tlp_config_file()
  File "/usr/lib/python3/dist-packages/tlpui/settings.py", line 47, in get_tlp_config_file
    return pattern.search(currentconfig).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

Can't build in 18.04

I keep getting this error

python3 -m tlpui
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/share/tlpui/tlpui/__main__.py", line 8, in <module>
    from . import settings
  File "/usr/share/tlpui/tlpui/settings.py", line 45, in <module>
    tlpconfigfile = config['default']['tlpconfigfile']
  File "/usr/lib/python3.6/configparser.py", line 1233, in __getitem__
    raise KeyError(key)
KeyError: 'tlpconfigfile'

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.