Skip to content

Instantly share code, notes, and snippets.

@doyousketch2
Last active March 18, 2017 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doyousketch2/cb32c7cb990c686d82359f7a6063e493 to your computer and use it in GitHub Desktop.
Save doyousketch2/cb32c7cb990c686d82359f7a6063e493 to your computer and use it in GitHub Desktop.

OpenSource PythonVersions License Git.io

Simple Python GUI for Redshift.

Dim your screen with a click.
Only runs when you want it to.
Doesn't run in background,
So it won't eat up your valuable memory.
Change brightness to your current mood.

New

Wasn't too happy with the auto-dimmer feature for Redshift,
so I wrote my own simple 5-choice button-box.

'X' doesn't seem to do anything on EasyGui buttonboxes, go figure.
So the blank button exits, in case you change your mind.

Like the screen to be as bright as my alertness level,
and it's not at the same time every day.

Put a launcher button on my taskbar.
1 click to open, 1 click to set brightness.

2 clicks total. In & out. Real fast.
Does what I want it to.

And now it's yours,
for the most excellent price of: free:bangbang:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
##=========================================================
## redshifty.py 5 Dec 2016
##
## simple Redshift GUI
##
## Eli Leigh Innis
## Twitter : @ Doyousketch2
## Email : Doyousketch2 @ yahoo.com
##
## GNU GPLv3 gnu.org/licenses/gpl-3.0.html
##=========================================================
## required ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## first, you'll need redshift:
## sudo apt-get install redshift
## (or use synaptic package manager)
## then you'll need easygui:
## sudo pip install easygui
## (or)
## sudo python -m pip install easygui
##=========================================================
## libs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import os ## commandline
import sys ## for exit command
import easygui as eg ## Graphical User Interface
##=========================================================
## script ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## buttonbox(msg='', title=' ', choices=('Button1', 'Button2', 'Button3'), image=None, root=None)
brightness = eg .buttonbox('Brightness?', 'Redshifty', ('0.6', '0.7', '0.8', '0.9', '1.0', ''))
if brightness is '':
sys.exit()
redshift = 'redshift -o -b '
if brightness == '0.6' :
temp = (' -O 5000')
elif brightness == '0.7' :
temp = (' -O 6000')
elif brightness == '0.8' :
temp = (' -O 7000')
elif brightness == '0.9' :
temp = (' -O 8000')
else :
temp = (' -O 8500')
##=========================================================
## main ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
os .system(redshift + brightness + temp)
##=========================================================
## eof ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment