From e2a7179ce654079b578a63e5ce4dce63ff1335e5 Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Thu, 22 May 2025 15:14:52 +0200 Subject: [PATCH] Remove tweak-cpu-usage script. This reverts commit 1c9bbb7559da47a2b33175861586040821a298d7. --- .../systemd/user/tweak-cpu-usage.service | 10 ------ home/dotfiles/local/bin/tweak-cpu-usage | 36 ------------------- install.sh | 17 +++++++-- packages/packages.sh | 2 -- 4 files changed, 14 insertions(+), 51 deletions(-) delete mode 100644 home/dotfiles/config/systemd/user/tweak-cpu-usage.service delete mode 100755 home/dotfiles/local/bin/tweak-cpu-usage diff --git a/home/dotfiles/config/systemd/user/tweak-cpu-usage.service b/home/dotfiles/config/systemd/user/tweak-cpu-usage.service deleted file mode 100644 index 7bb96f6..0000000 --- a/home/dotfiles/config/systemd/user/tweak-cpu-usage.service +++ /dev/null @@ -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 diff --git a/home/dotfiles/local/bin/tweak-cpu-usage b/home/dotfiles/local/bin/tweak-cpu-usage deleted file mode 100755 index fb2b523..0000000 --- a/home/dotfiles/local/bin/tweak-cpu-usage +++ /dev/null @@ -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 diff --git a/install.sh b/install.sh index ff86823..2a1d52d 100755 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/packages/packages.sh b/packages/packages.sh index 3e0cc65..0103382 100755 --- a/packages/packages.sh +++ b/packages/packages.sh @@ -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