def postdock(state, config): ''' Executes postdock hook if it exists. :param bool state: Whether new state is on :param configparser.ConfigParser config: Global config :returns: None ''' hook = os.path.expanduser(config['hooks']['postdock']) if tps.has_program(hook): tps.call([hook, 'on' if state else 'off'], logger)
def postrotate(direction, config): ''' Executes postrotate hook if it exists. :param tps.Direction direction: Desired direction :param configparser.ConfigParser config: Global config :returns: None ''' hook = os.path.expanduser(config['hooks']['postrotate']) if tps.has_program(hook): tps.call([hook, direction.xrandr], logger)
def set_brightness(brightness): ''' Sets the brightness with ``xbacklight``. :param str brightness: Percent value of brightness, e. g. ``60%`` :returns: None ''' if not tps.has_program('xbacklight'): logger.warning('xbacklight is not installed') return status = tps.call(['xbacklight', '-set', brightness], logger) if status != 0: logger.warning('`xbacklight` cannot set the brightness, this is ignored.')
def set_brightness(brightness): ''' Sets the brightness with ``xbacklight``. :param str brightness: Percent value of brightness, e. g. ``60%`` :returns: None ''' if not tps.has_program('xbacklight'): logger.warning('xbacklight is not installed') return status = tps.call(['xbacklight', '-set', brightness], logger) if status != 0: logger.warning( '`xbacklight` cannot set the brightness, this is ignored.')