philippnormann / xrandr-brightness-script Goto Github PK
View Code? Open in Web Editor NEW๐ Script for adjusting the brightness and color temperature of displays on a software level using xrandr.
License: GNU General Public License v3.0
๐ Script for adjusting the brightness and color temperature of displays on a software level using xrandr.
License: GNU General Public License v3.0
@philippnormann Thanks for creating a beautiful piece of code. I had an issue with my Lenovo Legion and I used to manually update the brightness. I found this repo while searching for night mode settings using gamma. This script does both of those things. Now I can automate screen settings and key bindings.
Few suggestions, we can an ability to update gamma/temp and brightness with a single command. I am planning to integrate night mode using this repo.
Let me know what you think about it.
Hi, Thanks a lot for sharing this script. I am trying to control brightness on Ubuntu 18.04, having nvidia 710 graphics card on a desktop.
Is it possible to combine your script with some keyboard shortcut (for ex. ctrl+up, ctrl+dn) to control brightness.
If it is already possible with your script, would you be kind enough and guide on how to achieve it?
Many thanks in advance!
~ajay
Hi,
This is a cool script that does its job, but it's hard coded to the first display found by xrandr. If we provide the second connected display as a second argument, it will still using the brightness value of the first display.
I suggest the following changes, if you like this, please commit:
#!/bin/sh
USAGE() {
echo '#############################################'
echo "Please provide two arguments."
echo "First should be - or +"
echo "Second should be a name of connected display"
echo
echo "Please see the list of connected displays:"
xrandr -q|grep -w connected|awk '{print $1}'
echo '#############################################'
}
if xrandr -q | grep -o
CURRBRIGHT=$(xrandr -q --verbose|grep -A 5 $2|awk '/Brightness/ {print $NF}')
if [ -z $CURRBRIGHT ]; then
echo "Current brightness for provided display has an empty value. Is this display connected?"
echo "Please see the list of connected displays:"
xrandr -q|grep -w connected|awk '{print $1}'
exit 1
else
if [ "$1" = "+" ] && [ $(echo "$CURRBRIGHT < 1" | bc) -eq 1 ]
then
xrandr --output
elif [ "$1" = "-" ] && [ $(echo "$CURRBRIGHT > 0" | bc) -eq 1 ]
then
xrandr --output
fi
fi
else
USAGE
fi
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.