From 6d87114290f5076b62f65037c719d1f9c46cbb2c Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 20 Feb 2023 14:21:04 +0100 Subject: Add i3 shortcuts for enabling/disabling displayport as well as turning its brightness on/off --- yoga/bin/toggle-dp-brightness | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 yoga/bin/toggle-dp-brightness (limited to 'yoga/bin/toggle-dp-brightness') diff --git a/yoga/bin/toggle-dp-brightness b/yoga/bin/toggle-dp-brightness new file mode 100755 index 0000000..e92eaff --- /dev/null +++ b/yoga/bin/toggle-dp-brightness @@ -0,0 +1,11 @@ +#!/bin/bash +set -e +EXTERNAL="$(xrandr | grep 'DisplayPort.* connected' | cut -d' ' -f1)" +[ -z "$EXTERNAL" ] && exit 1 + +BRIGHTNESS="$(xrandr --verbose | grep -A5 "$EXTERNAL" | grep Brightness | cut -d':' -f2)" +if [ "$BRIGHTNESS" == " 1.0" ]; then + xrandr --output $EXTERNAL --brightness 0 +else + xrandr --output $EXTERNAL --brightness 1 +fi -- cgit v1.2.3