alternating_layouts.py
def main():
    """
    Main function - listen for window focus
        changes and call set_layout when focus
        changes
    """
    opt_list, _ = getopt.getopt(sys.argv[1:], 'hp:')
    pid_file = None
    for opt in opt_list:
        if opt[0] == "-h":
            print_help()
            sys.exit()
        if opt[0] == "-p":
            pid_file = opt[1]

    if pid_file:
        with open(pid_file, 'w') as f:
            f.write(str(os.getpid()))

    i3 = Connection()
    i3.on(Event.WINDOW_FOCUS, set_layout)
    i3.main()

    Main function - listen for window focus
        changes and call set_layout when focus
        changes
    
Main function - listen for window focus
changes and call set_layout when focus
changes
Main function - listen for window focus changes and call set_layout when focus changes
def main():
    opt_list, _ = getopt.getopt(sys.argv[1:], 'hp:')
    pid_file = None
    for opt in opt_list:
        if opt[0] == "-h":
            print_help()
            sys.exit()
        if opt[0] == "-p":
            pid_file = opt[1]
    if pid_file:
        with open(pid_file, 'w') as f:
            f.write(str(os.getpid()))
    i3 = Connection()
    i3.on(Event.WINDOW_FOCUS, set_layout)
    i3.main()
def main ( ) : opt_list , _ = getopt . getopt ( sys . argv [ 1 : ] , 'hp:' ) pid_file = None for opt in opt_list : if opt [ 0 ] == "-h" : print_help ( ) sys . exit ( ) if opt [ 0 ] == "-p" : pid_file = opt [ 1 ] if pid_file : with open ( pid_file , 'w' ) as f : f . write ( str ( os . getpid ( ) ) ) i3 = Connection ( ) i3 . on ( Event . WINDOW_FOCUS , set_layout ) i3 . main ( )
Main function - listen for window focus
changes and call set_layout when focus
changes
Main function - listen for window focus changes and call set_layout when focus changes
"""
    Main function - listen for window focus
        changes and call set_layout when focus
        changes
    """