From 88e708fa5516a426b5fe40322bf17bebc8c494d6 Mon Sep 17 00:00:00 2001 From: Clay Gomera Date: Tue, 19 Jul 2022 22:46:41 -0400 Subject: [PATCH] Added screen brightness to dwmblocks --- user/.config/suckless/dwmblocks/blocks.def.h | 2 ++ user/.config/suckless/dwmblocks/scripts/brightness | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100755 user/.config/suckless/dwmblocks/scripts/brightness diff --git a/user/.config/suckless/dwmblocks/blocks.def.h b/user/.config/suckless/dwmblocks/blocks.def.h index 1f76b7427..7b9590b9f 100644 --- a/user/.config/suckless/dwmblocks/blocks.def.h +++ b/user/.config/suckless/dwmblocks/blocks.def.h @@ -7,6 +7,8 @@ static const Block blocks[] = { {"", "$HOME/.config/suckless/dwmblocks/scripts/battery", 1, 1}, + {"", "$HOME/.config/suckless/dwmblocks/scripts/brightness", 1, 1}, + {"", "$HOME/.config/suckless/dwmblocks/scripts/volume", 1, 1}, {"", "$HOME/.config/suckless/dwmblocks/scripts/clock", 5, 0}, diff --git a/user/.config/suckless/dwmblocks/scripts/brightness b/user/.config/suckless/dwmblocks/scripts/brightness new file mode 100755 index 000000000..fbf6de18b --- /dev/null +++ b/user/.config/suckless/dwmblocks/scripts/brightness @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +brt=$(xbacklight -get) +if [ "$brt" = "100.000000" ]; then + icon=🔆 +elif [ "$brt" \> "50%.*" ]; then + icon=🔆 +elif [ "$brt" \< "49%.*" ]; then + icon=🔅 +fi +echo " $icon ${brt%.*}% "