Dim laptop monitor immediately after the laptop being unplugged

jahid_0903014
  9 years ago
  6

The current cinnamon (2.2) settings doesn't have the option to dim monitor automatically immediately after the laptop is unplugged. The current settings dim the monitor after a fixed interval of inactiveness and theres no option to set this interval to zero. But what I prefer is to dim the monitor whenever the power cord is unplugged regardless of what i am doing on my laptop.

I have searched quite a bit on how to dim monitor immediately after unplugging the power cord and found a convevient way for me to do this job by combining some of the solutions I found. I am willing to share my solution in this regard for those who need this functionality in their laptop.

1. Getting the required packages:
I will be using two additional softwares for this:
1. xbacklight
2. cuttlefish

Installing the required software packages:
commands:
sudo apt-get install xbacklight
sudo add-apt-repository ppa:ubuntuhandbook1/apps
sudo apt-get update
sudo apt-get install cuttlefish


2. Writing two scripts:
1.script dim_screen

command:

gedit ~/dim_screen
now copy the following texts and save the file:
#!/bin/bash
xbacklight -set 50 
  #this means 50% brightness.you can set this value to whatever you want.
2. script bright_screen
command:

gedit ~/bright_screen
now copy the following texts and save the file:
#!/bin/bash
xbacklight -set 100


3. Preparing cuttlefish (final step):

1. open cuttlefish
click new
in the "basics" tab put dim_screen in the name field(you can put whatever name you want)
"on" the slider indicated by "Activated by stimulus" (It's off by default)
choose stimulus(by clicking on "none", then category "Hardware" then "Power cable unplugged"
now go to the "Reaction tab"
click on the plus(+) sign at bottom and select "Applications" from category then "start Application (advanced mode)", click ok.
now click on the button beside "Executable" and browse to the file dim_screen (It's in your home folder). Leave every other thing unchanged.

2. Now follow the same steps as 3.1 for the script bright_screen as well, and choose "Power cable plugged in" for stimulus this time.

When you have completed everything as stated above your laptop will dim to the set value when unplugged and come back to full brightness when plugged in again.



 

Comments
MagicMint 8 years ago

Thank you for sharing this tutorial. With cuttlefish, I’ve finally got rid of a nasty, useless built-in “CD-ROM” on an external drive without having to fiddle around with udev rules :-)


Hammer459 9 years ago

Very well written, I will try this out when I install a new laptop