/bluetooth-to-steam-linux

A simple way to start Steam big picture when your wireless controller is turned on

GNU General Public License v3.0GPL-3.0

Bluetooth to Steam (linux)

A simple way to start Steam big picture when your wireless controller is turned on.

Pre-requisite

  1. Have steam installed
  2. Have your bluetooth controller pair with your PC and steam

Step-by-step

  1. Install bluez-tools
$ apt-get install bluez-tools
  1. Create a file to store the script somewhere in your home folder:
$ touch ~/bluetooth-to-steam-linux.sh
$ nano ~/bluetooth-to-steam-linux.sh
  1. Paste the following script into it (exit with Control + X)
#!/bin/sh

case $(bt-device -i "Wireless Controller" | grep "Connected" | grep -Eo '[0-1]+$') in 1)
	echo Controller detected
	if ps aux | grep "$whoami" | grep "/bin/sh" | grep "/usr/games/steam"; then
		echo Steam detected, doing nothing
	else
		echo Steam not detected
		DISPLAY=:0.0 /usr/games/steam -bigpicture
    fi
esac
  1. Make it runnable:
$ chmod +x ~/bluetooth-to-steam-linux
  1. Enter in your cronjob:
$ crontab -e
  1. Select nano in case is your first time running this command
  2. Append to the end of the file. Note, replace with your username.
* * * * * /bin/sh /home/<user>/bluetooth-to-steam-linux.sh >/dev/null 2>&1

Notes

I only tested this on my own computer running Linux Mint 19.