How to Run a Script When I Open My Laptop Screen?

0
3
Asked By CuriousCoder92 On

I've been dealing with a frustrating issue on my laptop where my internet connections drop whenever I close the screen. I mainly use sshfs to access my home server as a file server, and it's a real hassle when those connections cut off. Is there a way to prevent this from happening? If not, can I set up a script that runs when I open my screen to automatically reconnect my sshfs sessions? I'm using Arch Linux with Hyprland on an older HP Omen laptop.

3 Answers

Answered By SustainableUser_76 On

If you're using your laptop while it's closed, that could lead to overheating since laptops need airflow through the keyboard. It's worth checking the temperatures. But if you want to keep working and just want to resume when you open the lid, make sure you've set your laptop to suspend in the settings so it helps manage that heat.

Answered By LaptopGuru34 On

It sounds like your laptop could be going into sleep mode when you close the lid, which would cut off your sshfs connection. You can check the configuration by looking at `/etc/systemd/logind.conf`. Make sure you set `HandleLidSwitch=ignore` and that the line isn't commented out. This way, your laptop won't suspend and your connections should stay active.

Answered By TechWhiz47 On

You might want to check if disabling WiFi power saving helps! You can create a file at `/etc/NetworkManager/conf.d/powersave.conf` and add this:

```
[connection]
wifi.powersave=2
```

After that, just reboot your laptop and see if the issue persists.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.