Skip to content

Instantly share code, notes, and snippets.

@pegasd
Last active November 25, 2023 09:32
Show Gist options
  • Save pegasd/048bd5d53558f066765253d55a456306 to your computer and use it in GitHub Desktop.
Save pegasd/048bd5d53558f066765253d55a456306 to your computer and use it in GitHub Desktop.
Auto-sync screenshots from Steam Deck to Google Drive

Auto-sync screenshots from Steam Deck to Google Drive

Enable SSH (optional)

Before you start, you can enable SSH server on your Steam Deck so it's a little easier to go through some of these steps:

$ passwd
$ sudo systemctl start sshd
$ sudo systemctl enable sshd

Afterwards, you can connect to your deck using ssh deck@steamdeck command on your desktop/laptop.

Configure Screenshot Directory

Let's configure where the screenshots are stored. Make a directory (I'm using ~/.steam_screenshots, you can pick whatever you want):

$ mkdir ~/.steam_screenshots

Then, in Desktop mode, go to Steam Settings, select In-Game tab on the left and change the directory to the one you made before using Screenshot Folder button. You can also select Save an uncompressed copy if you want to get better-quality screenshots (they will be stored in PNG format instead of JPG).

Note: the default screenshot location on Steam Deck is ~/.steam/steam/userdata/${your_steam_id}/760/remote/${steam_game_id}/screenshots/, we're reconfiguring Steam to use a single directory.

Download rclone

Go to https://rclone.org/downloads/ and download the Intel/AMD - 64 Bit / Linux version. Unzip it, upload just the rclone binary to your Deck, and put it in a easily accessible directory.

$ unzip rclone-v*-linux-amd64.zip
$ scp rclone-v*-linux-amd64/rclone deck@steamdeck:

And then on the Deck:

$ mkdir ~/bin
$ mv ~/rclone ~/bin

Authenticate rclone to Google Drive

$ ~/bin/rclone config

The process is a little tedious but is very well described at https://rclone.org/drive/.

Make note of the remote name you configure for your Google Drive (I'll be using google_drive).

Write a script to clone screenshots

Here's mine (I put it in ~/bin/sync_screenshots):

#!/usr/bin/env bash

RCLONE_BIN="${HOME}/bin/rclone"
REMOTE_NAME='google_drive'
REMOTE_DIR='steam_screenshots'
SOURCE_DIR="${HOME}/.steam_screenshots"

${RCLONE_BIN} sync "${SOURCE_DIR}" "${REMOTE_NAME}:${REMOTE_DIR}"

Write systemd service and path units

First, a service unit (put it in ~/.config/systemd/user/sync_steam_screenshots.service:

[Unit]
Description=Sync Steam Screenshots

[Service]
Type=oneshot
ExecStart=%h/bin/sync_screenshots

Then, a path unit that will trigger the service every time a directory is modified (put it in ~/.config/systemd/user/sync_steam_screenshots.path):

[Unit]
Description=Sync Steam Screenshots

[Path]
PathModified=%h/.steam_screenshots
Unit=sync_steam_screenshots.service

[Install]
WantedBy=default.target

Enable systemd path unit

$ sudo systemctl daemon-reload
$ systemctl --user enable sync_steam_screenshots.path
@foosel
Copy link

foosel commented Feb 11, 2023

Thank you for the write-up! I found that unless I tell Steam (in Desktop mode) to save the uncompressed screenshots, it would not use the custom folder. Apparently the custom folder really only applies to PNGs, not JPGs. See also this forum post.

@pegasd
Copy link
Author

pegasd commented Feb 11, 2023

@foosel Interesting! Thanks for your interest and response. I've only used PNGs for this set up, but I can do some testing and maybe update the gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment