Suppress brightness OSD from display panel
This commit is contained in:
@@ -1,8 +1,21 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# omarchy:summary=Show or adjust brightness on the most likely display device.
|
# omarchy:summary=Show or adjust brightness on the most likely display device.
|
||||||
# omarchy:args=[+N%|N%-|N%|off|on]
|
# omarchy:args=[--no-osd] [+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: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
|
# Get the brightness of the passed display
|
||||||
display_brightness() {
|
display_brightness() {
|
||||||
@@ -36,7 +49,11 @@ exec {lock_fd}>"${XDG_RUNTIME_DIR:-/tmp}/omarchy-brightness-display.lock"
|
|||||||
flock -n "$lock_fd" || exit 0
|
flock -n "$lock_fd" || exit 0
|
||||||
|
|
||||||
if omarchy-hyprland-monitor-focused-apple; then
|
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
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -72,4 +89,4 @@ fi
|
|||||||
brightnessctl -d "$device" set "$step" >/dev/null
|
brightnessctl -d "$device" set "$step" >/dev/null
|
||||||
|
|
||||||
# Show the new brightness in OSD
|
# Show the new brightness in OSD
|
||||||
omarchy-osd -i brightness -p "$(display_brightness "$device")"
|
(( no_osd )) || omarchy-osd -i brightness -p "$(display_brightness "$device")"
|
||||||
|
|||||||
@@ -1,10 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# omarchy:summary=Show or adjust Apple Studio Display and Apple XDR Display brightness using asdcontrol.
|
# omarchy:summary=Show or adjust Apple Studio Display and Apple XDR Display brightness using asdcontrol.
|
||||||
# omarchy:args=[+N%|N%-|N%]
|
# omarchy:args=[--no-osd] [+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: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"
|
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() {
|
detect_apple_display_device() {
|
||||||
local devices=()
|
local devices=()
|
||||||
@@ -86,4 +98,4 @@ if ! sudo asdcontrol "$device" -- "$step" >/dev/null; then
|
|||||||
sudo asdcontrol "$device" -- "$step" >/dev/null
|
sudo asdcontrol "$device" -- "$step" >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
omarchy-osd -i brightness -p "$(current_brightness "$device")"
|
(( no_osd )) || omarchy-osd -i brightness -p "$(current_brightness "$device")"
|
||||||
|
|||||||
@@ -1,7 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# omarchy:summary=Adjust keyboard backlight brightness using available steps.
|
# omarchy:summary=Adjust keyboard backlight brightness using available steps.
|
||||||
# omarchy:args=<up|down|cycle|off|restore>
|
# omarchy:args=[--no-osd] <up|down|cycle|off|restore>
|
||||||
|
|
||||||
|
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}"
|
direction="${1:-up}"
|
||||||
|
|
||||||
@@ -49,4 +62,4 @@ fi
|
|||||||
|
|
||||||
# Set the new brightness.
|
# Set the new brightness.
|
||||||
brightnessctl -d "$device" set "$new_brightness" >/dev/null
|
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 ))"
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ Panel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
root.brightnessSetQueued = false
|
root.brightnessSetQueued = false
|
||||||
setBrightnessProc.command = ["bash", "-lc", "omarchy-brightness-display " + percent + "%"]
|
setBrightnessProc.command = ["bash", "-lc", "omarchy-brightness-display --no-osd " + percent + "%"]
|
||||||
setBrightnessProc.running = true
|
setBrightnessProc.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user