liperium / Linux-Conservation-Mode-For-Lenovo

5 stars 0 forks source link

Help : Need to run the utility as user #1

Open dswapnil104 opened 2 years ago

dswapnil104 commented 2 years ago

First of all , thank you for creating this beautiful Gnome GUI utility. Works perfectly on my machine : Lenovo Legion Y540 | Pop!_OS 21.10 - Gnome 40.5

Need to run the utility as user :

  1. Also what should the contents of .desktop file look like ? As the readme doesn't talk about it much. Here is what I have at present (still wont work as intended)
[Desktop Entry]
Type=Application
Name=Lenovo CCM
GenericName=Battery Saver
Encoding=UTF-8
Icon=/home/<user>/.TCM/CCM.png
Exec=/home/<user>/.TCM/TrayConservationMode
Terminal=false

So any directions to make this happen are welcome suggestions.

liperium commented 2 years ago

I've tried ways to make it work without adding to sudoers.

I changed the permission of the conservationmode file to user. And it worked.

The problem came when I restarted my pc, the files chmod resetted...

There's another way, which is to store the password in the program, so it executes the .sh with it. But I prefered using sudoers, as if you have privilege to edit the file, then the user is already sudo.

I'm still a newby at linux. Any recommendation will be taken aha!

And for the .desktop, that looks correct. But the app wont be able to change the conservationmode value if the .sh isn't ran as sudo...

liperium commented 2 years ago

For the .desktop, do you have the GUI but the app doesn't work, or does the app not launch at all?

dswapnil104 commented 2 years ago

I've tried ways to make it work without adding to sudoers.

I changed the permission of the conservationmode file to user. And it worked.

The problem came when I restarted my pc, the files chmod resetted...

There's another way, which is to store the password in the program, so it executes the .sh with it. But I prefered using sudoers, as if you have privilege to edit the file, then the user is already sudo.

I'm still a newby at linux. Any recommendation will be taken aha!

And for the .desktop, that looks correct. But the app wont be able to change the conservationmode value if the .sh isn't ran as sudo...

Yes, exactly I too am a newbie wrt to Linux knowledge and learning something new everyday 😅. Let me read around it again maybe and then create a PR.

dswapnil104 commented 2 years ago

For the .desktop, do you have the GUI but the app doesn't work, or does the app not launch at all?

The former , the GUI shows up in gnome shell and all but would not do anything and rather retain the previous ran state from the terninal. Again just privilege issue ig not sure.

liperium commented 2 years ago

This is exacly what happens when you can't change it because the .sh script doesn't have the required permissions. Good luck, tell me if you find anything!

liperium commented 2 years ago

Hey man, I thought about it. Maybe if we do something like the openrazer drivers?? I don't know how they handle permissions to get mouse dpi and stuff, but it might be a similar situation!

dswapnil104 commented 2 years ago

Hey man, I thought about it. Maybe if we do something like the openrazer drivers?? I don't know how they handle permissions to get mouse dpi and stuff, but it might be a similar situation!

Sure, will go through the project to get myself to the speed with it maybe.