[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] Problem with Mozilla / Links



On Sun, 2003-01-19 at 23:05, Eric Harrison wrote:
> On 16 Jan 2003, Matt wrote:
> 
> >Hrmm... It seems that whenever a user clicks a link in a program (say
> >such as Ximian) and they have mozilla open already... it tries to
> >RE-open mozilla.. rather then just spawning another window.   This of
> >course, results in Mozilla complaining because the profile is already in
> >use.
> >This doesn't happen on my personal computer running linux.. but it's
> >happening on the LTSP that others here are using.   Any ideas what might
> >be causing this and/or how to fix this?
> 
> What version of K12LTSP? 
> 
> -Eric
> 

Have you tried Cliff Wells' "mozy"?

It is a python script, write me if it does not come through cleanly.

js

#! /usr/bin/env python

#
# Program: mozy
# Author:  Cliff Wells <clifford wells attbi com>
# Version: 0.5
#
# Does what gnome-moz-remote ought to: if a browser window is open,
# opens url in a new tab. If no browser is open, opens one.
#
# Usage: mozy [--browser browser] [--url] <url>
#        mozy --help
# Examples: mozy "http://www.google.com";
#           mozy --browser opera "http://www.google.com";
#           mozy --browser mozilla --url "http://www.google.com";
#   Note that the first argument that doesn't start with -- terminates
#   further processing of arguments.
#
# Bugs:
#  - Konqueror doesn't support remote commands or tabbed browsing, aka NOTABUG.
#


# ========================== user configuration ===============================

# General options
browser = 'opera' # one of mozilla, opera, konqueror

# Opera options
usejava = 1       # enable Java
java = 'java'     # Java binary name
forceSDIMode = 1  # make it more like Mozilla's tabbed browsing

# ========================= end user configuration ============================

import sys, os, getopt

usejava = usejava and os.system("which %s > /dev/null" % java) == 0

browserOptions = {
    'mozilla':   '-remote "openURL("%s", new-tab)"',
    'opera':     '-remote "openURL("%%s", new-page)" %s' % ['', '-windowmode sdi'][forceSDIMode],
    'konqueror': '--profile webbrowsing "%s"', # no remote commands? no tabbed browsing? pfft.
    }

# -----------------------------------------------------------------------------
def help():
    print "\nUsage: mozy [--browser <mozilla|opera|konqueror>] [--url] <url>"
    print "       mozy --help\n\n"

# -----------------------------------------------------------------------------
def getopts(argv):
    try:
        options = getopt.getopt(sys.argv[1:], "", ["help", "browser=", "url="])
    except getopt.GetoptError, msg:
        print msg
        help()
        raise SystemExit

    opts = {}
    for opt, value in options[0]:
        opts[opt[2:]] = value

    if 'url' not in opts:
        try:
            opts['url'] = options[1][0]
        except IndexError:
            opts['url'] = 'about:blank'
    
    return opts

# =============================================================================


options = getopts(sys.argv)

if 'help' in options:
    help()
    raise SystemExit

if 'browser' in options:
    if options['browser'] in browserOptions:
        browser = options['browser']

if browser == 'opera' and usejava:
    os.putenv("OPERA_FORCE_JAVA_ENABLED", '1')
    # print "Java%senabled" % (' not ', ' ')[usejava]

if os.fork():
    raise SystemExit
else:
    if os.system('%s %s' % (browser, browserOptions[browser] % options['url'])):
        os.system('%s "%s"' % (browser, options['url']))
    

    
    
                  

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]