├── LICENSE ├── README.md ├── conf ├── custom.conf ├── reboot-sudoers.conf ├── reboot-to-desktop-mode.sh ├── reboot-to-steamos-mode.sh ├── steam-session.conf └── steamos-fg.sh ├── image.png └── install.sh /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 William Edwards 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SteamOS Ubuntu 2 | 3 | ![SteamOS Ubuntu](image.png) 4 | 5 | SteamOS Ubuntu is a set of scripts to create an Ubuntu-based Steam machine. 6 | 7 | It will do the following: 8 | 9 | * Create the `steam` user account if it does not exist. 10 | * Install steam, if it is not installed. 11 | * Install the Steam Compositor, Steam Mode Switch, and boot splash themes. 12 | * Configure autologin for the `steam` user account. 13 | * Configure the default session to the Steam Compositor. 14 | * Create `reboot-to-[steamos,desktop]-mode` scripts to switch between sessions. 15 | * Create `steamos-fg` script for games that won't run in the foreground on the SteamOS Compositor. 16 | * Optionally install the latest graphics drivers for AMD, Nvidia, and Intel GPUs. 17 | * Optionally install proton fixes. 18 | 19 | For best results, this should be run on a fresh installation of 20 | Ubuntu 18.04 desktop. 21 | 22 | ## Requirements 23 | In order to install SteamOS Ubuntu, you should have a fresh installation of 24 | Ubuntu 18.04 Desktop installed. Other versions may work, but have not been 25 | tested. 26 | 27 | ## Installation 28 | Installation is very simple. Follow these steps to install SteamOS Ubuntu: 29 | 30 | 1. Install git: 31 | `sudo apt install git -y` 32 | 33 | 2. Clone or download this repository: 34 | `git clone https://github.com/ShadowApex/steamos-ubuntu.git` 35 | 36 | 3. Run the installation script: 37 | `cd steamos-ubuntu` 38 | `sudo ./install.sh` 39 | 40 | ## Advanced Options 41 | The installation script has several options that you can specify upon installation 42 | in the form of environment variables. You can specify these options by prefixing 43 | running the install script with the options you want. 44 | 45 | For example, if you want to disable installing OpenSSH and run the script non- 46 | interactively, you can run this command: 47 | 48 | `INCLUDE_OPENSSH=false NON_INTERACTIVE=true sudo ./install.sh` 49 | 50 | Here is the list of all the available installation options: 51 | 52 | | Option Name | Default | Description | 53 | | -------------------- | ------- | -------------------------------------------------------- | 54 | | `INCLUDE_OPENSSH` | true | Whether or not OpenSSH server should be installed | 55 | | `INCLUDE_SAKURA` | true | Whether or not to install a terminal emulator | 56 | | `INCLUDE_PROTONFIX` | true | Whether or not to install Protonfix | 57 | | `INCLUDE_GPU_DRIVERS`| true | Whether or not to install the latest GPU drivers | 58 | | `GPU_TYPE` | auto | GPU drivers to install. Can be: auto, nvidia, amd, intel | 59 | | `NON_INTERACTIVE` | false | Whether or not to prompt the user during install | 60 | | `STEAM_USER` | steam | The username of the account to autologin as | 61 | 62 | ## FAQ 63 | 64 | ### How can I switch between desktop mode and SteamOS mode? 65 | 66 | After installation, there will not be an easy way to switch between a regular 67 | Gnome desktop session and Steam. In order to make it easier to switch between 68 | the two, there are two commands that are installed that will let you switch 69 | between the two: 70 | 71 | * `reboot-to-desktop-mode` - sets gnome as the default session and reboots 72 | * `reboot-to-steamos-mode` - sets steam as the default session and reboots 73 | 74 | You can access the terminal from Steam by adding a local shortcut for `Sakura`. 75 | 76 | ### Some games aren't launching correctly in SteamOS mode 77 | When using the SteamOS compositor, some games start behind the big picture UI and 78 | no graphics are displayed. The `steamos-fg` script forces such games to be shown 79 | in the foreground. 80 | 81 | Affected games this script fixes include: 82 | 83 | Dead Cells 84 | Dirt Rally 85 | Civilization VI 86 | The Count Lucanor 87 | Mad Max 88 | 89 | To fix this, add `steamos-fg %command%` to the launch options for each game you 90 | wish to use this script with. 91 | 92 | ## Attributions 93 | * Alkazar for [steamos-fg](https://github.com/alkazar/steamos-fg) 94 | 95 | ## Legal 96 | The Steam logo and Ubuntu logo are registered trademarks of Valve Corporation 97 | and Canonical respectively. This project is in no way officially affiliated with 98 | Valve or Canonical. 99 | -------------------------------------------------------------------------------- /conf/custom.conf: -------------------------------------------------------------------------------- 1 | # GDM configuration storage 2 | # 3 | # See /usr/share/gdm/gdm.schemas for a list of available options. 4 | 5 | [daemon] 6 | AutomaticLoginEnable=true 7 | AutomaticLogin=$STEAM_USER 8 | 9 | # Uncoment the line below to force the login screen to use Xorg 10 | #WaylandEnable=false 11 | 12 | # Enabling automatic login 13 | 14 | # Enabling timed login 15 | # TimedLoginEnable = true 16 | # TimedLogin = user1 17 | # TimedLoginDelay = 10 18 | 19 | [security] 20 | 21 | [xdmcp] 22 | 23 | [chooser] 24 | 25 | [debug] 26 | # Uncomment the line below to turn on debugging 27 | # More verbose logs 28 | # Additionally lets the X server dump core if it crashes 29 | #Enable=true 30 | -------------------------------------------------------------------------------- /conf/reboot-sudoers.conf: -------------------------------------------------------------------------------- 1 | Cmnd_Alias DESKTOP = /usr/local/sbin/reboot-to-desktop-mode 2 | Cmnd_Alias STEAMOS = /usr/local/sbin/reboot-to-steamos-mode 3 | 4 | %sudo ALL = (root) NOPASSWD:DESKTOP,STEAMOS 5 | %admin ALL = (root) NOPASSWD:DESKTOP,STEAMOS 6 | -------------------------------------------------------------------------------- /conf/reboot-to-desktop-mode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set the X session to the steamos session and reboot 4 | /usr/bin/sudo /bin/sed -i 's/XSession.*/XSession=/g' /var/lib/AccountsService/users/$STEAM_USER 5 | /usr/bin/sudo /sbin/reboot 6 | -------------------------------------------------------------------------------- /conf/reboot-to-steamos-mode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set the X session to the steamos session and reboot 4 | /usr/bin/sudo /bin/sed -i 's/XSession.*/XSession=steamos/g' /var/lib/AccountsService/users/$STEAM_USER 5 | /usr/bin/sudo /sbin/reboot 6 | -------------------------------------------------------------------------------- /conf/steam-session.conf: -------------------------------------------------------------------------------- 1 | [InputSource0] 2 | xkb=us 3 | 4 | [User] 5 | XSession=steamos 6 | SystemAccount=false 7 | -------------------------------------------------------------------------------- /conf/steamos-fg.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | set -e 4 | 5 | exec "$@" & # start game 6 | sleep 5 # wait a bit for game window 7 | 8 | # find window with size greater than 99x99 that is not a steam window 9 | RESULT=$(xwininfo -display ":0" -root -tree | grep -E "[0-9]{3}x[0-9]{3}" | grep -v \"Steam\"\: | grep -v \"SteamOverlay\"\:) 10 | WIN_ID=$(echo "$RESULT" | cut -d' ' -f 1) 11 | 12 | # apply STEAM_GAME property to game window so steamos compositor shows game in foreground 13 | xprop -display ":0" -id "$WIN_ID" -f STEAM_GAME 32c -set STEAM_GAME 470470 14 | 15 | wait # wait for game exit 16 | 17 | -------------------------------------------------------------------------------- /image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShadowApex/steamos-ubuntu/892212d8a37d2b35689798d9bbf8035028684b93/image.png -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set the defaults. These can be overridden by specifying the value as an 4 | # environment variable when running this script. 5 | INCLUDE_OPENSSH="${INCLUDE_OPENSSH:-true}" 6 | INCLUDE_SAKURA="${INCLUDE_SAKURA:-true}" 7 | INCLUDE_PROTONFIX="${INCLUDE_PROTONFIX:-false}" 8 | INCLUDE_GPU_DRIVERS="${INCLUDE_GPU_DRIVERS:-true}" 9 | GPU_TYPE="${GPU_TYPE:-auto}" 10 | NON_INTERACTIVE="${NON_INTERACTIVE:-false}" 11 | STEAM_USER="${STEAM_USER:-steam}" 12 | export STEAM_USER 13 | 14 | # Configure the default versions of the SteamOS packages to use. These generally 15 | # don't ever need to be overridden. 16 | STEAMOS_COMPOSITOR_VER="${STEAMOS_COMPOSITOR_VER:-1.35+bsos1_amd64}" 17 | STEAMOS_MODESWITCH_VER="${STEAMOS_MODESWITCH_VER:-1.10+bsos1_amd64}" 18 | STEAMOS_PLYMOUTH_VER="${STEAMOS_PLYMOUTH_VER:-0.17+bsos2_all}" 19 | 20 | # Ensure the script is being run as root 21 | if [ "$EUID" -ne 0 ]; then 22 | echo "This script must be run with sudo." 23 | exit 24 | fi 25 | 26 | # Confirm from the user that it's OK to continue 27 | if [[ "${NON_INTERACTIVE}" != "true" ]]; then 28 | echo "Options:" 29 | echo " OpenSSH: ${INCLUDE_OPENSSH}" 30 | echo " Terminal: ${INCLUDE_SAKURA}" 31 | echo " Proton Fixes: ${INCLUDE_PROTONFIX}" 32 | echo " GPU Drivers: ${INCLUDE_GPU_DRIVERS}" 33 | echo " GPU Type: ${GPU_TYPE}" 34 | echo " Steam User: ${STEAM_USER}" 35 | echo "" 36 | echo "This script will configure a SteamOS-like experience on Ubuntu." 37 | read -p "Do you want to continue? [Yy] " -n 1 -r 38 | echo 39 | if [[ $REPLY =~ ^[Yy]$ ]]; then 40 | echo "Starting installation..." 41 | else 42 | echo "Aborting installation." 43 | exit 44 | fi 45 | fi 46 | 47 | # Download the packages we need. If we fail at downloading, stop the script. 48 | set -e 49 | echo "Downloading SteamOS packages..." 50 | wget "http://repo.steamstatic.com/steamos/pool/main/s/steamos-compositor/steamos-compositor_${STEAMOS_COMPOSITOR_VER}.deb" 51 | wget "http://repo.steamstatic.com/steamos/pool/main/s/steamos-modeswitch-inhibitor/steamos-modeswitch-inhibitor_${STEAMOS_MODESWITCH_VER}.deb" 52 | wget "http://repo.steamstatic.com/steamos/pool/main/p/plymouth-themes-steamos/plymouth-themes-steamos_${STEAMOS_PLYMOUTH_VER}.deb" 53 | set +e 54 | 55 | # See if there is a 'steam' user account. If not, create it. 56 | if ! grep "^${STEAM_USER}" /etc/passwd > /dev/null; then 57 | echo "Steam user '${STEAM_USER}' not found. Creating it..." 58 | adduser --disabled-password --gecos "" "${STEAM_USER}" 59 | fi 60 | STEAM_UID=$(grep "^${STEAM_USER}" /etc/passwd | cut -d':' -f3) 61 | STEAM_GID=$(grep "^${STEAM_USER}" /etc/passwd | cut -d':' -f4) 62 | echo "Steam user '${STEAM_USER}' found with UID ${STEAM_UID} and GID ${STEAM_GID}" 63 | 64 | # Choosing from the guide in Proton (SteamPlay) Wiki https://github.com/ValveSoftware/Proton/wiki/Requirements 65 | # Install the GPU drivers if it was specified by the user. 66 | if [[ "${INCLUDE_GPU_DRIVERS}" == "true" ]]; then 67 | 68 | # Autodetect the GPU so we can install the appropriate drivers. 69 | if [[ "${GPU_TYPE}" == "auto" ]]; then 70 | echo "Auto-detecting GPU..." 71 | if lspci | grep -i vga | grep -iq nvidia; then 72 | echo " Detected Nvidia GPU" 73 | GPU_TYPE="nvidia" 74 | elif lspci | grep -i vga | grep -iq amd; then 75 | echo " Detected AMD GPU" 76 | GPU_TYPE="amd" 77 | elif lspci | grep -i vga | grep -iq intel; then 78 | GPU_TYPE="intel" 79 | echo " Detected Intel GPU" 80 | else 81 | GPU_TYPE="none" 82 | echo " Unable to determine GPU. Skipping driver install." 83 | fi 84 | fi 85 | 86 | # Install the GPU drivers. 87 | case "${GPU_TYPE}" in 88 | nvidia) 89 | echo "Installing the latest Nvidia drivers..." 90 | add-apt-repository ppa:graphics-drivers/ppa -y 91 | apt update 92 | apt install nvidia-driver-415 -y 93 | ;; 94 | amd) 95 | echo "Installing the latest AMD drivers..." 96 | add-apt-repository ppa:oibaf/graphics-drivers -y 97 | apt update 98 | apt dist-upgrade -y 99 | 100 | dpkg --add-architecture i386 101 | apt update 102 | apt install mesa-vulkan-drivers mesa-vulkan-drivers:i386 -y 103 | ;; 104 | intel) 105 | echo "Installing the latest mesa drivers..." 106 | add-apt-repository ppa:paulo-miguel-dias/pkppa -y 107 | apt update 108 | apt dist-upgrade -y 109 | 110 | dpkg --add-architecture i386 111 | apt update 112 | apt install mesa-vulkan-drivers mesa-vulkan-drivers:i386 -y 113 | ;; 114 | none) 115 | echo "GPU not detected." 116 | ;; 117 | *) 118 | echo "Skipping GPU driver installation." 119 | ;; 120 | esac 121 | fi 122 | 123 | # Install steam and steam device support. 124 | echo "Installing steam..." 125 | apt update 126 | apt install steam steam-devices x11-utils -y 127 | 128 | # WIP - find a way to enable Steamplay without using Desktop Steam Client. Also maybe find a way to enable Steam Beta with latest Steamplay 129 | # Enable SteamPlay 130 | #echo "Enable Steamplay..." 131 | 132 | # Enable Protonfix for ease of use with certain games that needs tweaking. 133 | # https://github.com/simons-public/protonfixes 134 | # Installing Protonfix for ease of use 135 | if [[ "${INCLUDE_PROTONFIX}" == "true" ]]; then 136 | apt install python-pip python3-pip -y 137 | echo "Installing protonfix..." 138 | pip3 install protonfixes --upgrade 139 | # Installing cefpython3 for visual progress bar 140 | pip install cefpython3 141 | # Edit Proton * user_settings.py 142 | fi 143 | 144 | # Install a terminal emulator that can be added from Big Picture Mode. 145 | if [[ "${INCLUDE_SAKURA}" == "true" ]]; then 146 | echo "Installing the sakura terminal emulator..." 147 | apt install sakura -y 148 | fi 149 | 150 | # Install openssh-server for remote administration 151 | if [[ "${INCLUDE_OPENSSH}" == "true" ]]; then 152 | echo "Installing OpenSSH Server..." 153 | apt install openssh-server -y 154 | fi 155 | 156 | # Enable automatic login. We use 'envsubst' to replace the user with ${STEAM_USER}. 157 | echo "Enabling automatic login..." 158 | envsubst < ./conf/custom.conf > /etc/gdm3/custom.conf 159 | 160 | # Create our session switching scripts to allow rebooting to the desktop 161 | echo "Creating reboot to session scripts..." 162 | envsubst < ./conf/reboot-to-desktop-mode.sh > /usr/local/sbin/reboot-to-desktop-mode 163 | envsubst < ./conf/reboot-to-steamos-mode.sh > /usr/local/sbin/reboot-to-steamos-mode 164 | chmod +x /usr/local/sbin/reboot-to-desktop-mode 165 | chmod +x /usr/local/sbin/reboot-to-steamos-mode 166 | 167 | # Create the "steamos-fg" script as a workaround for games like Deadcells with the Steam compositor. 168 | cp ./conf/steamos-fg.sh /usr/local/sbin/steamos-fg 169 | chmod +x /usr/local/sbin/steamos-fg 170 | 171 | # Create a sudoers rule to allow passwordless reboots between sessions. 172 | echo "Creating sudoers rules to allow rebooting between sessions..." 173 | cp ./conf/reboot-sudoers.conf /etc/sudoers.d/steamos-reboot 174 | chmod 440 /etc/sudoers.d/steamos-reboot 175 | 176 | # Install the steamos compositor, modeswitch, and themes 177 | echo "Configuring the SteamOS boot themes..." 178 | dpkg -i ./*.deb &>/dev/null 179 | apt install -f -y 180 | update-alternatives --install /usr/share/plymouth/themes/default.plymouth default.plymouth /usr/share/plymouth/themes/steamos/steamos.plymouth 100 181 | update-alternatives --set default.plymouth /usr/share/plymouth/themes/steamos/steamos.plymouth 182 | 183 | # Update the grub theme. 184 | echo 'GRUB_BACKGROUND=/usr/share/plymouth/themes/steamos/steamos_branded.png' | tee -a /etc/default/grub 185 | update-grub 186 | 187 | # Set the X session to use the installed steamos session 188 | echo "Configuring the default session..." 189 | cp ./conf/steam-session.conf "/var/lib/AccountsService/users/${STEAM_USER}" 190 | 191 | echo "" 192 | echo "Installation complete! Press ENTER to reboot or CTRL+C to exit" 193 | read -r 194 | reboot 195 | --------------------------------------------------------------------------------