While you're here, please consider supporting GamingOnLinux on:
Reward Tiers:
Patreon. Plain Donations:
PayPal.
This ensures all of our main content remains totally free for everyone with no article paywalls. We also don't have tons of adverts, there's also no tracking and we respect your privacy. Just good, fresh content. Without your continued support, we simply could not continue!
You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Reward Tiers:


This ensures all of our main content remains totally free for everyone with no article paywalls. We also don't have tons of adverts, there's also no tracking and we respect your privacy. Just good, fresh content. Without your continued support, we simply could not continue!
You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Login / Register
Popular this week
- Framework reveal new laptop with modular graphics, plus an AMD Ryzen model
- Fanatical have another fantastic game bundle for Steam Deck
- The Last of Us on Steam Deck is not great
- GE-Proton 7-53 is out now fixing up Star Citizen, Diablo IV and more
- AMD detail more on FSR 3 and their new open source FidelityFX SDK
Contact
Latest Comments
-
Story-driven emotional action-adventure RPG 'Dreamed Aw…
- zany130 -
Get some glorious Boomer Shooters in this new bundle
- undeadbydawn -
Canonical want help testing their Steam snap package fo…
- slaapliedje -
The Pale Beyond sold 10% of copies on Steam Deck
- Klaas -
The Pale Beyond sold 10% of copies on Steam Deck
- pb - See more comments
Latest Forum Posts
- Weekend Players' Club 3/24/23
- Arcadius-8606 - New Desktop Screenshot Thread
- Hamish - Welp, the time has come...
- redneckdrow - Fanatical's Play On The Go Bundle - Spring 2023 is now available…
- Pengling - Linux (with Steam) on GPDWin handheld
- Julius - See more posts
I just made a little handy script I'm using lately, it is named xfreeze.sh
His function is to pause and resume whatever program running in a X11 window.
Not all games support a pause function when unfocused, and this is not good for power consumption.
In other ones you may want to just stop them for whatever reason (take some time to translate a string -eg: in gta5 when there are subtitles in foreing language while you're driving, cheating... whatever).
I just paused Horizon Chase Turbo to write this post and let my cpu and gpu rest for a while :)
Usage:
xfreeze.sh Action Target
Action:
ask: Ask to pause or continue execution (uses kdialog to ask you what to do)
switch: Switch execution state paused <-> running
Target:
active: Use the active window (pause or resume the active window)
select: Ask user to click on a window (expects you to click on the window you want to pause)
_
Dependancies:
Currenty, i've bound "xfreeze.sh switch active" to a SHIFT+PAUSE hotkey (use whatever tool your de provides to assign custom commands to shortcuts), so that while i'm playing, i hit SHIFT+PAUSE and have my game paused or resumed.
Beware that for how Xorg works, when not using a compositor, when a window is "paused" it does not update his content, so if you minimize the window and restore it while paused, it will be totally black. Also if it is partially obscured by another one, the latter will leave traces on it (win95 effect); resuming the window will make them go away.
Oh, it doesn't work for all the programs, because sometimes their window doesn't implement _NET_WM_PID and I wasn't able to resolve a window id to a pid in those cases, not even xkill is able to work on them, but fortunately they are rare.
Here it is:
#!/usr/bin/env bash
# xfreeze.sh [ask|switch] [active|select]
# ask = ask to pause or continue execution
# switch = switch execution state
# active = use the active window
# select = ask user to click on a window
if [ $2 = "active" ] ; then
PROC=$(xprop -id $(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}') | awk '/_NET_WM_PID\(CARDINAL\)/{print $NF}')
else
PROC=$(xdotool selectwindow getwindowpid)
fi
if [ $1 = "ask" ] ; then
kdialog --yesno $(</proc/$PROC/comm) --yes-label RESUME --no-label PAUSE
else
grep State: /proc/$PROC/status|grep stopped
fi
condition_continue=$?
echo $condition_continue
if [ $condition_continue = 0 ] ; then
echo cont
kill -CONT $PROC
else
echo stop
kill -STOP $PROC
fi
#cat /proc/$PROC/status #debug
Hope someone will find it useful,
back to Horizon Chase Turbo, cheers!
Last edited by kokoko3k on 22 July 2021 at 4:21 pm UTC