From cf202090e99c676bbe790d1224c3d08ccbcf1c94 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Thu, 24 Nov 2022 12:19:29 +0100 Subject: [PATCH 1/2] Slight refactor, update README Signed-off-by: TheArcaneBrony --- .gitignore | 4 + README.md | 100 +++++++++-------- advanced.py | 163 ++++++++++++++-------------- at_startup.sh | 3 - ec_dump.py | 68 ++++++------ indicator.py | 38 +++---- install_deps.sh | 19 +++- monitor.py | 106 +++++++++--------- icon_22.png => openfreezecenter.png | Bin read_temp_set.py | 65 ++--------- root_permissions.sh | 16 --- write_EC.py | 46 ++------ 12 files changed, 275 insertions(+), 353 deletions(-) create mode 100644 .gitignore delete mode 100644 at_startup.sh rename icon_22.png => openfreezecenter.png (100%) delete mode 100644 root_permissions.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e22e554 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +conf.txt +.vscode/ +nohup.out + diff --git a/README.md b/README.md index 10b8983..3e5c869 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,17 @@ -# Next version release on jan 20th at 12:00PM should resolve most of the issues!! - -# ```Working on MSI Center software and making laptops with this software respond to calls from same script!!``` - -# Brand New UI. Now work as App Indicator -# SCREENSHOTS +# OpenFreezeCenter +###### *MSI Dragon Center for Linux* +--- +##### Notice: Next version is planned for the 20th of January. It should resolve most of the issues. + +## Features +--- +- Lives in system tray +- Allows setting static fan speed +- Allows setting fan curves +- Allows setting battery charge limit + +## Screenshots +--- ## Main Application ![Screenshot from 2021-06-10 04-16-03.png](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/a9af1fe3d027d6e2af8ceef4a0c62e2735c12e83/Screenshot%20from%202021-06-10%2004-16-03.png) @@ -22,66 +30,56 @@ ## EC Map Window ![Screenshot from 2021-06-10 04-16-36.png](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/a9af1fe3d027d6e2af8ceef4a0c62e2735c12e83/Screenshot%20from%202021-06-10%2004-16-36.png) -# MSI Dragon Center for Linux -# Official name :- OpenFreezeCenter - -- This project will be weekly Updated! -- For more features do comment and share your views! -- Well if you like my work, Do follow me for more awesome projects!! - -For Those running Linux Distro on MSI laptops. This is the Graphic User Interface application meant for Fan control and monitoring in Linux. -- This Application can run on any Linux distro!! -- Installation is very easy with one command solution!! - -### Disable SECURE BOOT because it interferes with the permission of the script to read/write to EC file. -# .DEB package comming soon, till then delete previous versions of the application by deleting the directory and replacing it with the new release you download. Reinstall is not required and will be only done the first time automatically! thanks to # @Special-Niewbie +## Important notices +- Disable secure boot because it interferes with the permission of the script to read/write to EC file. +- Packages comming soon +- Deleting `conf.txt` will delete your fan curves and other configuration data. -# How To Install GUI app? -- Download the .zip from the github and extract it wherever you want -- Open terminal inside the extracted folder and run ```./at_startup.sh``` -- This will install all the dependencies which are missing and open the GUI app for the first time. -- App will create ```conf.txt``` file. it will contain all your configurations and fan curve values. deleting that file will reset all your fan curves. +## How to install? +You can't install this application yet, see below! -# How To Run GUI app? -- Open terminal inside the extracted folder and run ```./at_startup.sh``` +## How to run? +Open a terminal inside the extracted folder and run `sudo python3 indicator.py` -# For any issue follow the guideline below -- Specify the System Specifications [CPU, GPU] and Model Number [MSI GP76 11UG]. -- Write the problem with some description. -- Attach relevant screenshots. +## Reporting bugs +- Specify your system information + - Example: *MSI GF75 Thin 9SC, i7-9750h, GTX 1650* +- Describe your issue +- Attach relevant screenshots -# Working on models +## Known working models - MSI GE66 - MSI GS65 - MSI GF63 - MSI GP76 (11th Gen Intel) -- HELP ME ADD MORE MODELS. TEST AND REPORT ME +- MSI GF75 Thin 9SC (partial: no fan control besides cooler boost, fan speed is wrong) +- *If the application works on yours and isn't listed, let me know!* -# Working on Linux distro +## Known working distros - Ubuntu - Pop OS - Mint - Kubuntu -- HELP ME ADD MORE DISTROS. TEST AND REPORT ME +- *If the application works on yours and isn't listed, let me know!* -# Goals +## Goals ``` - - Basic GUI Done - - Fan Control with GUI Done - - Auto, Basic, Advanced, Cooler Booster Done - - Basic temperature and RPM monitoring Done - - One click install Done - - Dark Mode Done - - Configuration file Done - - Back version support Done - - Making Pre-required installs automatic Done - - Integrating it as an app indicator Done - - EC Map View Done - - Debian Package In Beta Testing -> thanks to @Special-Niewbie - - Graph to monitor Temps and speeds In beta Testing - - Dual GPU support In beta Testing + - [x] Basic GUI + - [x] Fan Control with GUI + - [x] Auto, Basic, Advanced, Cooler Booster + - [x] Basic temperature and RPM monitoring + - [x] One click install + - [x] Dark Mode + - [x] Configuration file + - [x] Back version support + - [x] Making Pre-required installs automatic + - [x] Integrating it as an app indicator + - [x] EC Map View + - [ ] Debian Package (in beta testing, thanks @Special-Niewbie) + - [ ] Graph to monitor Temps and speeds (In beta testing) + - [ ] Dual GPU support (in beta testing) - ``` -# Known Bugs :- 1 -- If you are not able to see the Speed of CPU fan but the percentage is showing perfectely fine, then do enable the ```Intel 11Th gen``` and report me and tell the generation of your processor!!. The 11th gen tag is alone write now, 10th gen please do check and confirm!! +## Known Bugs +- If you are not able to see the Speed of CPU fan but the percentage is showing perfectely fine, then do enable the ```Intel 11th gen``` and let me know and tell the generation of your processor!!. The 11th gen tag is alone write now, 10th gen please do check and confirm!! diff --git a/advanced.py b/advanced.py index e4c8e15..c5d8e39 100644 --- a/advanced.py +++ b/advanced.py @@ -6,27 +6,26 @@ from math import pow path_to_script = os.path.dirname(os.path.abspath(__file__)) -my_filename = os.path.join(path_to_script, "conf.txt") +config_path = os.path.join(path_to_script, "conf.txt") def reading(): - conf_file = open(my_filename, "r") + conf_file = open(config_path, "r") all_lines = conf_file.readlines() conf_file.close() return all_lines def corrections(lines): - conf_file = open(my_filename, "w") + conf_file = open(config_path, "w") conf_file.writelines(lines) conf_file.close() str_1 = '' - for line in fileinput.FileInput(my_filename, inplace=1): + for line in fileinput.FileInput(config_path, inplace=1): if line.rstrip(): str_1 = str_1 + line - conf_file = open(my_filename, "w") + conf_file = open(config_path, "w") conf_file.writelines(str_1) conf_file.close() - os.system("konsole -e 'bash -c \"sudo python3 ${pkgdir}write_EC.py\"'") - return + os.system("python3 write_EC.py") window = Tk() dpi_base = 76 @@ -58,87 +57,87 @@ def corrections(lines): print(j) w.append(int(j)) count_w = count_w + 1 -lable_ct8 = Label(window, text = "CPU fan Speeds" , fg = 'blue', bg = 'black', font=("Helvetica", 10)) -lable_ct8.place(x = dpi_scale * 135 , y = dpi_scale * 10) +label_ct8 = Label(window, text = "CPU fan Speeds" , fg = 'blue', bg = 'black', font=("Helvetica", 10)) +label_ct8.place(x = dpi_scale * 135 , y = dpi_scale * 10) -lable_gt7 = Label(window, text = "GPU fan Speeds" , fg = 'blue', bg = 'black', font=("Helvetica", 10)) -lable_gt7.place(x = dpi_scale * 135, y = dpi_scale * 290) +label_gt7 = Label(window, text = "GPU fan Speeds" , fg = 'blue', bg = 'black', font=("Helvetica", 10)) +label_gt7.place(x = dpi_scale * 135, y = dpi_scale * 290) canvas.create_line(dpi_scale * 0, dpi_scale * 280, dpi_scale * 370, dpi_scale * 280, dash=(10, 4), fill = "grey") -lable_ct1 = Label(window, text = str(v[1]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_ct1.place(x = (dpi_scale * 25) - pow(3, dpi_scale_reducer), y = dpi_scale * 30) -lable_ct2 = Label(window, text = str(v[2]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_ct2.place(x = (dpi_scale * 75) - pow(4, dpi_scale_reducer), y = dpi_scale * 30) -lable_ct3 = Label(window, text = str(v[3]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_ct3.place(x = (dpi_scale * 125) - pow(4, dpi_scale_reducer), y = dpi_scale * 30) -lable_ct4 = Label(window, text = str(v[4]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_ct4.place(x = (dpi_scale * 175) - pow(4, dpi_scale_reducer), y = dpi_scale * 30) -lable_ct5 = Label(window, text = str(v[5]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_ct5.place(x = (dpi_scale * 225) - pow(4, dpi_scale_reducer), y = dpi_scale * 30) -lable_ct6 = Label(window, text = str(v[6]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_ct6.place(x = (dpi_scale * 275) - pow(4, dpi_scale_reducer), y = dpi_scale * 30) -lable_ct7 = Label(window, text = str(v[7]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_ct7.place(x = (dpi_scale * 325) - pow(4, dpi_scale_reducer), y = dpi_scale * 30) -lable_gt1 = Label(window, text = str(v[8]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_gt1.place(x = (dpi_scale * 25) - pow(3, dpi_scale_reducer), y = dpi_scale * 310) -lable_gt2 = Label(window, text = str(v[9]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_gt2.place(x = (dpi_scale * 75) - pow(4, dpi_scale_reducer), y = dpi_scale * 310) -lable_gt3 = Label(window, text = str(v[10]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_gt3.place(x = (dpi_scale * 125) - pow(4, dpi_scale_reducer), y = dpi_scale * 310) -lable_gt4 = Label(window, text = str(v[11]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_gt4.place(x = (dpi_scale * 175) - pow(4, dpi_scale_reducer), y = dpi_scale * 310) -lable_gt5 = Label(window, text = str(v[12]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_gt5.place(x = (dpi_scale * 225) - pow(4, dpi_scale_reducer), y = dpi_scale * 310) -lable_gt6 = Label(window, text = str(v[13]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_gt6.place(x = (dpi_scale * 275) - pow(4, dpi_scale_reducer), y = dpi_scale * 310) -lable_gt7 = Label(window, text = str(v[14]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_gt7.place(x = (dpi_scale * 325) - pow(4, dpi_scale_reducer), y = dpi_scale * 310) +label_ct1 = Label(window, text = str(v[1]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_ct1.place(x = (dpi_scale * 25) - pow(3, dpi_scale_reducer), y = dpi_scale * 30) +label_ct2 = Label(window, text = str(v[2]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_ct2.place(x = (dpi_scale * 75) - pow(4, dpi_scale_reducer), y = dpi_scale * 30) +label_ct3 = Label(window, text = str(v[3]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_ct3.place(x = (dpi_scale * 125) - pow(4, dpi_scale_reducer), y = dpi_scale * 30) +label_ct4 = Label(window, text = str(v[4]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_ct4.place(x = (dpi_scale * 175) - pow(4, dpi_scale_reducer), y = dpi_scale * 30) +label_ct5 = Label(window, text = str(v[5]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_ct5.place(x = (dpi_scale * 225) - pow(4, dpi_scale_reducer), y = dpi_scale * 30) +label_ct6 = Label(window, text = str(v[6]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_ct6.place(x = (dpi_scale * 275) - pow(4, dpi_scale_reducer), y = dpi_scale * 30) +label_ct7 = Label(window, text = str(v[7]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_ct7.place(x = (dpi_scale * 325) - pow(4, dpi_scale_reducer), y = dpi_scale * 30) +label_gt1 = Label(window, text = str(v[8]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_gt1.place(x = (dpi_scale * 25) - pow(3, dpi_scale_reducer), y = dpi_scale * 310) +label_gt2 = Label(window, text = str(v[9]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_gt2.place(x = (dpi_scale * 75) - pow(4, dpi_scale_reducer), y = dpi_scale * 310) +label_gt3 = Label(window, text = str(v[10]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_gt3.place(x = (dpi_scale * 125) - pow(4, dpi_scale_reducer), y = dpi_scale * 310) +label_gt4 = Label(window, text = str(v[11]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_gt4.place(x = (dpi_scale * 175) - pow(4, dpi_scale_reducer), y = dpi_scale * 310) +label_gt5 = Label(window, text = str(v[12]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_gt5.place(x = (dpi_scale * 225) - pow(4, dpi_scale_reducer), y = dpi_scale * 310) +label_gt6 = Label(window, text = str(v[13]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_gt6.place(x = (dpi_scale * 275) - pow(4, dpi_scale_reducer), y = dpi_scale * 310) +label_gt7 = Label(window, text = str(v[14]) + "%", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_gt7.place(x = (dpi_scale * 325) - pow(4, dpi_scale_reducer), y = dpi_scale * 310) -lable_ct1_t = Label(window, text = str("<" + str(w[0]) + "°C"), fg = 'Green', bg = 'black', font=("Helvetica", 10)) -lable_ct1_t.place(x = (dpi_scale * 15) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) -lable_ct2_t = Label(window, text = str(str(w[0]) + "°C"), fg = 'Green', bg = 'black', font=("Helvetica", 10)) -lable_ct2_t.place(x = (dpi_scale * 70) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) -lable_ct3_t = Label(window, text = str(str(w[1]) + "°C"), fg = 'Yellow', bg = 'black', font=("Helvetica", 10)) -lable_ct3_t.place(x = (dpi_scale * 120) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) -lable_ct4_t = Label(window, text = str(str(w[2]) + "°C"), fg = 'Yellow', bg = 'black', font=("Helvetica", 10)) -lable_ct4_t.place(x = (dpi_scale * 170) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) -lable_ct5_t = Label(window, text = str(str(w[3]) + "°C"), fg = 'orange', bg = 'black', font=("Helvetica", 10)) -lable_ct5_t.place(x = (dpi_scale * 220) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) -lable_ct6_t = Label(window, text = str(str(w[4]) + "°C"), fg = 'Red', bg = 'black', font=("Helvetica", 10)) -lable_ct6_t.place(x = (dpi_scale * 270) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) -lable_ct7_t = Label(window, text = str(str(w[5]) + "°C"), fg = 'Red', bg = 'black', font=("Helvetica", 10)) -lable_ct7_t.place(x = (dpi_scale * 320) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) -lable_gt1_t = Label(window, text = str("<" + str(w[6]) + "°C"), fg = 'Green', bg = 'black', font=("Helvetica", 10)) -lable_gt1_t.place(x = (dpi_scale * 15) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) -lable_gt2_t = Label(window, text = str(str(w[6]) + "°C"), fg = 'Green', bg = 'black', font=("Helvetica", 10)) -lable_gt2_t.place(x = (dpi_scale * 70) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) -lable_gt3_t = Label(window, text = str(str(w[7]) + "°C"), fg = 'Yellow', bg = 'black', font=("Helvetica", 10)) -lable_gt3_t.place(x = (dpi_scale * 120) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) -lable_gt4_t = Label(window, text = str(str(w[8]) + "°C"), fg = 'Yellow', bg = 'black', font=("Helvetica", 10)) -lable_gt4_t.place(x = (dpi_scale * 170) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) -lable_gt5_t = Label(window, text = str(str(w[9]) + "°C"), fg = 'orange', bg = 'black', font=("Helvetica", 10)) -lable_gt5_t.place(x = (dpi_scale * 220) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) -lable_gt6_t = Label(window, text = str(str(w[10]) + "°C"), fg = 'red', bg = 'black', font=("Helvetica", 10)) -lable_gt6_t.place(x = (dpi_scale * 270) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) -lable_gt7_t = Label(window, text = str(str(w[11]) + "°C"), fg = 'red', bg = 'black', font=("Helvetica", 10)) -lable_gt7_t.place(x = (dpi_scale * 320) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) +label_ct1_t = Label(window, text = str("<" + str(w[0]) + "°C"), fg = 'Green', bg = 'black', font=("Helvetica", 10)) +label_ct1_t.place(x = (dpi_scale * 15) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) +label_ct2_t = Label(window, text = str(str(w[0]) + "°C"), fg = 'Green', bg = 'black', font=("Helvetica", 10)) +label_ct2_t.place(x = (dpi_scale * 70) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) +label_ct3_t = Label(window, text = str(str(w[1]) + "°C"), fg = 'Yellow', bg = 'black', font=("Helvetica", 10)) +label_ct3_t.place(x = (dpi_scale * 120) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) +label_ct4_t = Label(window, text = str(str(w[2]) + "°C"), fg = 'Yellow', bg = 'black', font=("Helvetica", 10)) +label_ct4_t.place(x = (dpi_scale * 170) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) +label_ct5_t = Label(window, text = str(str(w[3]) + "°C"), fg = 'orange', bg = 'black', font=("Helvetica", 10)) +label_ct5_t.place(x = (dpi_scale * 220) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) +label_ct6_t = Label(window, text = str(str(w[4]) + "°C"), fg = 'Red', bg = 'black', font=("Helvetica", 10)) +label_ct6_t.place(x = (dpi_scale * 270) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) +label_ct7_t = Label(window, text = str(str(w[5]) + "°C"), fg = 'Red', bg = 'black', font=("Helvetica", 10)) +label_ct7_t.place(x = (dpi_scale * 320) - pow(3, dpi_scale_reducer), y = dpi_scale * 257) +label_gt1_t = Label(window, text = str("<" + str(w[6]) + "°C"), fg = 'Green', bg = 'black', font=("Helvetica", 10)) +label_gt1_t.place(x = (dpi_scale * 15) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) +label_gt2_t = Label(window, text = str(str(w[6]) + "°C"), fg = 'Green', bg = 'black', font=("Helvetica", 10)) +label_gt2_t.place(x = (dpi_scale * 70) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) +label_gt3_t = Label(window, text = str(str(w[7]) + "°C"), fg = 'Yellow', bg = 'black', font=("Helvetica", 10)) +label_gt3_t.place(x = (dpi_scale * 120) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) +label_gt4_t = Label(window, text = str(str(w[8]) + "°C"), fg = 'Yellow', bg = 'black', font=("Helvetica", 10)) +label_gt4_t.place(x = (dpi_scale * 170) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) +label_gt5_t = Label(window, text = str(str(w[9]) + "°C"), fg = 'orange', bg = 'black', font=("Helvetica", 10)) +label_gt5_t.place(x = (dpi_scale * 220) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) +label_gt6_t = Label(window, text = str(str(w[10]) + "°C"), fg = 'red', bg = 'black', font=("Helvetica", 10)) +label_gt6_t.place(x = (dpi_scale * 270) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) +label_gt7_t = Label(window, text = str(str(w[11]) + "°C"), fg = 'red', bg = 'black', font=("Helvetica", 10)) +label_gt7_t.place(x = (dpi_scale * 320) - pow(3, dpi_scale_reducer), y = dpi_scale * 540) def sct_val(val): - lable_ct1.config(text = str(sct1.get()) + "%") - lable_ct2.config(text = str(sct2.get()) + "%") - lable_ct3.config(text = str(sct3.get()) + "%") - lable_ct4.config(text = str(sct4.get()) + "%") - lable_ct5.config(text = str(sct5.get()) + "%") - lable_ct6.config(text = str(sct6.get()) + "%") - lable_ct7.config(text = str(sct7.get()) + "%") - lable_gt1.config(text = str(sgt1.get()) + "%") - lable_gt2.config(text = str(sgt2.get()) + "%") - lable_gt3.config(text = str(sgt3.get()) + "%") - lable_gt4.config(text = str(sgt4.get()) + "%") - lable_gt5.config(text = str(sgt5.get()) + "%") - lable_gt6.config(text = str(sgt6.get()) + "%") - lable_gt7.config(text = str(sgt7.get()) + "%") + label_ct1.config(text = str(sct1.get()) + "%") + label_ct2.config(text = str(sct2.get()) + "%") + label_ct3.config(text = str(sct3.get()) + "%") + label_ct4.config(text = str(sct4.get()) + "%") + label_ct5.config(text = str(sct5.get()) + "%") + label_ct6.config(text = str(sct6.get()) + "%") + label_ct7.config(text = str(sct7.get()) + "%") + label_gt1.config(text = str(sgt1.get()) + "%") + label_gt2.config(text = str(sgt2.get()) + "%") + label_gt3.config(text = str(sgt3.get()) + "%") + label_gt4.config(text = str(sgt4.get()) + "%") + label_gt5.config(text = str(sgt5.get()) + "%") + label_gt6.config(text = str(sgt6.get()) + "%") + label_gt7.config(text = str(sgt7.get()) + "%") return sct1 = Scale(window, from_ = 150, to = 0, orient = VERTICAL, length = dpi_scale * 200, showvalue = 0, tickinterval = 5, resolution = 5, fg = 'white', bg = 'black', command = sct_val) @@ -192,14 +191,12 @@ def adv_apply(): lines = lines + str(val) + "," lines = lines + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) - return adv = Button(window, text = "Apply", width = 20, fg = 'white', bg = 'black', command = adv_apply) adv.place(x = dpi_scale * 90, y = dpi_scale * 560) def on_closing(): window.destroy() - return canvas.pack(fill = BOTH, expand = 1) window.protocol("WM_DELETE_WINDOW", on_closing) diff --git a/at_startup.sh b/at_startup.sh deleted file mode 100644 index e6c5c6c..0000000 --- a/at_startup.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -python3 indicator.py >/dev/null 2>&1 & exit diff --git a/ec_dump.py b/ec_dump.py index 062f5b0..6d51dea 100644 --- a/ec_dump.py +++ b/ec_dump.py @@ -35,72 +35,72 @@ def map(line): FILE.close() return lines -lable_1 = Label(window_m, padx = 0, pady = 0, text = " 0 1 2 3 4 5 6 7 8 9 A B C D E F ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_1.place(x = dpi_scale * 10, y = dpi_scale * 17) +label_1 = Label(window_m, padx = 0, pady = 0, text = " 0 1 2 3 4 5 6 7 8 9 A B C D E F ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_1.place(x = dpi_scale * 10, y = dpi_scale * 17) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 46, dpi_scale * 350, dpi_scale * 46, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_2 = Label(window_m, padx = 0, pady = 0, text = "000000 >" + map(0) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_2.place(x = dpi_scale * 10, y = dpi_scale * 47) +label_2 = Label(window_m, padx = 0, pady = 0, text = "000000 >" + map(0) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_2.place(x = dpi_scale * 10, y = dpi_scale * 47) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 66, dpi_scale * 350, dpi_scale * 66, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_3 = Label(window_m, padx = 0, pady = 0, text = "000010 >" + map(1) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_3.place(x = dpi_scale * 10, y = dpi_scale * 67) +label_3 = Label(window_m, padx = 0, pady = 0, text = "000010 >" + map(1) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_3.place(x = dpi_scale * 10, y = dpi_scale * 67) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 86, dpi_scale * 350, dpi_scale * 86, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_4 = Label(window_m, padx = 0, pady = 0, text = "000020 >" + map(2) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_4.place(x = dpi_scale * 10, y = dpi_scale * 87) +label_4 = Label(window_m, padx = 0, pady = 0, text = "000020 >" + map(2) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_4.place(x = dpi_scale * 10, y = dpi_scale * 87) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 106, dpi_scale * 350, dpi_scale * 106, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_5 = Label(window_m, padx = 0, pady = 0, text = "000030 >" + map(3) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_5.place(x = dpi_scale * 10, y = dpi_scale * 107) +label_5 = Label(window_m, padx = 0, pady = 0, text = "000030 >" + map(3) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_5.place(x = dpi_scale * 10, y = dpi_scale * 107) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 126, dpi_scale * 350, dpi_scale * 126, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_6 = Label(window_m, padx = 0, pady = 0, text = "000040 >" + map(4) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_6.place(x = dpi_scale * 10, y = dpi_scale * 127) +label_6 = Label(window_m, padx = 0, pady = 0, text = "000040 >" + map(4) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_6.place(x = dpi_scale * 10, y = dpi_scale * 127) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 146, dpi_scale * 350, dpi_scale * 146, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_7 = Label(window_m, padx = 0, pady = 0, text = "000050 >" + map(5) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_7.place(x = dpi_scale * 10, y = dpi_scale * 147) +label_7 = Label(window_m, padx = 0, pady = 0, text = "000050 >" + map(5) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_7.place(x = dpi_scale * 10, y = dpi_scale * 147) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 166, dpi_scale * 350, dpi_scale * 166, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_8 = Label(window_m, padx = 0, pady = 0, text = "000060 >" + map(6) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_8.place(x = dpi_scale * 10, y = dpi_scale * 167) +label_8 = Label(window_m, padx = 0, pady = 0, text = "000060 >" + map(6) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_8.place(x = dpi_scale * 10, y = dpi_scale * 167) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 186, dpi_scale * 350, dpi_scale * 186, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_9 = Label(window_m, padx = 0, pady = 0, text = "000070 >" + map(7) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_9.place(x = dpi_scale * 10, y = dpi_scale * 187) +label_9 = Label(window_m, padx = 0, pady = 0, text = "000070 >" + map(7) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_9.place(x = dpi_scale * 10, y = dpi_scale * 187) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 206, dpi_scale * 350, dpi_scale * 206, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_10 = Label(window_m, padx = 0, pady = 0, text = "000080 >" + map(8) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_10.place(x = dpi_scale * 10, y = dpi_scale * 207) +label_10 = Label(window_m, padx = 0, pady = 0, text = "000080 >" + map(8) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_10.place(x = dpi_scale * 10, y = dpi_scale * 207) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 226, dpi_scale * 350, dpi_scale * 226, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_11 = Label(window_m, padx = 0, pady = 0, text = "000090 >" + map(9) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_11.place(x = dpi_scale * 10, y = dpi_scale * 227) +label_11 = Label(window_m, padx = 0, pady = 0, text = "000090 >" + map(9) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_11.place(x = dpi_scale * 10, y = dpi_scale * 227) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 246, dpi_scale * 350, dpi_scale * 246, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_12 = Label(window_m, padx = 0, pady = 0, text = "0000A0 >" + map(10) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_12.place(x = dpi_scale * 10, y = dpi_scale * 247) +label_12 = Label(window_m, padx = 0, pady = 0, text = "0000A0 >" + map(10) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_12.place(x = dpi_scale * 10, y = dpi_scale * 247) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 266, dpi_scale * 350, dpi_scale * 266, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_13 = Label(window_m, padx = 0, pady = 0, text = "0000B0 >" + map(11) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_13.place(x = dpi_scale * 10, y = dpi_scale * 267) +label_13 = Label(window_m, padx = 0, pady = 0, text = "0000B0 >" + map(11) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_13.place(x = dpi_scale * 10, y = dpi_scale * 267) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 286, dpi_scale * 350, dpi_scale * 286, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_14 = Label(window_m, padx = 0, pady = 0, text = "0000C0 >" + map(12) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_14.place(x = dpi_scale * 10, y = dpi_scale * 287) +label_14 = Label(window_m, padx = 0, pady = 0, text = "0000C0 >" + map(12) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_14.place(x = dpi_scale * 10, y = dpi_scale * 287) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 306, dpi_scale * 350, dpi_scale * 306, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_15 = Label(window_m, padx = 0, pady = 0, text ="0000D0 >" + map(13) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_15.place(x = dpi_scale * 10, y = dpi_scale * 307) +label_15 = Label(window_m, padx = 0, pady = 0, text ="0000D0 >" + map(13) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_15.place(x = dpi_scale * 10, y = dpi_scale * 307) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 326, dpi_scale * 350, dpi_scale * 326, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_16 = Label(window_m, padx = 0, pady = 0, text = "0000E0 >" + map(14) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_16.place(x = dpi_scale * 10, y = dpi_scale * 327) +label_16 = Label(window_m, padx = 0, pady = 0, text = "0000E0 >" + map(14) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_16.place(x = dpi_scale * 10, y = dpi_scale * 327) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 346, dpi_scale * 350, dpi_scale * 346, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") -lable_17 = Label(window_m, padx = 0, pady = 0, text = "0000F0 >" + map(15) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) -lable_17.place(x = dpi_scale * 10, y = dpi_scale * 347) +label_17 = Label(window_m, padx = 0, pady = 0, text = "0000F0 >" + map(15) + "|< ", fg = 'white', bg = 'black', font=("monospace", 10)) +label_17.place(x = dpi_scale * 10, y = dpi_scale * 347) canvas.create_line((dpi_scale * 97) - pow(2, dpi_scale_reducer), dpi_scale * 366, dpi_scale * 350, dpi_scale * 366, dash=(dpi_scale * 14, dpi_scale * 2), fill = "grey") def on_closing(): diff --git a/indicator.py b/indicator.py index 6851167..aed542f 100644 --- a/indicator.py +++ b/indicator.py @@ -8,19 +8,18 @@ #################################################################################################### Indicator Making -APPINDICATOR_ID = 'myappindicator' -iconpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "icon_22.png") +APPINDICATOR_ID = 'openfreezecenter' +iconpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "openfreezecenter.png") path_to_script = os.path.dirname(os.path.abspath(__file__)) -my_filename = os.path.join(path_to_script, "conf.txt") -check_1 = os.path.exists(my_filename) - -if check_1 == False: - os.system("konsole -e 'bash -c \"./root_permissions.sh\"'") - os.system("konsole -e 'bash -c \"sudo ./install_deps.sh\"'") - open(my_filename, "w").close() - subprocess.call(['chmod', '0777', my_filename]) - conf_file = open(my_filename, "w") +config_path = os.path.join(path_to_script, "conf.txt") +is_installed = os.path.exists(config_path) + +if not is_installed: + print("Oops! Looks like we haven't ran before! Make sure dependencies are installed if you see any errors!") + open(config_path, "w").close() + subprocess.call(['chmod', '0777', config_path]) + conf_file = open(config_path, "w") conf_file.writelines("1\n0\n") temp_ = [140,0,20,40,45,50,60,70,0,20,40,45,50,60,70] for val in temp_: @@ -36,7 +35,7 @@ conf_file.write("%i," % val) conf_file.write("\n0") conf_file.close() - os.system("konsole -e 'bash -c \"sudo nohup python3 ${pkgdir}read_temp_set.py >/dev/null 2>&1\"'") + os.system("python3 read_temp_set.py") import gi.repository gi.require_version('Gtk', '3.0') @@ -45,24 +44,23 @@ from gi.repository import AppIndicator3 as appindicator def reading(): - conf_file = open(my_filename, "r") + conf_file = open(config_path, "r") all_lines = conf_file.readlines() conf_file.close() return all_lines def corrections(lines): - conf_file = open(my_filename, "w") + conf_file = open(config_path, "w") conf_file.writelines(lines) conf_file.close() str_1 = '' - for line in fileinput.FileInput(my_filename, inplace=1): + for line in fileinput.FileInput(config_path, inplace=1): if line.rstrip(): str_1 = str_1 + line - conf_file = open(my_filename, "w") + conf_file = open(config_path, "w") conf_file.writelines(str_1) conf_file.close() - os.system("konsole -e 'bash -c \"sudo python3 ${pkgdir}write_EC.py\"'") - return + os.system("python3 write_EC.py") all_lines = reading() lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] @@ -274,7 +272,7 @@ def cooler_booster(source): corrections(lines) def monitoring(source): - os.system("konsole -e 'bash -c \"sudo nohup python3 ${pkgdir}monitor.py >/dev/null 2>&1\"'") + os.system("python3 monitor.py") def powersaver(source): f = 0 @@ -322,7 +320,7 @@ def battery_charge_threashold_100(source): corrections(lines) def ec_map(source): - os.system("konsole -e 'bash -c \"sudo nohup python3 ${pkgdir}ec_dump.py >/dev/null 2>&1\"'") + os.system("python3 ec_dump.py") def flip_board_1(source): all_lines = reading() diff --git a/install_deps.sh b/install_deps.sh index ed71616..2ead835 100644 --- a/install_deps.sh +++ b/install_deps.sh @@ -1,9 +1,20 @@ #!/bin/bash +# Is this a good idea? Shouldn't this be up to the package? +# Doesn't this depend on the distro using systemd? install etc/modprobe.d/ec_sys.conf /etc/modprobe.d/ec_sys.conf install etc/modules-load.d/ec_sys.conf /etc/modules-load.d/ec_sys.conf +# Shouldn't this be managed in the python code? modprobe ec_sys write_support=1 -pacman -S python-pip -y -pacman -S tk -y -pip3 install psutil -GRUB_CMDLINE_LINUX_DEFAULT="quiet ec_sys.write_support=1" +if [ -f "/bin/pacman" ]; then + # Arch ships many popular python packages + # These are generally preferred over installing through pip + pacman -Sy python-psutil tk +else if [ -f "/bin/apt-get" ]; then + #apt install -y + echo "apt packages unknown, please add to install_deps.sh!" + # If apt has a package for python's psutil, this is preferred over pip! + #pip install psutil +else + echo "Unknown package manager, please add to install_deps.sh!" +fi diff --git a/monitor.py b/monitor.py index bda9f1f..dfa143f 100644 --- a/monitor.py +++ b/monitor.py @@ -31,11 +31,11 @@ canvas = Canvas(window_m) canvas.configure(bg = 'black') -def monitoring_int(lable_c11, lable_c22, lable_c33, lable_g11, lable_g22, lable_g33, lable_m44, lable_m55, lable_m444, lable_m555): +def monitoring_int(label_c11, label_c22, label_c33, label_g11, label_g22, label_g33, label_m44, label_m55, label_m444, label_m555): global monitoring monitoring = 1 global timer - timer = threading.Timer(1, monitoring_int, args = (lable_c11, lable_c22, lable_c33, lable_g11, lable_g22, lable_g33, lable_m44, lable_m55, lable_m444, lable_m555)) + timer = threading.Timer(1, monitoring_int, args = (label_c11, label_c22, label_c33, label_g11, label_g22, label_g33, label_m44, label_m55, label_m444, label_m555)) timer.start() global temp_m temp_m = mode @@ -65,22 +65,22 @@ def monitoring_int(lable_c11, lable_c22, lable_c33, lable_g11, lable_g22, lable_ gpu_fan = 478000//gpu_fan if cpu_cur_temp > temp_c: temp_c = cpu_cur_temp - color(temp_c, lable_c22) + color(temp_c, label_c22) if gpu_cur_temp > temp_g: temp_g = gpu_cur_temp - color(temp_c, lable_g22) + color(temp_c, label_g22) if cpu_cur_temp < temp_c_m: temp_c_m = cpu_cur_temp - color(temp_c_m, lable_c33) + color(temp_c_m, label_c33) if gpu_cur_temp < temp_g_m: temp_g_m = gpu_cur_temp - color(temp_g_m, lable_g33) - color(cpu_cur_temp, lable_c11) - color(gpu_cur_temp, lable_g11) - lable_m44.config(text = cpu_fan) - lable_m55.config(text = gpu_fan) - lable_m444.config(text = str(cpu_fan_s) + "%") - lable_m555.config(text = str(gpu_fan_s) + "%") + color(temp_g_m, label_g33) + color(cpu_cur_temp, label_c11) + color(gpu_cur_temp, label_g11) + label_m44.config(text = cpu_fan) + label_m55.config(text = gpu_fan) + label_m444.config(text = str(cpu_fan_s) + "%") + label_m555.config(text = str(gpu_fan_s) + "%") return def color(temp, lable): @@ -95,47 +95,47 @@ def color(temp, lable): return -lable_c1 = Label(window_m, text = "CPU Temperature (Celcius) : ", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_c1.place(x = dpi_scale * 10, y = dpi_scale * 27) -lable_c11 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) -lable_c11.place(x = dpi_scale * 190, y = dpi_scale * 27) - -lable_c2 = Label(window_m, text = "Max", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_c2.place(x = dpi_scale * 245, y = dpi_scale * 10) -lable_c22 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) -lable_c22.place(x = dpi_scale * 250, y = dpi_scale * 27) - -lable_c3 = Label(window_m, text = "Min", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_c3.place(x = dpi_scale * 285, y = dpi_scale * 10) -lable_c33 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) -lable_c33.place(x = dpi_scale * 290, y = dpi_scale * 27) - -lable_g1 = Label(window_m, text = "GPU Temperature (Celcius) : ", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_g1.place(x = dpi_scale * 10, y = dpi_scale * 47) -lable_g11 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) -lable_g11.place(x = dpi_scale * 190, y = dpi_scale * 47) - -lable_g22 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) -lable_g22.place(x = dpi_scale * 250, y = dpi_scale * 47) - -lable_g33 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) -lable_g33.place(x = dpi_scale * 290, y = dpi_scale * 47) - -lable_m4 = Label(window_m, text = "CPU fan RPM : ", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_m4.place(x = dpi_scale * 10, y = dpi_scale * 67) -lable_m44 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) -lable_m44.place(x = dpi_scale * 190, y = dpi_scale * 67) -lable_m444 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) -lable_m444.place(x = dpi_scale * 250, y = dpi_scale * 67) - -lable_m5 = Label(window_m, text = "GPU fan RPM : ", fg = 'white', bg = 'black', font=("Helvetica", 10)) -lable_m5.place(x = dpi_scale * 10, y = dpi_scale * 87) -lable_m55 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) -lable_m55.place(x = dpi_scale * 190, y = dpi_scale * 87) -lable_m555 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) -lable_m555.place(x = dpi_scale * 250, y = dpi_scale * 87) - -monitoring_int(lable_c11, lable_c22, lable_c33, lable_g11, lable_g22, lable_g33, lable_m44, lable_m55, lable_m444, lable_m555) +label_c1 = Label(window_m, text = "CPU Temperature (Celcius) : ", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_c1.place(x = dpi_scale * 10, y = dpi_scale * 27) +label_c11 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) +label_c11.place(x = dpi_scale * 190, y = dpi_scale * 27) + +label_c2 = Label(window_m, text = "Max", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_c2.place(x = dpi_scale * 245, y = dpi_scale * 10) +label_c22 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) +label_c22.place(x = dpi_scale * 250, y = dpi_scale * 27) + +label_c3 = Label(window_m, text = "Min", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_c3.place(x = dpi_scale * 285, y = dpi_scale * 10) +label_c33 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) +label_c33.place(x = dpi_scale * 290, y = dpi_scale * 27) + +label_g1 = Label(window_m, text = "GPU Temperature (Celcius) : ", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_g1.place(x = dpi_scale * 10, y = dpi_scale * 47) +label_g11 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) +label_g11.place(x = dpi_scale * 190, y = dpi_scale * 47) + +label_g22 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) +label_g22.place(x = dpi_scale * 250, y = dpi_scale * 47) + +label_g33 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) +label_g33.place(x = dpi_scale * 290, y = dpi_scale * 47) + +label_m4 = Label(window_m, text = "CPU fan RPM : ", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_m4.place(x = dpi_scale * 10, y = dpi_scale * 67) +label_m44 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) +label_m44.place(x = dpi_scale * 190, y = dpi_scale * 67) +label_m444 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) +label_m444.place(x = dpi_scale * 250, y = dpi_scale * 67) + +label_m5 = Label(window_m, text = "GPU fan RPM : ", fg = 'white', bg = 'black', font=("Helvetica", 10)) +label_m5.place(x = dpi_scale * 10, y = dpi_scale * 87) +label_m55 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) +label_m55.place(x = dpi_scale * 190, y = dpi_scale * 87) +label_m555 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) +label_m555.place(x = dpi_scale * 250, y = dpi_scale * 87) + +monitoring_int(label_c11, label_c22, label_c33, label_g11, label_g22, label_g33, label_m44, label_m55, label_m444, label_m555) def on_closing(): timer.cancel() diff --git a/icon_22.png b/openfreezecenter.png similarity index 100% rename from icon_22.png rename to openfreezecenter.png diff --git a/read_temp_set.py b/read_temp_set.py index 597fd20..12243aa 100644 --- a/read_temp_set.py +++ b/read_temp_set.py @@ -3,6 +3,12 @@ import os import fileinput + + +def read_range(file, range): + file.seek(range.start) + return ",".join('{:02X}'.format(x) for x in file.read(range.__len__()+1)) + EC_IO_FILE = '/sys/kernel/debug/ec/ec0/io' path_to_script = os.path.dirname(os.path.abspath(__file__)) my_filename = os.path.join(path_to_script, "conf.txt") @@ -14,60 +20,11 @@ with open(EC_IO_FILE,'r+b') as file: file.seek(0xf4) - file.write(bytes((12,))) - file.seek(0x6a) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x6b) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x6c) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x6d) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x6e) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x6f) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x82) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x83) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x84) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x85) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x86) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x87) - lines = lines + str(int(file.read(1).hex(),16)) + "," - lines = lines + "\n12," - file.seek(0x72) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x73) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x74) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x75) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x76) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x77) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x78) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x8a) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x8b) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x8c) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x8d) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x8e) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x8f) - lines = lines + str(int(file.read(1).hex(),16)) + "," - file.seek(0x90) - lines = lines + str(int(file.read(1).hex(),16)) + "," + file.write(bytes(12)) + lines += read_range(file, range(0x6a, 0x6f)) + "," + lines += read_range(file, range(0x82, 0x87)) + ",\n12," + lines += read_range(file, range(0x72, 0x78)) + "," + lines += read_range(file, range(0x8a, 0x90)) + "," conf_file = open(my_filename, "w") conf_file.writelines(lines) diff --git a/root_permissions.sh b/root_permissions.sh deleted file mode 100644 index a4bdbd2..0000000 --- a/root_permissions.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -path_python3=$(which python3) -user=$(whoami) -line="$user ALL=(root) NOPASSWD:$path_python3" -file='/etc/sudoers' -line_num=$(sudo awk '/%sudo/{print NR}' $file) -line_num=`expr $line_num + 1` -sudo sed -i "$line_num i $line" $file - -path_nohup=$(which nohup) -line_="$user ALL=(root) NOPASSWD:$path_nohup" -file_='/etc/sudoers' -line_num_=$(sudo awk '/%sudo/{print NR}' $file_) -line_num_=`expr $line_num_ + 1` -sudo sed -i "$line_num_ i $line_" $file_ diff --git a/write_EC.py b/write_EC.py index c60a682..df81953 100644 --- a/write_EC.py +++ b/write_EC.py @@ -4,9 +4,9 @@ EC_IO_FILE = '/sys/kernel/debug/ec/ec0/io' path_to_script = os.path.dirname(os.path.abspath(__file__)) -my_filename = os.path.join(path_to_script, "conf.txt") +config_path = os.path.join(path_to_script, "conf.txt") -conf_file_b = open(my_filename, "r") +conf_file_b = open(config_path, "r") all_lines = conf_file_b.readlines() mode_f = int(all_lines[0]) battery_threshold = int(all_lines[3]) @@ -16,45 +16,21 @@ def write_EC(v, battery_threshold): with open(EC_IO_FILE, 'r+b') as file: if v[0] == 128: file.seek(0x98) - file.write(bytes((128,))) + file.write(bytes(128)) file.seek(0xf4) - file.write(bytes((0,))) + file.write(bytes(0)) else: file.seek(0x98) - file.write(bytes((0,))) + file.write(bytes(0)) file.seek(0xf4) - file.write(bytes((v[0],))) + file.write(bytes(v[0],)) file.seek(114) - file.write(bytes((v[1],))) - file.seek(115) - file.write(bytes((v[2],))) - file.seek(116) - file.write(bytes((v[3],))) - file.seek(117) - file.write(bytes((v[4],))) - file.seek(118) - file.write(bytes((v[5],))) - file.seek(119) - file.write(bytes((v[6],))) - file.seek(120) - file.write(bytes((v[7],))) + file.write(bytes(v[1:8])) #elements 1-7 file.seek(138) - file.write(bytes((v[8],))) - file.seek(139) - file.write(bytes((v[9],))) - file.seek(140) - file.write(bytes((v[10],))) - file.seek(141) - file.write(bytes((v[11],))) - file.seek(142) - file.write(bytes((v[12],))) - file.seek(143) - file.write(bytes((v[13],))) - file.seek(144) - file.write(bytes((v[14],))) - """file.seek(239) - file.write(bytes((battery_threshold)))""" - return + file.write(bytes(v[8:15])) #elements 8-14 + # file.seek(239) + # file.write(bytes((battery_threshold))) + #return def get_temp_list(val): vr = [] From 7c04ad7b479f30372977c453f2e3bf85b213feac Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Thu, 24 Nov 2022 12:29:47 +0100 Subject: [PATCH 2/2] Further cleanup of README Signed-off-by: TheArcaneBrony --- README.md | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 3e5c869..3697eb0 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,34 @@ # OpenFreezeCenter ###### *MSI Dragon Center for Linux* ---- ##### Notice: Next version is planned for the 20th of January. It should resolve most of the issues. - -## Features --- +## Features - Lives in system tray - Allows setting static fan speed - Allows setting fan curves - Allows setting battery charge limit -## Screenshots --- -## Main Application -![Screenshot from 2021-06-10 04-16-03.png](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/a9af1fe3d027d6e2af8ceef4a0c62e2735c12e83/Screenshot%20from%202021-06-10%2004-16-03.png) - -## Expanded Basic Menu -![Screenshot from 2021-06-10 04-16-07.png](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/a9af1fe3d027d6e2af8ceef4a0c62e2735c12e83/Screenshot%20from%202021-06-10%2004-16-07.png) +## Screenshots +#### Main application +![Screenshot of main application](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/a9af1fe3d027d6e2af8ceef4a0c62e2735c12e83/Screenshot%20from%202021-06-10%2004-16-03.png) -## Expanded Battery Menu -![Screenshot from 2021-06-10 04-16-10.png](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/a9af1fe3d027d6e2af8ceef4a0c62e2735c12e83/Screenshot%20from%202021-06-10%2004-16-10.png) +#### Expanded basic nenu +![Basic menu](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/a9af1fe3d027d6e2af8ceef4a0c62e2735c12e83/Screenshot%20from%202021-06-10%2004-16-07.png) -## Advanced Fan curve Window -![Screenshot from 2021-06-10 04-44-41.png](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/f1905b95af32f66c629c22eb68a1ce6130c9164f/Screenshot%20from%202021-06-10%2004-44-41.png) +#### Expanded battery nenu +![Battery menu](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/a9af1fe3d027d6e2af8ceef4a0c62e2735c12e83/Screenshot%20from%202021-06-10%2004-16-10.png) -## Monitoring Window -![Screenshot from 2021-06-10 04-16-24.png](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/a9af1fe3d027d6e2af8ceef4a0c62e2735c12e83/Screenshot%20from%202021-06-10%2004-16-24.png) +#### Advanced fan curve window +![Advanced fan curve control](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/f1905b95af32f66c629c22eb68a1ce6130c9164f/Screenshot%20from%202021-06-10%2004-44-41.png) -## EC Map Window -![Screenshot from 2021-06-10 04-16-36.png](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/a9af1fe3d027d6e2af8ceef4a0c62e2735c12e83/Screenshot%20from%202021-06-10%2004-16-36.png) +#### Monitoring window +![Monitoring](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/a9af1fe3d027d6e2af8ceef4a0c62e2735c12e83/Screenshot%20from%202021-06-10%2004-16-24.png) +#### EC map window +![EC map display](https://github.com/YoCodingMonster/OpenFreezeCenter/blob/a9af1fe3d027d6e2af8ceef4a0c62e2735c12e83/Screenshot%20from%202021-06-10%2004-16-36.png) +--- ## Important notices - Disable secure boot because it interferes with the permission of the script to read/write to EC file. - Packages comming soon @@ -70,16 +68,16 @@ Open a terminal inside the extracted folder and run `sudo python3 indicator.py` - [x] Auto, Basic, Advanced, Cooler Booster - [x] Basic temperature and RPM monitoring - [x] One click install - - [x] Dark Mode + - [x] Dark mode - [x] Configuration file - [x] Back version support - - [x] Making Pre-required installs automatic + - [x] Making pre-required installs automatic - [x] Integrating it as an app indicator - [x] EC Map View - - [ ] Debian Package (in beta testing, thanks @Special-Niewbie) - [ ] Graph to monitor Temps and speeds (In beta testing) - [ ] Dual GPU support (in beta testing) - - + - [ ] Debian package (in beta testing, thanks @Special-Niewbie) + - [ ] AUR PKGBUILD (@TheArcaneBrony will do after refactor) ``` ## Known Bugs -- If you are not able to see the Speed of CPU fan but the percentage is showing perfectely fine, then do enable the ```Intel 11th gen``` and let me know and tell the generation of your processor!!. The 11th gen tag is alone write now, 10th gen please do check and confirm!! +- If you're unable to see CPU fan speed, but the percentage is showing correctly, enable `Intel 11th gen` support in the menu and report back with your processor's generation! \ No newline at end of file