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! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring 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: Patreon. Plain Donations: PayPal.
This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring 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
- GOG launch their Preservation Program to make games live forever with a hundred classics being 're-released'
- Valve dev details more on the work behind making Steam for Linux more stable
- NVIDIA detail upcoming Linux driver features for Wayland and explain current support
- Half-Life 2 free to keep until November 18th, Episodes One & Two now included with a huge update
- Direct3D to Vulkan translation layer DXVK v2.5 released with rewritten memory management
- > See more over 30 days here
-
Half-Life 2 free to keep until November 18th, Episodes …
- Tuxee -
Inspired by SSX, arcade snowboarding game Tricky Madnes…
- based -
Half-Life 2 free to keep until November 18th, Episodes …
- Xpander -
Valve dev details more on the work behind making Steam …
- dvd -
Proton Experimental adds DLSS 3 Frame Generation suppor…
- 14 - > See more comments
- Types of programs that are irritating
- dvd - New Desktop Screenshot Thread
- pilk - What do you want to see on GamingOnLinux?
- Linas - Weekend Players' Club 11/15/2024
- StoneColdSpider - Our own anti-cheat list
- Xpander - 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