From 77076af7e9fdd3a397bd5f0ac7d5198d531c4e91 Mon Sep 17 00:00:00 2001 From: Juan Luis Romero Date: Mon, 22 Apr 2024 08:23:25 +0200 Subject: [PATCH] feat: add inline-cpu-usage-percent script (#932) --- commands/system/inline-cpu-usage-percent.sh | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 commands/system/inline-cpu-usage-percent.sh diff --git a/commands/system/inline-cpu-usage-percent.sh b/commands/system/inline-cpu-usage-percent.sh new file mode 100644 index 000000000..cfe464085 --- /dev/null +++ b/commands/system/inline-cpu-usage-percent.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Required parameters: +# @raycast.schemaVersion 1 +# @raycast.title CPU Usage +# @raycast.mode inline +# @raycast.packageName System +# @raycast.refreshTime 10s + +# Optional parameters: +# @raycast.icon 🖥️ + +# Documentation: +# @raycast.description Display CPU usage percent +# @raycast.author Juan Luis Romero +# @raycast.authorURL https://github.com/JuanluR8 + + +output=$(top -l 1 | grep "CPU usage") +cpu_usage=$(echo "$output" | awk -F " " '{print $3}' | cut -d% -f1) + +echo "CPU Usage: ${cpu_usage}%" \ No newline at end of file