Krolyxon
Commit 37a6873

Branches

Refs →

aurora.localbinbrictl

46 lines · 1.1 KB · Bourne Again Shell (bash)

1#!/usr/bin/env sh
2# Source: https://github.com/albertnis/hypr-brightness
3# Install ddcutil, and then enable access to i2c for your user
4
5# sudo gpasswd -a $USER i2c
6# sudo modprobe i2c-dev
7# echo i2c-dev | sudo tee /etc/modules-load.d/i2c-dev.conf
8
9set +e
10
11usage="Usage: $0 [+] or [-]"
12
13if [ "$#" -ne 1 ]; then
14 echo "No direction parameter provided"
15 echo "$usage"
16 exit 1
17fi
18
19arg="$1"
20
21if [ "$arg" == "help" ] || [ "$arg" == "--help" ] || [ "$arg" == "-h" ]; then
22 echo "$usage"
23 exit 0
24fi
25
26if [ "$arg" != "+" ] && [ "$arg" != "-" ]; then
27 echo "Direction parameter must be '+' or '-'"
28 echo $usage
29 exit 1
30fi
31
32direction=$arg
33
34monitor_data=$(hyprctl monitors -j)
35focused_name=$(echo $monitor_data | jq -r '.[] | select(.focused == true) | .name')
36
37if [ "$focused_name" == "eDP-1" ]; then
38 if [ "$direction" == "-" ]; then
39 brightnessctl -e4 -n2 set 5%-
40 else
41 brightnessctl -e4 -n2 set 5%+
42 fi
43else
44 focused_id=$(echo $monitor_data | jq -r '.[] | select(.focused == true) | .id')
45 ddcutil --enable-dynamic-sleep --display=$focused_id setvcp 10 $direction 15
46fi