pop-os / default-settings

Distribution Default Settings
Other
44 stars 16 forks source link

fix: bluetooth save state #146

Closed linuxgnuru closed 2 years ago

linuxgnuru commented 2 years ago

This is a follow up to #144 that handles the situation where there are multiple bluetooth entries in /var/lib/systemd/rfkill. The current version would lead to a shell error and would not save the state properly.

This new version checks if any of the bluetooth devices are in the blocked state by parsing the output of the rfkill command and performs the appropriate action. If any bluetooth device is unblocked, then all bluetooth devices will be blocked before suspending.

Moreover, storing a system-level runtime file in /home/$USER seems inappropriate. This new version stores the bluetooth state file in /run, which is where such things normally are stored.

I've also introduced a few variables to make the code a bit cleaner.

leviport commented 2 years ago

already open: https://github.com/pop-os/default-settings/pull/145