1
0
Fork 0

make gamemode stop services

This commit is contained in:
Massaki Archambault 2018-10-31 15:04:08 -04:00
parent bdfa31f9d5
commit 290aa6a9df
3 changed files with 25 additions and 7 deletions

View File

@ -0,0 +1,3 @@
[custom]
start=__on-gamemode start
end=__on-gamemode end

View File

@ -48,10 +48,6 @@ play-vm() {
if ! [ -S /tmp/win10.sock ]; then if ! [ -S /tmp/win10.sock ]; then
echo "Cannot find spice socket! Is the vm started?" echo "Cannot find spice socket! Is the vm started?"
else else
echo "Stopping services"
sudo systemctl stop cronie
systemctl --user stop redshift compton wallpaper
echo "Setup cpuset cgroup for host" echo "Setup cpuset cgroup for host"
sudo cset set -c 0,4 -s system sudo cset set -c 0,4 -s system
sudo cset proc -m -f root -t system sudo cset proc -m -f root -t system
@ -68,8 +64,5 @@ play-vm() {
sudo bash -c "echo f > /sys/devices/virtual/workqueue/cpumask" sudo bash -c "echo f > /sys/devices/virtual/workqueue/cpumask"
# cpuset # cpuset
sudo cset set -d system &>/dev/null sudo cset set -d system &>/dev/null
# services
systemctl --user start redshift compton wallpaper
sudo systemctl start cronie
fi fi
} }

22
files/.local/bin/__on-gamemode Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
exec 1<&-
system_services="cronie"
user_services="compton redshift"
if [[ "$1" == "start" ]]; then
for service in $system_services; do
sudo systemctl stop "$service"
done
for service in $user_services; do
systemctl --user stop "$service"
done
elif [[ "$1" == "end" ]]; then
for service in $system_services; do
systemctl is-enabled "$service" && sudo systemctl start "$service"
done
for service in $user_services; do
systemctl --user is-enabled "$service" && systemctl --user start "$service"
done
fi