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
- SteamOS 3.5.18 Preview released for Steam Deck
- Team Fortress 2 64bit support released, plus Vulkan for Linux via DXVK
- Stardew Valley 1.6.4 brings even more new free content
- Phantom Fury gets Steam Deck Verified ahead of release
- Check out this casual fab farming game bundle, plus a whole bunch of Godot Engine courses
- > See more over 30 days here
-
Dr. Robotnik's Ring Racers released after 5 years of de…
- Linux_Rocks -
Ubuntu 24.04 LTS (Noble Numbat) is now available
- kneekoo -
SteamOS 3.5.19 for Steam Deck out now for everyone
- PoorPocketsMcNewHold -
Garry's Mod forced to remove Nintendo content after tak…
- Eike -
Garry's Mod forced to remove Nintendo content after tak…
- mindedie - > See more comments
Latest Forum Posts
- Divinity Original Sin II - Definitive Edition - stopped starting …
- whizse - Hello to all
- Hamish - Weekend Players' Club 4/19/2024
- StoneColdSpider - What sorta display and audio setup do you folks got?
- Arehandoro - Logitech G29 steering wheel - Snowrunner support
- silmeth - 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