#!/bin/bash # omarchy:summary=Print the most likely display backlight device. # omarchy:examples=omarchy-hw-display # Start with the first possible output, then refine to the most likely given an order heuristic. device="$(ls -1 /sys/class/backlight 2>/dev/null | head -n1)" for candidate in amdgpu_bl* intel_backlight acpi_video*; do if [[ -e /sys/class/backlight/$candidate ]]; then device="$candidate" break fi done if [[ -n $device ]]; then printf '%s\n' "$device" else exit 1 fi