From 1cace80e4832a5d250ef4b7ccd687996563fb01b Mon Sep 17 00:00:00 2001 From: venomade Date: Thu, 27 Feb 2025 17:06:42 +0000 Subject: Add old dotfiles --- nixos/scripts/get-brightness | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 nixos/scripts/get-brightness (limited to 'nixos/scripts/get-brightness') diff --git a/nixos/scripts/get-brightness b/nixos/scripts/get-brightness new file mode 100755 index 0000000..4531c16 --- /dev/null +++ b/nixos/scripts/get-brightness @@ -0,0 +1,22 @@ +#!/bin/sh + +# Get the current brightness level as a percentage +brightness=$(brightnessctl g) +max_brightness=$(brightnessctl m) + +# Perform float division and store the result with 2 decimal points +result=$(awk "BEGIN { printf \"%.2f\", $brightness / $max_brightness }") + +# Convert the result to a percentage (multiply by 100) and round to the nearest whole number +percentage=$(awk "BEGIN { printf \"%.0f\", $result * 100 }") + +# Set the icon based on the brightness level +if [ $percentage -le 33 ]; then + icon="󰃞" +elif [ $percentage -le 66 ]; then + icon="󰃟" +else + icon="󰃠" +fi + +echo "$icon $percentage%" -- cgit 1.4.1-2-gfad0