aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/brictl
diff options
context:
space:
mode:
authorkrolxon <krolyxon@tutanota.com>2025-08-26 01:00:50 +0530
committerkrolxon <krolyxon@tutanota.com>2025-08-26 01:00:50 +0530
commit46c5bf255206c88434692f7d91c6fa92ffb7417e (patch)
treec4db869c8e64804b33ab0889b613405adacaa5ac /.local/bin/brictl
parent1ac0f699dc127e5b7a007165257a9e137c932513 (diff)
move hypr_brightness to \$PATH
Diffstat (limited to '.local/bin/brictl')
-rwxr-xr-x.local/bin/brictl46
1 files changed, 46 insertions, 0 deletions
diff --git a/.local/bin/brictl b/.local/bin/brictl
new file mode 100755
index 0000000..2ba9d98
--- /dev/null
+++ b/.local/bin/brictl
@@ -0,0 +1,46 @@
+#!/usr/bin/env sh
+# Source: https://github.com/albertnis/hypr-brightness
+# Install ddcutil, and then enable access to i2c for your user
+
+# sudo gpasswd -a $USER i2c
+# sudo modprobe i2c-dev
+# echo i2c-dev | sudo tee /etc/modules-load.d/i2c-dev.conf
+
+set +e
+
+usage="Usage: $0 [+] or [-]"
+
+if [ "$#" -ne 1 ]; then
+ echo "No direction parameter provided"
+ echo "$usage"
+ exit 1
+fi
+
+arg="$1"
+
+if [ "$arg" == "help" ] || [ "$arg" == "--help" ] || [ "$arg" == "-h" ]; then
+ echo "$usage"
+ exit 0
+fi
+
+if [ "$arg" != "+" ] && [ "$arg" != "-" ]; then
+ echo "Direction parameter must be '+' or '-'"
+ echo $usage
+ exit 1
+fi
+
+direction=$arg
+
+monitor_data=$(hyprctl monitors -j)
+focused_name=$(echo $monitor_data | jq -r '.[] | select(.focused == true) | .name')
+
+if [ "$focused_name" == "eDP-1" ]; then
+ if [ "$direction" == "-" ]; then
+ brightnessctl -e4 -n2 set 5%-
+ else
+ brightnessctl -e4 -n2 set 5%+
+ fi
+else
+ focused_id=$(echo $monitor_data | jq -r '.[] | select(.focused == true) | .id')
+ ddcutil --enable-dynamic-sleep --display=$focused_id setvcp 10 $direction 15
+fi