diff options
author | Weitian LI <liweitianux@gmail.com> | 2014-06-13 21:12:21 +0800 |
---|---|---|
committer | Weitian LI <liweitianux@gmail.com> | 2014-06-13 21:12:21 +0800 |
commit | 78f7be4e4b6501b15b5fefc9f7824bbadf0daf2a (patch) | |
tree | b761e28709e4a6f45458c323b8870150827ef831 /.i3/py3status/backup/dpms.py | |
parent | e1ce158f65c472b7c8d14c04fce94c85bc881a6c (diff) | |
download | dotfiles-78f7be4e4b6501b15b5fefc9f7824bbadf0daf2a.tar.bz2 |
Added various dotfiles.
* Xresources
* profile, xprofile, xinitrc
* bash (aliases, logout, profile, rc, completion)
* gitconfig
* gtkrc and gtk-bookmarks
* i3 configs (with py3status configs)
* i3status.conf
* lftp/rc
* tmux.conf
* xbindkeysrc
* mpdconf
* ncmpcpp (config and keys)
* sbclrc
* vifm (vifmrc, colors)
* urxvt (perl extensions)
* conkyrc (and conky/cronograph configs)
Diffstat (limited to '.i3/py3status/backup/dpms.py')
-rw-r--r-- | .i3/py3status/backup/dpms.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/.i3/py3status/backup/dpms.py b/.i3/py3status/backup/dpms.py new file mode 100644 index 0000000..783c53c --- /dev/null +++ b/.i3/py3status/backup/dpms.py @@ -0,0 +1,44 @@ +from os import system + + +class Py3status: + """ + This module allows activation and deactivation + of DPMS (Display Power Management Signaling) + by clicking on 'DPMS' in the status bar. + + Written and contributed by @tasse: + Andre Doser <dosera AT tf.uni-freiburg.de> + """ + def __init__(self): + """ + Detect current state on start. + """ + self.run = system('xset -q | grep -iq "DPMS is enabled"') == 0 + + def dpms(self, i3status_output_json, i3status_config): + """ + Display a colorful state of DPMS. + """ + result = { + 'full_text': 'DPMS', + 'name': 'dpms' + } + if self.run: + result['color'] = i3status_config['color_good'] + else: + result['color'] = i3status_config['color_bad'] + return (0, result) + + def on_click(self, json, i3status_config, event): + """ + Enable/Disable DPMS on left click. + """ + if event['button'] == 1: + if self.run: + self.run = False + system("xset -dpms") + else: + self.run = True + system("xset +dpms") + system("killall -USR1 py3status") |