mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-02 04:37:49 +02:00
40 lines
1.2 KiB
Bash
40 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
|
|
|
|
TMPDIR=$(mktemp -d)
|
|
trap 'rm -rf "$TMPDIR"' EXIT
|
|
|
|
mkdir -p "$TMPDIR/bin"
|
|
|
|
cat >"$TMPDIR/bin/hyprctl" <<'SH'
|
|
#!/bin/bash
|
|
|
|
if [[ ${1:-} == "hyprsunset" && ${2:-} == "temperature" ]]; then
|
|
printf '%s\n' "${HYPRSUNSET_TEMP:-6500}"
|
|
exit 0
|
|
fi
|
|
|
|
exit 1
|
|
SH
|
|
|
|
chmod +x "$TMPDIR/bin/hyprctl"
|
|
|
|
nightlight_status() {
|
|
HYPRSUNSET_TEMP="$1" PATH="$TMPDIR/bin:$PATH" "$ROOT/bin/omarchy-toggle-nightlight" --status
|
|
}
|
|
|
|
[[ $(nightlight_status 4000 | jq -r .enabled) == "true" ]] || fail "nightlight status reports 4000K as enabled"
|
|
pass "nightlight status reports 4000K as enabled"
|
|
|
|
[[ $(nightlight_status 5999 | jq -r .enabled) == "true" ]] || fail "nightlight status reports warmer-than-identity values as enabled"
|
|
pass "nightlight status reports warmer-than-identity values as enabled"
|
|
|
|
[[ $(nightlight_status 6000 | jq -r .enabled) == "false" ]] || fail "nightlight status reports identity temperature as disabled"
|
|
pass "nightlight status reports identity temperature as disabled"
|
|
|
|
[[ $(nightlight_status 6500 | jq -r .enabled) == "false" ]] || fail "nightlight status reports daylight temperature as disabled"
|
|
pass "nightlight status reports daylight temperature as disabled"
|