Skip to content

Instantly share code, notes, and snippets.

@PhDP
Last active December 20, 2015 06:29
Show Gist options
  • Save PhDP/6085889 to your computer and use it in GitHub Desktop.
Save PhDP/6085889 to your computer and use it in GitHub Desktop.
Ruby script to set the brightness on my Dell XPS (the normal way fails after Ubuntu 13.04).
#!/usr/bin/env ruby
if ARGV.length != 1 then
puts 'Provide a single argument between 0.1 (nearly black) and 1.0 (max brigthness).'
exit(42)
end
b = ARGV[0].to_f
b = (if b < 0.1 then 0.1 elsif b > 1.0 then 1.0 else b end).to_s
puts 'Setting brightness to ' + b
exec 'xrandr --output eDP1 --brightness ' + b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment