Upload Screenshots via a keybind on Linux

The game is currently (as of July 2023) running on Linux (tested on Debian 12, KDE 5.27.5 using Wayland) using Nvidia Proprietary Drivers.

To run the game, you just have to enable Steam Play for all titles, and select Proton 8.0 after installing Dead by Daylight by going to Steam → Select Game → Properties → Compatibility.

To make the task of taking a screenshot and uploading it to NightLight easier on Linux, I have created a short script.

Remove quotes from all commands and file locations (the ones listed in instructions below, not the script) before using. The scripts folder listed in #2 and the Screenshots folder listed in the script must be created first before you can use them.

Note: Get your API KEY from https://nightlight.gg/account/api and save it in a text file. Make sure the API KEY permission is limited to upload.

  1. Copy and save the script below in a file as screenshot.sh.

  2. Copy paste this script into “/home/<your username>/scripts/” and make it executable by using “chmod +x screenshot.sh” in a terminal.

  3. Download short mp3 clips(1-2 seconds) from the internet for success and error sounds and rename them success.mp3 and error.mp3. Also install mpg123 on your system by using the appropriate install command to play the mp3 files. Move them to the folder “/home/<your username>/scripts/” .

  4. Open KDE menu - search for shortcuts - open the shortcuts settings. Click on Add command and enter the following “bash -c /home/<your username>/scripts/screenshot.sh” .

  5. Once you enter the command, you can add a custom global shortcut to run it. Add the shortcut combination you want. Ensure it doesn’t match any of the other shortcuts currently in use by KDE (KDE will warn you if it does).

  6. Use the shortcut in the end-game screen to upload the screenshot.

# Script begins here
# Replace <YOUR USERNAME> with the username you use to log in
# Take a Screenshot and upload to NightLight

#!/bin/bash

# Set your API endpoint URL
API_URL="https://api.nightlight.gg/v1/upload"

# Set your API key
API_KEY="YOUR API KEY HERE(Do not Remove Quotes)"

DATE_NOW=$(date "+%Y%m%d_%H%M%s")

# Path to image file
IMAGE_FILE="/home/<YOUR USERNAME>/Pictures/Screenshots/image_$DATE_NOW.jpg"

#Take a screenshot
spectacle -f -b -n -o $IMAGE_FILE
sleep 1s


# Send the POST request
response_code=""
response_code=$(curl -k -s -o /dev/null -4 -w "%{http_code}" -H "Authorization: Bearer $API_KEY" -F "file=@\"${IMAGE_FILE}\"" $API_URL)

if [ $response_code -eq 200 ] 
then
	mpg123 -q /home/<YOUR USERNAME>/scripts/success.mp3
else
	mpg123 -q /home/<YOUR USERNAME>/scripts/error.mp3
fi
1 Like