forked from Keyitdev/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: Updated scripts, changed HDMI name.
- Loading branch information
Showing
7 changed files
with
58 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
dir_icons="/usr/local/bin/icons" | ||
MON="HDMI-1" # Discover monitor name with: xrandr | grep " connected" | ||
STEP=10 # Step Up/Down brightnes by: 5 = ".05", 10 = ".10", etc. | ||
|
||
CurrBright=$( xrandr --verbose --current | grep ^"$MON" -A5 | tail -n1 ) | ||
CurrBright="${CurrBright##* }" # Get brightness level with decimal place | ||
|
||
Left=${CurrBright%%"."*} # Extract left of decimal point | ||
Right=${CurrBright#*"."} # Extract right of decimal point | ||
|
||
MathBright="0" | ||
[[ "$Left" != 0 && "$STEP" -lt 10 ]] && STEP=10 # > 1.0, only .1 works | ||
[[ "$Left" != 0 ]] && MathBright="$Left"00 # 1.0 becomes "100" | ||
[[ "${#Right}" -eq 1 ]] && Right="$Right"0 # 0.5 becomes "50" | ||
MathBright=$(( MathBright + Right )) | ||
|
||
dunstify -a "Brightness" \ | ||
"Brightness" \ | ||
"Current brightness is $MathBright%" \ | ||
-r 100 \ | ||
-i "$dir_icons"/sun.svg | ||
|
||
[[ "$1" == "up" || "$1" == "+" ]] && MathBright=$(( MathBright + STEP )) | ||
[[ "$1" == "down" || "$1" == "-" ]] && MathBright=$(( MathBright - STEP )) | ||
[[ "${MathBright:0:1}" == "-" ]] && MathBright=0 # Negative not allowed | ||
[[ "$MathBright" -gt 150 ]] && MathBright=150 # Can't go over 1.50 | ||
|
||
if [[ "${#MathBright}" -eq 3 ]] ; then | ||
MathBright="$MathBright"000 # Pad with lots of zeros | ||
CurrBright="${MathBright:0:1}.${MathBright:1:2}" | ||
else | ||
MathBright="$MathBright"000 # Pad with lots of zeros | ||
CurrBright=".${MathBright:0:2}" | ||
fi | ||
|
||
xrandr --output "$MON" --brightness "$CurrBright" # Set new brightness |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters