Screen brightness decreases when on battery power (Solved)

Using applications, configuring, problems
Post Reply
Message
Author
scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

Screen brightness decreases when on battery power (Solved)

#1 Post by scientist »

My vision is not what it used to be.

When I run only on battery power on my laptop, the screen brightness decreases a lot.

Is there a way to stop that ?
Last edited by scientist on Wed 22 Jul 2015, 22:50, edited 1 time in total.
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#2 Post by bigpup »

What is the computer make and model?

What version of Puppy?
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

#3 Post by scientist »

bigpup wrote:What is the computer make and model?

What version of Puppy?
HP 6730b.

Slacko Puppy 5.9.3 JWM
Linux Kernel: 3.4.94 (i686)
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

User avatar
Burn_IT
Posts: 3650
Joined: Sat 12 Aug 2006, 19:25
Location: Tamworth UK

#4 Post by Burn_IT »

That is usually a function and option in the Set Up of the computer.
It is with all mine, none of which are HP by the way.
"Just think of it as leaving early to avoid the rush" - T Pratchett

rokytnji
Posts: 2262
Joined: Tue 20 Jan 2009, 15:54

#5 Post by rokytnji »

Not sure if this works in Slack0

Code: Select all

xbacklight -set 100
Won't hurt to try it out though. Maybe HP hotkey brightness?

Fn+F7 or Fn+F8? Fn+F10? Not sure because I do not own HP either.

scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

#6 Post by scientist »

rokytnji wrote:Not sure if this works in Slack0

Code: Select all

xbacklight -set 100
You get a gold start with xbacklight.

It has to be run after power cable is disconnected.
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

Continually Check battery state

#7 Post by scientist »

I would to create a script that continually checks the status of the battery.

And execute xbacklight if "discharging" is detected.

This is what I have so far.

Code: Select all

cat /proc/acpi/battery/BAT0/state

Look for discharging and if so then

xbacklight -set 100
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

rokytnji
Posts: 2262
Joined: Tue 20 Jan 2009, 15:54

#8 Post by rokytnji »

scientist wrote:
rokytnji wrote:Not sure if this works in Slack0

Code: Select all

xbacklight -set 100
You get a gold start with xbacklight.

It has to be run after power cable is disconnected.
Thanks. Good to know it works in Slack0. After reading myself out of curiosity
$ batwatch -p /run/batwatch.pid -T 30.1 -x /path/to/backlight-script.sh -T 6 -x /path/to/suspend-script.sh
from

https://github.com/dywisor/batwatch

Just wondering with Slack0's battery monitor applet. If your ideas can be inserted in Slack0's battery applet script.

Just musing here in the desert. :roll:

I am not a coder or script writer. Just a tattoed puppy linux using
scooter tramp with a GED education.

scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

#9 Post by scientist »

I am studying grep as I think it will be used as well. :-)

I think this will be a major project.
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

#10 Post by scientist »

The script instagitlet.sh looks promising, but I can not find it.

Code: Select all

https://github.com/dywisor/batwatch
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

#11 Post by scientist »

This cron appears to work o.k.
* * * * * xbacklight -set 100 #Bright_Always_On
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#12 Post by Semme »

Cron? Good call.
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

#13 Post by scientist »

It runs all the time.

This is supposed to check if the battery is discharging, but it says
"command not found."

Code: Select all

acpi -V | grep -q discharging && xbacklight -set 100 || xbacklight -set 200
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#14 Post by Semme »

So which don't you have, the acpi pkg or xbacklight? Heaven forbid you post a source link.
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

#15 Post by scientist »

Acpi

Source link for what ??
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#16 Post by greengeek »

I know you have marked this solved but I thought I would chuck in my 2cents worth. I have been practicing my novice bash scripting and come up with the following:

Code: Select all

#!/bin/bash

#2015Jul27 Greengeek script to sample battery charge state and perform some
#action depending on state.
#Note: possible states are charged, charging, discharging

number=1
while [ $number = 1 ]; do

BATTSTATE=$(grep charg /proc/acpi/battery/*/state | awk '{print $3}')

if [ "$BATTSTATE" = "charging" ]; then
echo "Battery is charging"
xbacklight -set 100 &
else
if [ "$BATTSTATE" = "discharging" ]; then
echo "Battery is discharging"
xbacklight -set 50 &
else
if [ "$BATTSTATE" = "charged" ]; then
echo "Battery is charged"
xbacklight -set 100 &
fi
fi
fi
sleep 3
done
This does the opposite of what you asked - it turns the backlight down during battery discharging, but you can easily substitute a different value in the xbacklight line for when $BATTSTATE = discharging and keep the backlight at whatever intensity you want.

The script checks the battery state every 3 seconds so when the laptop power adaptor is turned off you would see your backlight dim for a short period of time. You can change the sleep timeout if you want to change this delay.

Disclaimer:- code may contain traces of peanuts. User discretion advised.
.

scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

#17 Post by scientist »

I went with this modification of your excellent script.

Code: Select all

#!/bin/bash
#2015Jul27 Greengeek script to sample battery charge state and perform some
#action depending on state.
#Note: possible states are charged, charging, discharging

number=1
while [ $number = 1 ]; do

BATTSTATE=$(grep charg /proc/acpi/battery/*/state | awk '{print $3}')

if [ "$BATTSTATE" = "discharging" ]; then
#echo "Battery is discharging"
xbacklight -set 100 &
fi
# check every 10 minutes
sleep 600
done
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#18 Post by greengeek »

Great! Glad it was useful!

Post Reply