-
-
Save Fire-Dragon-DoL/e0adaeba76e872ad70e50c9469900f1d to your computer and use it in GitHub Desktop.
FEDORA version - Zoom in Systemd Cgroups on Linux. Change the max allocations to fit your workstation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# throttle-zoom '0-1' '6G' | |
set -xe | |
main() ( | |
allowedCpus="${1?Missing allowed CPUs, ex: 0-4}" | |
maxMemory="${2?Missing max memory, ex: 6G}" | |
# Add parameter checks to avoid invalid values here | |
mkdir -p "${XDG_CONFIG_HOME}/systemd/user" | |
{ | |
printf '[Slice]\n' | |
printf 'AllowedCPUs=%s\n' "${allowedCpus}" | |
printf 'MemoryHigh=%s\n' "${maxMemory}" | |
} > "${XDG_CONFIG_HOME}/systemd/user/zoom.slice" | |
awk '{ | |
if ($0 ~ /^Exec=/) | |
print "Exec=/usr/bin/systemd-run --user --slice=zoom.slice /usr/bin/zoom %U"; | |
else | |
print; | |
}' < /usr/share/applications/Zoom.desktop > "${HOME}/.local/share/applications/Zoom.desktop" | |
update-desktop-database ~/.local/share/applications | |
) | |
main "$@" | |
echo "========== RESULT =========" | |
cat "${XDG_CONFIG_HOME}/systemd/user/zoom.slice" | |
echo "========== DESKTOP =========" | |
cat "${HOME}/.local/share/applications/Zoom.desktop" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ln -s "${HOME}/.local/share/applications/Zoom.desktop" "${XDG_CONFIG_HOME}/autostart/Zoom.desktop" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash -xe | |
cat <<EOF > "${HOME}/.config/systemd/user/zoom.slice" | |
[Slice] | |
AllowedCPUs=0-4 | |
MemoryHigh=6G | |
EOF | |
cat /usr/share/applications/Zoom.desktop | sed -E 's#^(Exec=).*$#Exec=/usr/bin/systemd-run --user --slice=zoom.slice /opt/zoom/ZoomLauncher#' > "${HOME}/.local/share/applications/Zoom.desktop" | |
update-desktop-database ~/.local/share/applications |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment