def cmd_keyboard(): xset('r', 'rate', 200, 40) setxkbmap( '-layout', 'de', '-variant', 'nodeadkeys', '-option', 'caps:escape' )
def change_transfer_functions(id): if id == 1: print(sh.xset("m", "8/1", "5")) elif id == 2: print(sh.xset("m", "1/8", "5")) elif id == 3: print(sh.xset("m", "8/1", "1")) elif id == 4: print(sh.xset("m", "1/8", "1")) elif id == 99: print(sh.xset("m", "default"))
def backlight_set(): '''dim the backlight after a set number of minutes''' bl_path = Path('/sys/class/backlight/intel_backlight/brightness') assert bl_path.access(W_OK) maxb_path = Path('/sys/class/backlight/intel_backlight/max_brightness') maxb = maxb_path.text().strip() maxb = '%d' % (int(maxb) // 1.2) while True: try: xset('dpms', 'force', 'on') bl_path.write_text(maxb) sleep(60*18) bl_path.write_text('300') sleep(60*2) cnt = 0 step = 15 minutes = 10 while cnt < minutes*60: xmessage('-timeout', str(step-1), str(minutes*60-cnt)) xset('dpms', 'force', 'off') sleep(step) cnt += step finally: bl_path.write_text(maxb) xset('dpms', 'force', 'on')
def cmd_pres_on(): xset('s', 'off') xset('-dpms') _change_vim_color_scheme(('zenburn', 'default'), ('dark', 'light')) _set_termite_config('config_light')
def cmd_pres_off(): xset('s', 'on') xset('+dpms') _change_vim_color_scheme(('default', 'zenburn'), ('light', 'dark')) _set_termite_config('config_dark')
from path import Path from time import sleep from os import W_OK from sh import xset,xmessage bl=Path('/sys/class/backlight/intel_backlight/brightness') assert(bl.access(W_OK)) maxb=Path('/sys/class/backlight/intel_backlight/max_brightness').text().strip() maxb = '%d' % (int(maxb) // 1.2) while True: try: xset('dpms', 'force', 'on') bl.write_text(maxb) sleep(60*18) bl.write_text('300') sleep(60*2) cnt=0 step=15 minutes=10 while cnt < minutes*60: xmessage('-timeout', str(step-1), str(minutes*60-cnt)) xset('dpms', 'force', 'off') sleep(step) cnt+=step finally: bl.write_text(maxb) xset('dpms', 'force', 'on')