bayasdev / envycontrol

Easy GPU switching for Nvidia Optimus laptops under Linux
https://bayas.dev/envycontrol
MIT License
1.18k stars 60 forks source link

Not generating LightDM config file #88

Closed ebiscaia closed 1 year ago

ebiscaia commented 1 year ago

I ran sudo envycontrol -s nvidia --dm lightdm and I bumped a black screen. Then, I restarted the system and put into text mode as indicated and nothing seemed to be wrong. So I decided to read the code to understand a bit how it worked and I saw these lines:

LIGHTDM_CONFIG_PATH = '/etc/lightdm/lightdm.conf.d/20-nvidia.conf'

LIGHTDM_CONFIG_CONTENT = '''# Automatically generated by EnvyControl
[Seat:*]
display-setup-script=/etc/lightdm/nvidia.sh

I had taken a look at the files in that folder previously and I couldn't recall that file being present, so I decided to check. To my surprise, I was right so I created the file and restarted my computer. It worked. I don't know what the problem can be because your code has the following lines:

 elif display_manager == 'lightdm':
        if igpu_vendor == "amd":
            amd_name = _get_amd_igpu_name()
            _create_file(LIGHTDM_SCRIPT_PATH, NVIDIA_XRANDR_SCRIPT.format(amd_name))
        else:
            _create_file(LIGHTDM_SCRIPT_PATH, NVIDIA_XRANDR_SCRIPT.format("modesetting"))
        subprocess.run(['chmod','+x',LIGHTDM_SCRIPT_PATH], stdout=subprocess.DEVNULL)
        # create config
        if not os.path.exists(os.path.dirname(LIGHTDM_CONFIG_PATH)):
            _create_file(LIGHTDM_CONFIG_PATH, LIGHTDM_CONFIG_CONTENT)

in which the final line is responsible for writing the file with the contents. I am not not sure what is the problem, but I think it would be easy for you to fix with the information provided.

Thanks,

Eduardo

ebiscaia commented 1 year ago

Hi,

It seems that someone already proposed a solution for this:

https://github.com/bayasdev/envycontrol/pull/47

bayasdev commented 1 year ago

Hi,

It seems that someone already proposed a solution for this:

47

Sorry for the late response, just merged the PR ;)

ebiscaia commented 1 year ago

No problem.

Thanks