Git Product home page Git Product logo

monitor-brightness's Introduction

Monitor Brightness

This program allows you to control the brightness of your primary monitor on a software level from the command line. It uses the xrandr command to adjust the brightness and stores the current brightness level in a file for future reference.

Why?

xrandr allows you to set a brightness level with xrandr --output <outputname> --brightness <value> but doesn't allow you to simply increase or decrease it by a value. This script simply stores the brightness level so it can access it and increase/decrease it by whatever desired.

Options

The program also supports the following options:

  • --detectmonitor or -d: This option detects the primary monitor and saves its name. Use this option if you change your monitor and want to update the program with the new monitor name.
  • --help or -h: Displays the program's usage information.

Configuration

The program stores the brightness level and monitor name in a file located in the user's home directory. The default file name is .brightness. You can change the file name by modifying the FILENAME constant in the program.

Usage

To use the program, run the following command:

./brightness <value>

Replace <value> with the desired brightness level. The program accepts both positive and negative values. Positive values increase the brightness, while negative values decrease it. The program caps the brightness level at 0 and 10, ensuring that it doesn't go beyond the minimum or maximum limits.

How it works

On the first time you run it, it runs xrandr | grep "connected primary" | cut -f1 -d " " to get the name of your primary monitor and saves it in "$HOME/.brightness" along with the current brightness (represented as an int from 0 to 10). The program will now fetch the name of the monitor as well as the current brightness from "$HOME/.brightness" to save time in the next executions.

The script sets the brightness by running xrandr --output <outputname> --brightness <value>.

Notes

  • Since I have switched to Wayland, I no longer use the script and will not be updating it.

License

This project is licensed under the GNU General Public License. Feel free to modify and use it according to your needs.

monitor-brightness's People

Contributors

danilo-alm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.