1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import getpass
from time import sleep
from dogtail.tree import root
from dogtail.logging import debug_message
debug_message(message="Executing dogtail-logout script.")
debug_message(message="Saving the gnome-shell Accessibility object.")
shell = root.application("gnome-shell")
debug_message(message="Open the System menu.")
shell.child(name="System", roleName="menu").click()
debug_message(message="Open the user menu.")
shell.child(name=getpass.getuser(), roleName="label").click()
debug_message(message="Click Log Out.")
shell.child(name="Log Out", roleName="label").click()
debug_message(message="Confirm logging out.")
shell.findChild(lambda x: x.name == "Log Out" and x.roleName in ("button", "push button")).click()
debug_message(message="Some sleep that wont get to the end as the session will end.")
sleep(5)
|