Sunday, October 20, 2013

Bash script: Volume and Brightness [Ubuntu 12.04]

1) Brightness.sh 

Allows you to set up brightness of your monitor using terminal.

Following command is used to set brightness level.

sudo sh -c 'echo <brightness> > /sys/class/backlight/<device>/brightness'

Here <brightness> is brightness level, and takes integer values starting from 0. Higher the value, higher the brightness.


2) Volume.sh 

Allows you to mute or unmute speakers.

Mute

pactl set-sink-mute 0 1

Enable speakers

pactl set-sink-mute 0 0

Here pactl stands for 'Pulse Audio Control'

3) Startup.sh

This script will run every bash script from given directory.

I use this script for switching profiles.

For example if I store brightness.sh and volume.sh in startup_scripts directory and run startup.sh then this startup.sh will run both brightness.sh and volume.sh for me.



No comments:

Post a Comment