diff --git a/bin/omarchy-brightness-display b/bin/omarchy-brightness-display index 06e0842b..f672b483 100755 --- a/bin/omarchy-brightness-display +++ b/bin/omarchy-brightness-display @@ -1,8 +1,21 @@ #!/bin/bash # omarchy:summary=Show or adjust brightness on the most likely display device. -# omarchy:args=[+N%|N%-|N%|off|on] -# omarchy:examples=omarchy brightness display | omarchy brightness display +5% | omarchy brightness display 5%- | omarchy brightness display 50% | omarchy brightness display off | omarchy brightness display on +# omarchy:args=[--no-osd] [+N%|N%-|N%|off|on] +# omarchy:examples=omarchy brightness display | omarchy brightness display +5% | omarchy brightness display --no-osd 50% | omarchy brightness display off | omarchy brightness display on + +no_osd=0 +args=() + +for arg in "$@"; do + if [[ $arg == "--no-osd" ]]; then + no_osd=1 + else + args+=("$arg") + fi +done + +set -- "${args[@]}" # Get the brightness of the passed display display_brightness() { @@ -36,7 +49,11 @@ exec {lock_fd}>"${XDG_RUNTIME_DIR:-/tmp}/omarchy-brightness-display.lock" flock -n "$lock_fd" || exit 0 if omarchy-hyprland-monitor-focused-apple; then - omarchy-brightness-display-apple "$step" + if (( no_osd )); then + omarchy-brightness-display-apple --no-osd "$step" + else + omarchy-brightness-display-apple "$step" + fi exit fi @@ -72,4 +89,4 @@ fi brightnessctl -d "$device" set "$step" >/dev/null # Show the new brightness in OSD -omarchy-osd -i brightness -p "$(display_brightness "$device")" +(( no_osd )) || omarchy-osd -i brightness -p "$(display_brightness "$device")" diff --git a/bin/omarchy-brightness-display-apple b/bin/omarchy-brightness-display-apple index 600e26ed..3e0d5c8b 100755 --- a/bin/omarchy-brightness-display-apple +++ b/bin/omarchy-brightness-display-apple @@ -1,10 +1,22 @@ #!/bin/bash # omarchy:summary=Show or adjust Apple Studio Display and Apple XDR Display brightness using asdcontrol. -# omarchy:args=[+N%|N%-|N%] -# omarchy:examples=omarchy brightness display apple | omarchy brightness display apple +5% | omarchy brightness display apple 5%- | omarchy brightness display apple 50% +# omarchy:args=[--no-osd] [+N%|N%-|N%] +# omarchy:examples=omarchy brightness display apple | omarchy brightness display apple +5% | omarchy brightness display apple --no-osd 50% device_cache="${XDG_RUNTIME_DIR:-/tmp}/omarchy-brightness-display-apple.device" +no_osd=0 +args=() + +for arg in "$@"; do + if [[ $arg == "--no-osd" ]]; then + no_osd=1 + else + args+=("$arg") + fi +done + +set -- "${args[@]}" detect_apple_display_device() { local devices=() @@ -86,4 +98,4 @@ if ! sudo asdcontrol "$device" -- "$step" >/dev/null; then sudo asdcontrol "$device" -- "$step" >/dev/null fi -omarchy-osd -i brightness -p "$(current_brightness "$device")" +(( no_osd )) || omarchy-osd -i brightness -p "$(current_brightness "$device")" diff --git a/bin/omarchy-brightness-keyboard b/bin/omarchy-brightness-keyboard index e680530f..318c6b1b 100755 --- a/bin/omarchy-brightness-keyboard +++ b/bin/omarchy-brightness-keyboard @@ -1,7 +1,20 @@ #!/bin/bash # omarchy:summary=Adjust keyboard backlight brightness using available steps. -# omarchy:args= +# omarchy:args=[--no-osd] + +no_osd=0 +args=() + +for arg in "$@"; do + if [[ $arg == "--no-osd" ]]; then + no_osd=1 + else + args+=("$arg") + fi +done + +set -- "${args[@]}" direction="${1:-up}" @@ -49,4 +62,4 @@ fi # Set the new brightness. brightnessctl -d "$device" set "$new_brightness" >/dev/null -omarchy-osd -i keyboard -p "$(( new_brightness * 100 / max_brightness ))" +(( no_osd )) || omarchy-osd -i keyboard -p "$(( new_brightness * 100 / max_brightness ))" diff --git a/shell/plugins/panels/Monitor.qml b/shell/plugins/panels/Monitor.qml index 3e3dc5b0..537b51f5 100644 --- a/shell/plugins/panels/Monitor.qml +++ b/shell/plugins/panels/Monitor.qml @@ -210,7 +210,7 @@ Panel { } root.brightnessSetQueued = false - setBrightnessProc.command = ["bash", "-lc", "omarchy-brightness-display " + percent + "%"] + setBrightnessProc.command = ["bash", "-lc", "omarchy-brightness-display --no-osd " + percent + "%"] setBrightnessProc.running = true }