Skip to content

Instantly share code, notes, and snippets.

@urholaukkarinen
Last active November 2, 2025 12:13
Show Gist options
  • Select an option

  • Save urholaukkarinen/b94a5bcded1ad87392120ffbbc69b19b to your computer and use it in GitHub Desktop.

Select an option

Save urholaukkarinen/b94a5bcded1ad87392120ffbbc69b19b to your computer and use it in GitHub Desktop.
Steam chat fix for Linux

Related to: ValveSoftware/steam-for-linux#10722

On Linux (X11), when you receive a Steam chat message, the chat window does not open. The window is actually created behind the scenes, but it is never shown.

  • fixsteamchat.sh script listens to Steam logs, detects when a chat window is created, and forces it to show.
  • fixsteamchat.service can be used to turn the script into a systemd service that runs in the background.

The script requires xdotool: sudo apt install xdotool

Steps to enable the service:

  1. Make sure the script is executable: chmod +x fixsteamchat.sh
  2. Copy the fixsteamchat.service file to $HOME/.config/systemd/user/
    • Create the directory if it does not exist: mkdir -p $HOME/.config/systemd/user/
  3. In the service file, set correct path to the script
  4. Enable and start the service
    systemctl --user daemon-reload
    systemctl --user enable fixsteamchat
    systemctl --user start fixsteamchat

Tested on Ubuntu 24.04.

[Unit]
Description=Steam Chat Window Fixer
After=graphical-session.target
PartOf=graphical-session.target
[Service]
Type=simple
ExecStart=/home/user/fixsteamchat.sh
Restart=on-failure
RestartSec=5
[Install]
WantedBy=graphical-session.target
#!/bin/bash
# 1 = Bring new chat window front even if some window is full-screen
BRING_TO_FRONT_WHEN_FULLSCREEN=0
# Don't bring the chat window front if one of these programs is running
PROGRAM_BLOCKLIST=("first-program" "another-program")
is_any_window_fullscreen() {
local window_ids
window_ids=$(xprop -root _NET_CLIENT_LIST | grep -o '0x[0-9a-fA-F]\+')
for win_id in $window_ids; do
local state
state=$(xprop -id "$win_id" _NET_WM_STATE 2>/dev/null)
if [[ $state == *"_NET_WM_STATE_FULLSCREEN"* ]]; then
return 0
fi
done
return 1
}
is_program_running() {
local program="$1"
if pgrep -x "$program" >/dev/null 2>&1; then
return 0
else
return 1
fi
}
is_any_program_running() {
local programs=("$@")
for program in "${programs[@]}"; do
if is_program_running "$program"; then
return 0
fi
done
return 1
}
map_window() {
local window_id="$1"
xdotool windowmap --sync "$window_id" >/dev/null 2>&1
}
bring_to_front() {
local window_id="$1"
if is_any_program_running "${PROGRAM_BLOCKLIST[@]}"; then
echo "A blocklisted program is running. Keeping chat window minimized"
return 1
fi
if [[ "$BRING_TO_FRONT_WHEN_FULLSCREEN" == "0" ]]; then
if is_any_window_fullscreen; then
echo "Another program is full-screen. Keeping chat window minimized"
return 1
fi
fi
xdotool windowactivate "$window_id" >/dev/null 2>&1
}
if ! command -v xdotool &>/dev/null; then
echo "Error: xdotool is not installed. Please install it first: sudo apt install xdotool"
exit 1
fi
if ! command -v xprop &>/dev/null; then
echo "Error: xprop is not installed. Please install it first: sudo apt install xprop"
exit 1
fi
LOG_FILE="$HOME/.steam/steam/logs/webhelper.txt"
touch "$LOG_FILE"
echo "Listening to $LOG_FILE"
tail -f "$LOG_FILE" | while read -r line; do
if [[ $line =~ ChatWindow_ && $line =~ System\ window:\ (0x[0-9a-fA-F]+) ]]; then
window_id="${BASH_REMATCH[1]}"
echo "New chat window: $window_id"
map_window "$window_id"
bring_to_front "$window_id"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment