Skip to content

Instantly share code, notes, and snippets.

@mezcel
Last active September 20, 2019 02:44
Show Gist options
  • Select an option

  • Save mezcel/64db9afd5419e557c0ee53ed935d516e to your computer and use it in GitHub Desktop.

Select an option

Save mezcel/64db9afd5419e557c0ee53ed935d516e to your computer and use it in GitHub Desktop.
Make screen red (use xrandr, not redshift)

make screen red using bash

This uses xrandr to manipulate the screen gamma.

Its like redshift... but without the telemetry...

I tweaked the gamma to look appropriate on my solarized dark Gtk themes.

It may not look usable on normal color schemes.

#!/bin/bash
function redSetting {
echo "Making screen mildew yellow-green"
echo "Designed for screens using Dark Solarized-like color schemes"
echo "Intended for Photo Development Dark Rooms"
GAMMA=1:1:0.1
bright=0.7
}
function normalSetting {
echo "Making screen normal"
GAMMA=1:1:1
bright=1
}
function runXrANDr {
for output in $(xrandr --prop | grep \ connected | cut -d\ -f1); do
xrandr --output $output --gamma $GAMMA --brightness $bright
done
}
if [[ "$@" = "on" ]]; then
redSetting
runXrANDr
elif [[ "$@" = "off" ]]; then
normalSetting
runXrANDr
elif [[ "$@" = "test" ]]; then
redSetting
runXrANDr
sleep 5s
normalSetting
runXrANDr
else
echo Requires one of: "on", "off", "test"
exit 128
fi
#!/bin/bash
function redSetting {
echo "Making screen negative"
echo "Designed for screens using Dark Solarized-like color schemes"
echo "Intended for Photo Development Dark Rooms"
GAMMA=0:0:0
bright=-1
}
function normalSetting {
echo "Making screen normal"
GAMMA=1:1:1
bright=1
}
function runXrANDr {
for output in $(xrandr --prop | grep \ connected | cut -d\ -f1); do
xrandr --output $output --gamma $GAMMA --brightness $bright
done
}
if [[ "$@" = "on" ]]; then
redSetting
runXrANDr
elif [[ "$@" = "off" ]]; then
normalSetting
runXrANDr
elif [[ "$@" = "test" ]]; then
redSetting
runXrANDr
sleep 5s
normalSetting
runXrANDr
else
echo Requires one of: "on", "off", "test"
exit 128
fi
#!/bin/bash
function redSetting {
echo "Making screen red"
echo "Designed for screens using Dark Solarized-like color schemes"
echo "Intended for Photo Development Dark Rooms"
GAMMA=0:0:0.8
bright=-1
}
function normalSetting {
echo "Making screen normal"
GAMMA=1:1:1
bright=1
}
function runXrANDr {
for output in $(xrandr --prop | grep \ connected | cut -d\ -f1); do
xrandr --output $output --gamma $GAMMA --brightness $bright
done
}
if [[ "$@" = "on" ]]; then
redSetting
runXrANDr
elif [[ "$@" = "off" ]]; then
normalSetting
runXrANDr
elif [[ "$@" = "test" ]]; then
redSetting
runXrANDr
sleep 5s
normalSetting
runXrANDr
else
echo Requires one of: "on", "off", "test"
exit 128
fi
#!/bin/bash
if [[ "$@" = "on" ]]; then
echo Making screen red
GAMMA=4:1.5:1
elif [[ "$@" = "off" ]]; then
echo Making screen normal
GAMMA=1:1:1
else
echo Requires one of: "on", "off"
exit 128
fi
for output in $(xrandr --prop | grep \ connected | cut -d\ -f1); do
xrandr --output $output --gamma $GAMMA
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment