From 978b9dbecaf4255749cdd5697d7b077dc1229ac0 Mon Sep 17 00:00:00 2001 From: hellisabove Date: Sun, 25 Jul 2021 04:12:13 +0300 Subject: [PATCH] Changed rofi launch mode --- brightness | 26 ++++++++++++++++++++++++++ config.h | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 brightness diff --git a/brightness b/brightness new file mode 100755 index 0000000..561dc0b --- /dev/null +++ b/brightness @@ -0,0 +1,26 @@ +#!/bin/bash + +# base dir for backlight class +basedir="/sys/class/backlight/" + +# get the backlight handler +handler=$basedir$(ls $basedir)"/" + +# get current brightness +old_brightness=$(cat $handler"brightness") + +# get max brightness +max_brightness=$(cat $handler"max_brightness") + +# get current brightness % +old_brightness_p=$(( 100 * $old_brightness / $max_brightness )) + +# calculate new brightness % +new_brightness_p=$(($old_brightness_p $1)) + +# calculate new brightness value +new_brightness=$(( $max_brightness * $new_brightness_p / 100 )) + +# set the new brightness value +sudo chmod 666 $handler"brightness" +echo $new_brightness > $handler"brightness" diff --git a/config.h b/config.h index ebeb84c..9b0c83b 100644 --- a/config.h +++ b/config.h @@ -63,7 +63,7 @@ static const Layout layouts[] = { /* commands */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ -static const char *dmenucmd[] = { "rofi", "-show", "drun", NULL}; +static const char *dmenucmd[] = { "rofi", "-show", "run", NULL}; //sets st as the default terminal static const char *termcmd[] = { "st", NULL }; //volume controls