37 lines
918 B
Bash
Executable File
37 lines
918 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Function to revert settings
|
|
cleanup() {
|
|
# Revert CPU governor to default
|
|
sudo cpupower frequency-set -g schedutil >/dev/null 2>&1
|
|
# Reset Firefox priorities
|
|
for pid in $(pgrep -f "firefox.*lichess-perf"); do
|
|
renice -n 0 -p $pid >/dev/null 2>&1
|
|
ionice -c 2 -n 7 -p $pid >/dev/null 2>&1
|
|
done
|
|
exit 0
|
|
}
|
|
|
|
# Trap signals to ensure cleanup
|
|
trap cleanup SIGINT SIGTERM EXIT
|
|
|
|
# Activate performance mode for CPU
|
|
sudo cpupower frequency-set -g performance >/dev/null 2>&1
|
|
|
|
# Launch Firefox with dedicated profile
|
|
firefox -P lichess-perf &
|
|
|
|
# Wait for Firefox to start
|
|
sleep 5
|
|
|
|
# Apply maximum priority to Firefox processes
|
|
for pid in $(pgrep -f "firefox.*lichess-perf"); do
|
|
renice -n -20 -p $pid >/dev/null 2>&1
|
|
ionice -c 1 -n 0 -p $pid >/dev/null 2>&1
|
|
done
|
|
|
|
# Wait until Firefox window closes
|
|
while pgrep -f "firefox.*lichess-perf" >/dev/null; do
|
|
sleep 5
|
|
done
|