-
Notifications
You must be signed in to change notification settings - Fork 0
/
steam
executable file
·29 lines (21 loc) · 927 Bytes
/
steam
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
# this wrapper stops steam from polluting $HOME
# https://github.com/ValveSoftware/steam-for-linux/issues/1890#issuecomment-1693548157
FAKEHOME="$XDG_DATA_HOME"/Steam/garbage
# Symlink a file to the fake home
link_dir() {
# Replace HOME with FAKEHOME in the link name
link_name=$(echo "$1" | sed "s|^$HOME|$FAKEHOME|")
link_dir=$(dirname "$link_name")
# Creates the link's parent directory and symlinks it
mkdir -p "$link_dir"
[ ! -d "$link_name" ] && ln -s "$1" "$link_name"
}
mkdir -p "$FAKEHOME"
link_dir "$XDG_DATA_HOME" # ~/.local/share
link_dir "$XDG_CACHE_HOME" # ~/.cache
link_dir "$XDG_CONFIG_HOME" # ~/.config
link_dir "$HOME"/.icons # ~/.icons (lxappearance's mouse cursor theme)
# If .steam exists in ~/ and not in the fake home, move it to the fake home
[ -d "$HOME"/.steam ] && [ ! -d "$FAKEHOME"/.steam ] && mv "$HOME"/.steam "$FAKEHOME"/
HOME="$FAKEHOME" exec /usr/bin/steam "$@"