def xorg(name):
    '''
    Set the keyboard layout for XOrg

    layout
        The keyboard layout to use
    '''
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}
    if __salt__['keyboard.get_x']() == name:
        ret['result'] = True
        ret['comment'] = 'XOrg layout {0} already set'.format(name)
        return ret
    if __opts__['test']:
        ret['comment'] = 'XOrg layout {0} needs to be set'.format(name)
        return ret
    if __salt__['keyboard.set_x'](name):
        ret['changes'] = {'layout': name}
        ret['result'] = True
        ret['comment'] = 'Set XOrg keyboard layout {0}'.format(name)
        return ret
    else:
        ret['result'] = False
        ret['comment'] = 'Failed to set XOrg keyboard layout'
        return ret