Extract stats and clipboard helpers

This commit is contained in:
David Heinemeier Hansson
2026-05-21 11:58:43 +02:00
parent 8734464439
commit 4cd23d9584
7 changed files with 109 additions and 56 deletions
+1
View File
@@ -35,6 +35,7 @@ GROUP_DESCRIPTIONS[branding]="About and screensaver branding"
GROUP_DESCRIPTIONS[brightness]="Display and keyboard brightness"
GROUP_DESCRIPTIONS[capture]="Screenshots and screen recording"
GROUP_DESCRIPTIONS[channel]="Omarchy release channel management"
GROUP_DESCRIPTIONS[clipboard]="Clipboard helpers"
GROUP_DESCRIPTIONS[cmd]="Command and shortcut helpers"
GROUP_DESCRIPTIONS[config]="System configuration helpers"
GROUP_DESCRIPTIONS[debug]="Diagnostics and support logs"
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
# omarchy:summary=Copy a file to the clipboard and paste it
# omarchy:group=clipboard
# omarchy:args=<mime-type> <path>
# omarchy:examples=omarchy clipboard paste file image/png /tmp/screenshot.png
mime=${1:-}
path=${2:-}
if [[ -z $mime || -z $path ]]; then
echo "Usage: omarchy-clipboard-paste-file <mime-type> <path>" >&2
exit 1
fi
[[ -r $path ]] || exit 1
wl-copy --type "$mime" < "$path"
sleep 0.15
wtype -M shift -k Insert -m shift 2>/dev/null || true
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
# omarchy:summary=Copy text to the clipboard and type or paste it
# omarchy:group=clipboard
# omarchy:args=[--shift-insert] <text>
# omarchy:examples=omarchy clipboard paste text "hello" | omarchy clipboard paste text --shift-insert "hello"
use_shift_insert=false
if [[ ${1:-} == "--shift-insert" ]]; then
use_shift_insert=true
shift
fi
text=${1:-}
[[ -n $text ]] || exit
printf '%s' "$text" | wl-copy
sleep 0.15
if [[ $use_shift_insert == "true" ]]; then
wtype -M shift -k Insert -m shift 2>/dev/null || true
else
wtype "$text" 2>/dev/null || true
fi
+35
View File
@@ -2,6 +2,41 @@
# omarchy:summary=Print CPU and memory stats for the shell
# omarchy:group=system
# omarchy:args=[--bar-widget]
bar_widget_stats() {
awk '
NR == 1 {
idle = $5
total = 0
for (i = 2; i <= NF; i++) total += $i
printf "cpu\t%s\t%s\n", idle, total
}
' /proc/stat
awk '
/^MemTotal:/ { total = $2 }
/^MemAvailable:/ { avail = $2 }
END {
if (total > 0) printf "memory\t%.2f\n", ((total - avail) / total) * 100
}
' /proc/meminfo
awk '{ print "load\t" $1 }' /proc/loadavg
}
case "${1:-}" in
"")
;;
--bar-widget)
bar_widget_stats
exit
;;
*)
echo "Usage: omarchy-system-stats [--bar-widget]" >&2
exit 1
;;
esac
cpu=$(top -bn1 | awk '/^%?Cpu/ {
gsub(/,/, "")