diff --git a/scripts/openrgb-hue-apply.sh b/scripts/openrgb-hue-apply.sh deleted file mode 100755 index 27d6675..0000000 --- a/scripts/openrgb-hue-apply.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Services (e.g. systemd --user units) run with a minimal PATH that skips -# shell-init-only additions like pyenv shims or pip's --user bin dir, even -# though those tools are installed. Add the common locations as a fallback. -export PATH="$HOME/.local/bin:$HOME/.pyenv/shims:$PATH" - -if ! command -v openrgb-hue >/dev/null 2>&1; then - echo "error: 'openrgb-hue' was not found on PATH." >&2 - echo "Install it with:" >&2 - echo " pip install --index-url https://dev.pivoine.art/api/packages/valknar/pypi/simple/ --extra-index-url https://pypi.org/simple openrgb-hue" >&2 - exit 1 -fi - -exec openrgb-hue apply "$SCENE" "$@" diff --git a/triggershell.yml b/triggershell.yml index 9664994..5ed806a 100644 --- a/triggershell.yml +++ b/triggershell.yml @@ -32,7 +32,20 @@ scripts: name: "OpenRGB: Apply Hue Scene" description: Apply a Philips Hue scene as a static color gradient across OpenRGB-controlled lights (motherboard, GPU, RAM, etc). command: bash - args: ["./scripts/openrgb-hue-apply.sh"] + args: + - -c + - | + # systemd --user units run with a minimal PATH that skips pyenv shims + # and pip's --user bin dir, so add the common locations as a fallback. + export PATH="$HOME/.local/bin:$HOME/.pyenv/shims:$PATH" + if ! command -v openrgb-hue >/dev/null 2>&1; then + echo "error: 'openrgb-hue' was not found on PATH." >&2 + echo "Install it with:" >&2 + echo " pip install --index-url https://dev.pivoine.art/api/packages/valknar/pypi/simple/ --extra-index-url https://pypi.org/simple openrgb-hue" >&2 + exit 1 + fi + exec openrgb-hue apply "$SCENE" "$@" + - openrgb-hue-apply cwd: ./ timeoutSeconds: 30 variables: @@ -282,3 +295,141 @@ scripts: min: 1 passAs: arg argName: --dry-run-leds + + - id: openrgb-hue-off + name: "OpenRGB: Turn Off Lights" + description: Turn off OpenRGB-controlled LEDs. Leave every filter unset to turn off all of them. + command: bash + args: + - -c + - | + export PATH="$HOME/.local/bin:$HOME/.pyenv/shims:$PATH" + if ! command -v openrgb-hue >/dev/null 2>&1; then + echo "error: 'openrgb-hue' was not found on PATH." >&2 + echo "Install it with:" >&2 + echo " pip install --index-url https://dev.pivoine.art/api/packages/valknar/pypi/simple/ --extra-index-url https://pypi.org/simple openrgb-hue" >&2 + exit 1 + fi + exec openrgb-hue off "$@" + - openrgb-hue-off + cwd: ./ + timeoutSeconds: 30 + variables: + - name: deviceType + label: Device Type + description: Limit to devices of this type. Leave unset to target every device. + type: enum + required: false + choices: [DRAM, GPU, MOTHERBOARD] + control: select + passAs: arg + argName: --device-type + + - name: device + label: Device + description: Limit to a single device by name. Leave unset to target every device. + type: enum + required: false + choices: + - "Corsair Vengeance RGB DDR5" + - "Gigabyte GeForce RTX 3060 Gaming OC" + - "MSI MYSTIC LIGHT" + control: select + passAs: arg + argName: --device + + - name: zone + label: Zone + description: Limit to a single zone by name. Leave unset to target every zone. + type: enum + required: false + choices: + - "Corsair DRAM" + - "GPU Zone" + - "JAF" + - "JARGB 1" + - "JARGB 2" + - "JARGB 3" + control: select + passAs: arg + argName: --zone + + - id: system-shutdown + name: "System: Shutdown" + description: >- + Powers off this machine. Type "shutdown" in the Confirm field to proceed. + Optionally schedule it a few minutes out (cancel a pending one with "System: Cancel Shutdown"). + command: bash + args: + - -c + - >- + if [ "$CONFIRM" != "shutdown" ]; then + echo 'Aborted: type "shutdown" in the Confirm field to proceed.' >&2; exit 1; + fi; + when=now; + if [ "${DELAY_MINUTES:-0}" -gt 0 ] 2>/dev/null; then when="+$DELAY_MINUTES"; fi; + echo "Scheduling poweroff ($when)..."; + exec shutdown -h "$when" + timeoutSeconds: 30 + variables: + - name: confirm + label: Confirm + description: Type "shutdown" (exactly) to confirm you want to power off this machine. + type: string + required: true + pattern: "^shutdown$" + passAs: env + envName: CONFIRM + - name: delayMinutes + label: Delay (minutes) + description: Wait this many minutes before powering off. 0 = immediately. + type: number + default: 0 + min: 0 + max: 120 + passAs: env + envName: DELAY_MINUTES + + - id: system-reboot + name: "System: Reboot" + description: >- + Reboots this machine. Type "reboot" in the Confirm field to proceed. + Optionally schedule it a few minutes out (cancel a pending one with "System: Cancel Shutdown"). + command: bash + args: + - -c + - >- + if [ "$CONFIRM" != "reboot" ]; then + echo 'Aborted: type "reboot" in the Confirm field to proceed.' >&2; exit 1; + fi; + when=now; + if [ "${DELAY_MINUTES:-0}" -gt 0 ] 2>/dev/null; then when="+$DELAY_MINUTES"; fi; + echo "Scheduling reboot ($when)..."; + exec shutdown -r "$when" + timeoutSeconds: 30 + variables: + - name: confirm + label: Confirm + description: Type "reboot" (exactly) to confirm you want to reboot this machine. + type: string + required: true + pattern: "^reboot$" + passAs: env + envName: CONFIRM + - name: delayMinutes + label: Delay (minutes) + description: Wait this many minutes before rebooting. 0 = immediately. + type: number + default: 0 + min: 0 + max: 120 + passAs: env + envName: DELAY_MINUTES + + - id: system-cancel-shutdown + name: "System: Cancel Shutdown" + description: Cancels a pending scheduled shutdown or reboot. + command: shutdown + args: ["-c"] + timeoutSeconds: 15 + variables: []