Remove tweak-cpu-usage script.

This reverts commit 1c9bbb7559.
Icedream 2025-05-22 15:14:52 +02:00
parent 714215113f
commit e2a7179ce6
Signed by: icedream
GPG Key ID: 468BBEEBB9EC6AEA
4 changed files with 14 additions and 51 deletions

View File

@ -1,10 +0,0 @@
[Unit]
Description=Tweak CPU usage
[Service]
Type=simple
ExecStart=%h/.local/bin/tweak-cpu-usage
Restart=on-failure
[Install]
WantedBy=default.target

View File

@ -1,36 +0,0 @@
#!/bin/bash
set -e
set -u
cores=$(nproc)
limits=(
# process_name:limit%
firefox:$(( 50 * cores ))
vesktop:$(( 20 * cores ))
)
# check for cpulimit command
if ! command -v cpulimit 2>/dev/null >/dev/null; then
echo "ERROR: need cpulimit command" >&2
exit 1
fi
limit_process() {
local process_name="$1"
local limit_percentage="${2%%.}"
cpulimit -i -e "$process_name" -l "$limit_percentage"
}
limit_processes() {
local pids
pids=()
for limit in "${limits[@]}"; do
IFS=: read process_name limit_percentage <<<"$limit"
limit_process "$process_name" "$limit_percentage" & pids+=($!)
done
wait "${pids[@]}"
}
limit_processes

View File

@ -53,6 +53,17 @@ install_files() {
done
}
remove_file() {
local path="$1" sha256hash="${2:-}"
if [ ! -f "$path" ]; then
return
fi
if [ -n "${sha256hash}" ] && ! sha256sum -c - <<< "${sha256hash} ${path}" >/dev/null 2>/dev/null; then
return
fi
rm -v "$path"
}
###
install_files "${HOME}" home
@ -63,9 +74,9 @@ if command -v fc-cache >/dev/null 2>&1; then
fi
if command -v systemctl >/dev/null 2>&1; then
systemctl --user daemon-reload
systemctl --user enable tweak-cpu-usage
systemctl --user restart tweak-cpu-usage
systemctl --user disable tweak-cpu-usage
remove_file "${HOME}/.config/systemd/user/tweak-cpu-usage.service" 6abf4488aa268b0171cb400270e2531c8fb067ebe8216c72d337f8c056952f9e
remove_file "${HOME}/.local/bin/tweak-cpu-usage" 7da1938cdf78e583140638848f8bf8a268c2710e4fa3462bca8373e438d67492
fi
# KDE 6

View File

@ -111,7 +111,6 @@ if has_tags pm:pacman; then
# from here on we should have yay available
yay_install \
bat \
cpulimit \
customizepkg-git \
zsh \
zsh-syntax-highlighting \
@ -156,7 +155,6 @@ if has_tags pm:apt; then
zsh \
zsh-syntax-highlighting \
bat \
cpulimit \
jq \
git \
gnupg2