Extract shell panel status commands
This commit is contained in:
+2
-1
@@ -51,6 +51,7 @@ GROUP_DESCRIPTIONS[install]="Optional software installers"
|
||||
GROUP_DESCRIPTIONS[launch]="Application launchers"
|
||||
GROUP_DESCRIPTIONS[menu]="Omarchy menu commands"
|
||||
GROUP_DESCRIPTIONS[migrate]="Migration runner"
|
||||
GROUP_DESCRIPTIONS[monitor]="Monitor status helpers"
|
||||
GROUP_DESCRIPTIONS[network]="Network status helpers"
|
||||
GROUP_DESCRIPTIONS[notification]="Notification helpers"
|
||||
GROUP_DESCRIPTIONS[npm]="NPM package wrappers"
|
||||
@@ -69,7 +70,7 @@ GROUP_DESCRIPTIONS[screensaver]="Screensaver branding and animation"
|
||||
GROUP_DESCRIPTIONS[snapshot]="System snapshots"
|
||||
GROUP_DESCRIPTIONS[style]="Global UI style controls"
|
||||
GROUP_DESCRIPTIONS[sudo]="Sudo configuration helpers"
|
||||
GROUP_DESCRIPTIONS[system]="Reboot, shutdown, logout, and lock"
|
||||
GROUP_DESCRIPTIONS[system]="System status, reboot, shutdown, logout, and lock"
|
||||
GROUP_DESCRIPTIONS[theme]="Theme management"
|
||||
GROUP_DESCRIPTIONS[toggle]="Toggle Omarchy features"
|
||||
GROUP_DESCRIPTIONS[transcode]="Image and video transcoding"
|
||||
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Print PulseAudio sink availability for the shell
|
||||
# omarchy:group=audio
|
||||
|
||||
pactl list sinks 2>/dev/null | awk '
|
||||
function emit_sink() {
|
||||
if (name == "") return
|
||||
print name "\t" ((port_count == 0 || available) ? 1 : 0)
|
||||
}
|
||||
|
||||
/^Sink #/ {
|
||||
emit_sink()
|
||||
name = ""
|
||||
in_ports = 0
|
||||
port_count = 0
|
||||
available = 0
|
||||
next
|
||||
}
|
||||
|
||||
/^[[:space:]]*Name:/ {
|
||||
name = $2
|
||||
next
|
||||
}
|
||||
|
||||
/^[[:space:]]*Ports:$/ {
|
||||
in_ports = 1
|
||||
next
|
||||
}
|
||||
|
||||
in_ports && /^\tActive Port:/ {
|
||||
in_ports = 0
|
||||
next
|
||||
}
|
||||
|
||||
in_ports && /^\t\t/ {
|
||||
port_count++
|
||||
if ($0 !~ /not available/) available = 1
|
||||
next
|
||||
}
|
||||
|
||||
END {
|
||||
emit_sink()
|
||||
}
|
||||
'
|
||||
+50
-16
@@ -1,27 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Returns a formatted battery status string with percentage and power draw/charge.
|
||||
# omarchy:args=[--shell]
|
||||
|
||||
battery_info=$(upower -i $(upower -e | grep BAT))
|
||||
shell_output=false
|
||||
|
||||
percentage=$(echo "$battery_info" | awk '/percentage/ {
|
||||
print int($2)
|
||||
exit
|
||||
}')
|
||||
case "${1:-}" in
|
||||
"")
|
||||
;;
|
||||
--shell)
|
||||
shell_output=true
|
||||
;;
|
||||
*)
|
||||
echo "Usage: omarchy-battery-status [--shell]" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
power_rate=$(echo "$battery_info" | awk '/energy-rate/ {
|
||||
rounded = sprintf("%.1f", $2)
|
||||
sub(/\.0$/, "", rounded)
|
||||
print rounded
|
||||
exit
|
||||
}')
|
||||
battery=$(upower -e 2>/dev/null | grep BAT | head -n 1)
|
||||
[[ -z $battery ]] && exit 0
|
||||
|
||||
state=$(echo "$battery_info" | awk '/state/ { print $2; exit }')
|
||||
time_remaining=$(omarchy-battery-remaining-time)
|
||||
capacity=$(omarchy-battery-capacity)
|
||||
battery_info=$(upower -i "$battery")
|
||||
|
||||
percentage=$(awk '/percentage/ { print int($2); exit }' <<<"$battery_info")
|
||||
power_rate=$(awk '/energy-rate/ {
|
||||
rounded = sprintf("%.1f", $2)
|
||||
sub(/\.0$/, "", rounded)
|
||||
print rounded
|
||||
exit
|
||||
}' <<<"$battery_info")
|
||||
state=$(awk '/state/ { print $2; exit }' <<<"$battery_info")
|
||||
time_remaining=$(omarchy-battery-remaining-time 2>/dev/null)
|
||||
capacity=$(omarchy-battery-capacity 2>/dev/null)
|
||||
|
||||
if [[ $shell_output == "true" ]]; then
|
||||
printf 'percentage\t%s\n' "${percentage}%"
|
||||
printf 'state\t%s\n' "$state"
|
||||
printf 'rate\t%s\n' "${power_rate}W"
|
||||
printf 'size\t%s\n' "${capacity}Wh"
|
||||
printf 'time\t%s\n' "$time_remaining"
|
||||
|
||||
end=$(cat /sys/class/power_supply/BAT*/charge_control_end_threshold 2>/dev/null | head -1)
|
||||
start=$(cat /sys/class/power_supply/BAT*/charge_control_start_threshold 2>/dev/null | head -1)
|
||||
|
||||
if [[ -n $end ]]; then
|
||||
if [[ -n $start && $start != "$end" ]]; then
|
||||
printf 'threshold\t%s-%s%%\n' "$start" "$end"
|
||||
else
|
||||
printf 'threshold\t%s%%\n' "$end"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $state == "charging" ]]; then
|
||||
echo "Battery ${percentage}% · ${time_remaining} to full · ${power_rate}W / ${capacity}Wh"
|
||||
echo "Battery ${percentage}% · ${time_remaining} to full · ${power_rate}W / ${capacity}Wh"
|
||||
else
|
||||
echo "Battery ${percentage}% · ${time_remaining} left · ${power_rate}W / ${capacity}Wh"
|
||||
echo "Battery ${percentage}% · ${time_remaining} left · ${power_rate}W / ${capacity}Wh"
|
||||
fi
|
||||
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Print monitor panel state for the shell
|
||||
# omarchy:group=monitor
|
||||
|
||||
{ omarchy-brightness-display 2>/dev/null; echo; } | head -n 1
|
||||
|
||||
monitors_json=$(hyprctl monitors all -j)
|
||||
|
||||
printf '%s\n' "$monitors_json" | jq -r '
|
||||
def internal: test("^(eDP|LVDS|DSI)-");
|
||||
([.[] | select(.name | internal)][0].name // ""),
|
||||
([.[] | select((.name | internal) | not)][0].name // ""),
|
||||
([.[] | select((.name | internal) and .disabled != true)][0].name // ""),
|
||||
([.[] | select((.name | internal) and .mirrorOf != "none")][0].mirrorOf // "")
|
||||
'
|
||||
|
||||
omarchy-hyprland-monitor-focused 2>/dev/null || echo
|
||||
omarchy-hyprland-monitor-scaling 2>/dev/null || echo
|
||||
|
||||
printf '%s\n' "$monitors_json" | jq -c '[.[] | {name, enabled:(.disabled != true), focused:(.focused == true)}]'
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Print CPU and memory stats for the shell
|
||||
# omarchy:group=system
|
||||
|
||||
cpu=$(top -bn1 | awk '/^%?Cpu/ {
|
||||
gsub(/,/, "")
|
||||
for (i = 1; i <= NF; i++) {
|
||||
if ($(i + 1) == "id") {
|
||||
printf "%.0f%%", 100 - $i
|
||||
exit
|
||||
}
|
||||
}
|
||||
}')
|
||||
|
||||
awk -v cpu="$cpu" '
|
||||
/^MemTotal:/ { total = $2 }
|
||||
/^MemAvailable:/ { avail = $2 }
|
||||
END {
|
||||
used = total - avail
|
||||
printf "cpu\t%s\n", cpu
|
||||
printf "memory\t%.1fGB / %.0fGB\n", used / 1024 / 1024, total / 1024 / 1024
|
||||
}
|
||||
' /proc/meminfo
|
||||
Reference in New Issue
Block a user