Skip to content

Instantly share code, notes, and snippets.

@TeknoHamster
Forked from Kjir/AoE2UrlHelper.desktop
Last active August 1, 2026 05:11
Show Gist options
  • Select an option

  • Save TeknoHamster/d8b2f90a1cd618074aa1e35c81e7bc4b to your computer and use it in GitHub Desktop.

Select an option

Save TeknoHamster/d8b2f90a1cd618074aa1e35c81e7bc4b to your computer and use it in GitHub Desktop.
Running CaptureAge in Linux

Running CaptureAge in Linux

The latest version of CaptureAge (1.16.0) will now work with Linux. To get it working, here are some steps:

  1. Download the installer from the CaptureAge website
  2. Save the captureage script and place it in a location of your choice (e.g. ~/.local/bin/). Ensure it's executable
  3. Find out the path to the proton executable used by Steam for Age of Empires II and adjust PROTON_EXEC accordingly
  4. Uncomment the line to run the installer and adjust the path if needed. Comment the last line.
  5. Check that the windows version is set to at least windows 10 with protontricks 813780 winecfg
  6. Run protontricks 813780 d3dcompiler_47
  7. Now run the captureage script. Install captureage. It should run!
  8. Check if your CaptureAge is installed in AppData/Local/Programs/CaptureAge or AppData/Local/Programs/CADE and adjust accordingly.
  9. Change the captureage script to not run the installation exe anymore, but directly CaptureAge
  10. Profit

Figuring out the path to proton

To figure out the path to the proton executable used by Age of Empires II, set the Launch Options to echo %command% > ~/steam_cmd.txt. Start the game (it will not run, but exit immediately). Set back the Launch options to what they were. You now have a file in your home directory that includes the full path to the proton executable.

Getting the aoe2de:// URLs to work with AoE2

To register the aoe2de:// URL handler, you need a desktop file and a script. Here is how to set it up:

  1. Copy the aoe2url file in a location of your choice, preferably ~/.local/bin. Ensure it's executable.
  2. Adjust the path to proton in the script. Same as above.
  3. Save the AoE2UrlHelper.desktop file in ~/.local/share/applications/
  4. Adjust the path the aoe2url script on line 4
  5. Run sudo update-desktop-database to add the application to the database
  6. Run xdg-mime default AoE2UrlHelper.desktop x-scheme-handler/aoe2de to associate the URL Helper with the aoe2de:// scheme.

Now you can open games by typing the game url (e.g.: aoe2de://123456789) in the browser. You can also open games directly from the Spectator Dashboard

#!/usr/bin/bash
export PROTON_LOG=1
export STEAMAPPS="$HOME/.local/share/Steam/steamapps"
export STEAM_COMPAT_DATA_PATH="$STEAMAPPS/compatdata/813780"
export STEAM_COMPAT_CLIENT_INSTALL_PATH="$HOME/.steam"
# Adjust this to the proton executable used by AoE2 in Steam
export PROTON_EXEC="/usr/share/steam/compatibilitytools.d/proton-ge-custom/proton"
export WINEPREFIX="$STEAMAPPS/compatdata/813780/pfx"
"$PROTON_EXEC" run "$STEAMAPPS/common/AoE2DE/Tools_Builds/AOEURLHelper.exe" "$@"
[Desktop Entry]
Name=AoE2 URL Opener
Comment=Play this game on Steam (Open URL)
Exec=/home/<youruser>/.local/bin/aoe2url %u
Icon=steam_icon_813780
Terminal=false
Type=Application
MimeType=x-scheme-handler/aoe2de;
Categories=Game;
#!/usr/bin/env bash
APPID=813780
STEAM_PATH="${STEAM_PATH:-$HOME/.local/share/Steam}"
PROTON_NAME="${PROTON_NAME:-Proton - Experimental}"
export PROTON_LOG=1
export STEAMAPPS="$STEAM_PATH/steamapps"
export STEAM_COMPAT_DATA_PATH="$STEAMAPPS/compatdata/$APPID"
export STEAM_COMPAT_CLIENT_INSTALL_PATH="$STEAM_PATH"
export WINEPREFIX="$STEAM_COMPAT_DATA_PATH/pfx"
export GAME_DIR="$STEAMAPPS/common/AoE2DE"
export GAME_DIR_WIN='S:\common\AoE2DE'
export CAPTUREAGE_STATE="$WINEPREFIX/drive_c/users/steamuser/AppData/Roaming/CaptureAge/persistedState_prod.json"
export CAPTUREAGE_EXE_WIN='C:\users\steamuser\AppData\Local\Programs\CaptureAge\CaptureAge.exe'
export CAPTUREAGE_DIR_WIN='C:\users\steamuser\AppData\Local\Programs\CaptureAge'
export STEAM_COMPAT_INSTALL_PATH="$GAME_DIR"
export STEAM_COMPAT_LIBRARY_PATHS="$STEAMAPPS"
export PROTON_SET_GAME_DRIVE=1
# Adjust the path to the proton executable used by Age of Empires II
export PROTON_EXEC="${PROTON_EXEC:-$STEAMAPPS/common/$PROTON_NAME/proton}"
# export WINEDEBUG=warn+all # This is for debug logs
# export OBS_VKCAPTURE=1 # Enable this for OBS Videogame capture
prepare_prefix() {
local game_dir_win
local game_dir_escaped
game_dir_win="$GAME_DIR_WIN"
game_dir_escaped="${game_dir_win//\\/\\\\}"
mkdir -p "$WINEPREFIX/dosdevices"
ln -sfn "$STEAMAPPS" "$WINEPREFIX/dosdevices/s:"
if [ -f "$WINEPREFIX/user.reg" ]; then
GAME_DIR_ESCAPED="$game_dir_escaped" perl -0pi -e 'BEGIN{$r=$ENV{GAME_DIR_ESCAPED}} s#"Install Location"="[^"]*"#"Install Location"="$r"#g' "$WINEPREFIX/user.reg"
fi
if [ -f "$CAPTUREAGE_STATE" ]; then
tmp_state="$(mktemp)"
jq --arg dir "$game_dir_win" '.lastUsedGameDirectory = $dir' "$CAPTUREAGE_STATE" > "$tmp_state" && mv "$tmp_state" "$CAPTUREAGE_STATE"
fi
}
reg_add() {
"$PROTON_EXEC" run reg add "$@"
}
#This creates Windows registries to make the Spectate with CA button work
register_captureage() {
local protocol_command
protocol_command="\"$CAPTUREAGE_EXE_WIN\" \"%1\""
for root in HKCU\\Software\\Classes HKLM\\Software\\Classes; do
reg_add "$root\\captureage" /ve /d "URL:captureage" /f
reg_add "$root\\captureage" /v "URL Protocol" /d "" /f
reg_add "$root\\captureage\\shell\\open\\command" /ve /d "$protocol_command" /f
done
for root in HKCU HKLM; do
reg_add "$root\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\CaptureAge.exe" /ve /d "$CAPTUREAGE_EXE_WIN" /f
reg_add "$root\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\CaptureAge.exe" /v "Path" /d "$CAPTUREAGE_DIR_WIN" /f
done
}
#install capture age (only needed once). Adjust the location to point to the installer you downloaded.
#"$PROTON_EXEC" run "$PWD/CaptureAgeSetup.exe"
# run capture age
# Older version of CA:DE were installed in AppData/Local/Programs/CaptureAge . If it doesn't launch for you, check this path
prepare_prefix
register_captureage
"$PROTON_EXEC" run "C:/users/steamuser/AppData/Local/Programs/CaptureAge/CaptureAge.exe"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment