Using python to start programs after logging in

Cecil Westerhof Cecil at decebal.nl
Thu Jan 19 14:08:32 EST 2017


I am writing a python program to start the programs that need to be
started after logging in.

I have the following imports:
    from subprocess import check_call, Popen, STDOUT
    from time       import sleep, strftime

And use the following code:
    check_call(tuple('wmctrl -s 10'.split()))
    log_file = open('Logging/firefox_%T.log'.replace('%T', strftime('%F_%R')), 'w')
    Popen(tuple('firefox'.split()), stdout = log_file, stderr = STDOUT)

The first statement is to go to the correct desktop.

Is this a good way to do things, or could I do it in a better way?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the Python-list mailing list