-   Linux - General (
-   -   xgamma startup script (

slightcrazed 05-28-2003 07:44 PM

xgamma startup script

This is something that was more of an annoyance than anything else, but I figured it couldn't hurt to post incase anyone else might have the same pet peeves that I do.

For the longest time I have had:

xgamma -gamma 2.4

in my .bash_profile so that it would automatically change my gamma on startup. The annoying part is when I log into a terminal outside of X and I get
"xgamma - command not found"

Now, as I am a stickler for having things operate correctly, I set to the task of writing a little script to correct this error. I searched the forums for a while and found several instances where people seemed to want to do the same thing I am doing (change gamma while in X automatically on startup) but all of the offered solutions would have resulted in the same error message. So I came up with the idea of adding:

ses=$(printenv | grep DISPLAY)
if [ -n "$ses" ]; then
xgamma -gamma 2.4

to my .bash_profile and voila! Now the gamma settings will change on startup, but ONLY IF X IS RUNNING. If X is not running, the xgamma command does not get run, and the previously mentioned error message is gone.

I am probably not the first person to ever do this, but it was a small personal accomplishment for myself that I felt was necessary to share.


P.S. I realize that this is probably more suited for "success stories", but I figured it would be more helpful here.

iceman47 05-28-2003 08:52 PM

add xgamma -gamma 2.4 to ~/.xinitrc and it'll do the trick too ;)

slightcrazed 05-28-2003 08:56 PM

Hmm.... never tried that one.


slightcrazed 05-28-2003 08:59 PM

OK, I don't have that file in my home dir. I do have an .Xclients file, and I attempted to run the command from their, to no avail. That is the main reason that I defaulted to the .bash_profile option.


iceman47 05-28-2003 09:21 PM

just create the file then

All times are GMT -5. The time now is 09:15 AM.