# Path: lib/process.py
# def get_simple_cmd_output(cmd, stderr=STDOUT):
#     """Execute a simple external command and get its output.
# 
#     The command contains no pipes. Error messages are
#     redirected to the standard output by default.
#     """
#     args = shlex.split(cmd)
#     return Popen(args, stdout=PIPE, stderr=stderr).communicate()[0].decode("utf8")


import shlex
import sys
import webbrowser
from optparse import OptionParser
from subprocess import call
from time import sleep
from lib.process import get_simple_cmd_output
Author:  Laszlo Szathmary, 2011 (jabba.laci@gmail.com)
Website: https://ubuntuincident.wordpress.com/2011/03/09/open-urls-in-browser-tabs-simultaneously/
GitHub:  https://github.com/jabbalaci/Bash-Utils

Read URLs from the standard input and open them in separated tabs.

Usage:
------
cat url_list.txt | ./open_in_tabs.py

Options:
  -n, --new-window      Open URLs in a new browser window.
  -s, --simultaneously  Open URLs simultaneously.

Warning! The combination -ns is experimental!

Last update: 2017-01-08 (yyyy-mm-dd)
"""



__version__ = '0.3.0'

FIREFOX = webbrowser.get('firefox')
FIREFOX_PROCESS = 'firefox'         # look for it in the output of 'ps'
FIREFOX_EXE = 'firefox'                 # Firefox executable
DELAY = 3.0                             # seconds


def is_firefox_running():

# Path: lib/process.py
# def get_simple_cmd_output(cmd, stderr=STDOUT):
#     """Execute a simple external command and get its output.
# 
#     The command contains no pipes. Error messages are
#     redirected to the standard output by default.
#     """
#     args = shlex.split(cmd)
#     return Popen(args, stdout=PIPE, stderr=stderr).communicate()[0].decode("utf8")


# Path: open_in_tabs.py
import shlex
import sys
import webbrowser
from optparse import OptionParser
from subprocess import call
from time import sleep
from lib.process import get_simple_cmd_output

Author:  Laszlo Szathmary, 2011 (jabba.laci@gmail.com)
Website: https://ubuntuincident.wordpress.com/2011/03/09/open-urls-in-browser-tabs-simultaneously/
GitHub:  https://github.com/jabbalaci/Bash-Utils

Read URLs from the standard input and open them in separated tabs.

Usage:
------
cat url_list.txt | ./open_in_tabs.py

Options:
  -n, --new-window      Open URLs in a new browser window.
  -s, --simultaneously  Open URLs simultaneously.

Warning! The combination -ns is experimental!

Last update: 2017-01-08 (yyyy-mm-dd)
"""



__version__ = '0.3.0'

FIREFOX = webbrowser.get('firefox')
FIREFOX_PROCESS = 'firefox'         # look for it in the output of 'ps'
FIREFOX_EXE = 'firefox'                 # Firefox executable
DELAY = 3.0                             # seconds


def is_firefox_running():

    output = get_simple_cmd_output('ps ux')