View Single Post
Old 04-15-2014, 12:20 AM   #13
arcadesdude
Lexically Impaired
arcadesdude ought to be getting tired of karma fortunes by now.arcadesdude ought to be getting tired of karma fortunes by now.arcadesdude ought to be getting tired of karma fortunes by now.arcadesdude ought to be getting tired of karma fortunes by now.arcadesdude ought to be getting tired of karma fortunes by now.arcadesdude ought to be getting tired of karma fortunes by now.arcadesdude ought to be getting tired of karma fortunes by now.arcadesdude ought to be getting tired of karma fortunes by now.arcadesdude ought to be getting tired of karma fortunes by now.arcadesdude ought to be getting tired of karma fortunes by now.arcadesdude ought to be getting tired of karma fortunes by now.
 
arcadesdude's Avatar
 
Posts: 28
Karma: 200518
Join Date: May 2008
Device: PW2
I managed to modify your script in a way that gives the UI that I want from this to be perfect now.

So when I turn it on, the minimum brightness I set it to 6 (since I read on 5 usually and lower). It will turn on to 6 for 10 seconds and then it will either restore the original brightness (or screen off) OR, if the brightness was changed after first turning it on (anything other than 'level 6') it will keep that new brightness setting.

This allows me to change the brightness level without having to wait 10 seconds for it to first to restore the old level and then set the new level. So if the light was off, for example, and I'm in a dark room, it will now be set to level 6 and then if I change it (say to 5 or 4) it will not turn off after 10 seconds and then require me to set the level as it would have before without my small modification. This way if the level is set other than 6 (minimumbrightnesslevel) then it will stay that way.

Here's what I changed to acheive this in frontlightmaster.sh:

Code:
# if brightness to use is really low, set the minimum brightness and wait a bit
		if [ $(get_brightness_to_use) -lt $MINIMUMBRIGHTNESSONSTART ]; then
			# remember brightness
			BRIGHTNESSONSTART=$(get_brightness_to_use)

			logger "Set minimum brightness to $MINIMUMBRIGHTNESSONSTART for $MINIMUMBRIGHTNESSONSTARTTIME seconds"
			set_brightness $MINIMUMBRIGHTNESSONSTART
			lipc-wait-event -s $MINIMUMBRIGHTNESSONSTARTTIME com.lab126.powerd goingToScreenSaver || true
		
			
			if [ $(get_current_brightness) -eq $MINIMUMBRIGHTNESSONSTART ]; then
				# reset brightness
				set_brightness $BRIGHTNESSONSTART
			fi

			LASTBRIGHTNESS=$(get_current_brightness)

		else
			# we start with the brightness that is currently set, this will update in a bit
			LASTBRIGHTNESS=$(get_current_brightness)
						
			
		fi
The part that is different is:

Code:
if [ $(get_current_brightness) -eq $MINIMUMBRIGHTNESSONSTART ]; then
				# reset brightness
				set_brightness $BRIGHTNESSONSTART
			fi
Thanks again, it's perfect now!
arcadesdude is offline   Reply With Quote