mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-02 04:37:49 +02:00
20 lines
612 B
Bash
Executable File
20 lines
612 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Returns a list of all the available power profiles on the system.
|
|
# omarchy:args=[--active-state]
|
|
|
|
if [[ ${1:-} != "" && ${1:-} != "--active-state" ]]; then
|
|
echo "Usage: omarchy-powerprofiles-list [--active-state]" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ${1:-} == "--active-state" ]]; then
|
|
powerprofilesctl list 2>/dev/null |
|
|
awk '/^\s*[* ]\s*[a-zA-Z0-9-]+:$/ { active=($1=="*"); gsub(/^[*[:space:]]+|:$/,""); print $0 "\t" (active ? 1 : 0) }' |
|
|
tac
|
|
else
|
|
powerprofilesctl list 2>/dev/null |
|
|
awk '/^\s*[* ]\s*[a-zA-Z0-9-]+:$/ { gsub(/^[*[:space:]]+|:$/,""); print }' |
|
|
tac
|
|
fi
|