From 889f0ef91c58636157234ca22acb3d233679ee02 Mon Sep 17 00:00:00 2001
From: Przemyslaw Grondek <przemyslaw.grondek@prudential.pl>
Date: Tue, 28 May 2019 14:01:09 +0200
Subject: [PATCH] [i3blocks] Add brightness

---
 i3blocks/brightness | 18 ++++++++++++++++++
 i3blocks/config     |  5 +++++
 2 files changed, 23 insertions(+)
 create mode 100755 i3blocks/brightness

diff --git a/i3blocks/brightness b/i3blocks/brightness
new file mode 100755
index 0000000..5a5836c
--- /dev/null
+++ b/i3blocks/brightness
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+output=eDP-1
+brightness=$(xrandr --verbose | grep Brightness | awk '{printf "%d", $2*100}')
+
+echo $brightness
+
+set_brightness() {
+    xrandr --output $output --brightness $(echo $1 | awk '{printf "%0.2f", $1/100}' )
+}
+
+case $BLOCK_BUTTON in
+    4) set_brightness $((brightness + 10 ))
+        ;; # scroll up
+
+    5) set_brightness $((brightness - 10 ))
+        ;; # scroll down
+esac
diff --git a/i3blocks/config b/i3blocks/config
index 88ce41f..4c86b57 100644
--- a/i3blocks/config
+++ b/i3blocks/config
@@ -3,6 +3,11 @@ command=~/.config/i3blocks/$BLOCK_NAME
 separator_block_width=15
 markup=none
 
+[brightness]
+label=🔆
+interval=once
+signal=10
+
 [volume]
 label=🔈
 interval=once