After some search, the only reliable way I found to control the fan in my ASUS laptop was to issue this commands (as root):
turn on fans:
echo 0 > /sys/devices/platform/asus-nb-wmi/hwmon/hwmon7/pwm1_enable
turn off (automatic?) fans:
echo 2 > /sys/devices/platform/asus-nb-wmi/hwmon/hwmon7/pwm1_enable
How can I control these from a Gnome shortcut of another fast method? I tried making these path read-write from the user (although the privileges are reset on reboot) but then when I put this commands as commands for Gnome keyboard shortcuts they don't execute at all.
How can I make this run from a shortcut? and additionally (bonus), how can I make it run as root?
Here is how to get the shortcut to work. We will go along with your original plan and not need root:
Paste the following in
/etc/tmpfiles.d/fans-askubuntu-1506330-1004020.conf
. This will change the permissions at every boot to be writable.Wrap your GNOME custom shortcuts in
bash -c
. The default way to launch commands does not support shell-specific syntax, just like how#!
doesn't support it.