I modified a little bit the script in order to be better, i.e. work when konqueror instance is hidden : #!/usr/bin/env python import os,sys,pylab caption="konqueror-bureau2" #get all konqueror instances in windows list f=os.popen("dcop|grep konqueror") windows=[] for l in f: windows.append(l.split()[0]) f.close() #get the right konqueror instance in good_konqueror variable good_konqueror="" for k in windows: f=os.popen("dcop %s konqueror-mainwindow\#1 caption\(\)"%k) if f.readline().count(caption):good_konqueror=k f.close() #adjust url if missing http:// if sys.argv[1].count("http://") or sys.argv[1].count("ftp://") or sys.argv[1].count("https://") : url=sys.argv[1] else:url="http://"+sys.argv[1] #if the right konqueror exist : # -check that it is not hidden if it is restore it # -open url in a tab #if not open a new instance of konqueror if good_konqueror: f=os.popen("dcop %s konqueror-mainwindow\#1 hidden\(\)"%good_konqueror) if f.readline().split()[0].count('true'): os.system("dcop %s konqueror-mainwindow\#1 restore\(\)"%good_konqueror) os.system("dcop %s konqueror-mainwindow\#1 newTab %s"%(good_konqueror,sys.argv[1])) else: os.system("konqueror --profile webbrowsing --caption %s %s&"%(caption,url)) hope someone test it, just to see if it works not only here! Cheers, EMmanuel. Le Mercredi 19 Avril 2006 10:23, manouchk a écrit : > to avoid using temporary file, I modified the script to use pipe it's a > cleaner code and also a shorter one! > > [code=python] > #!/usr/bin/env python > # -*- coding: utf-8 -*- > > import os,sys,pylab > > f=os.popen("dcop") > windows=[] > for l in f: > if l.count("konqueror-"):windows.append(l.split()[0]) > f.close() > good_konqueror="" > for k in windows: > f=os.popen("dcop %s konqueror-mainwindow\#1 caption\(\)"%k) > for l in f: > if l.split()[-1].count("bureau2"): > good_konqueror=k > f.close() > if sys.argv[1].count("http://"): > url=sys.argv[1] > else:url="http://"+sys.argv[1] > if good_konqueror:os.system("dcop %s konqueror-mainwindow\#1 newTab > %s"%(good_konqueror,sys.argv[1])) > else: > os.system("konqueror --profile webbrowsing --caption konqueror-bureau2 > %s&"%url) > [/code] > > hope it would help somebody out there, searching on the web answer to that > problem, I've seen may peoples willing to do this kind of stuff with > konqueror, never encountered any answer! > ___________________________________________________ > . > Account management: https://mail.kde.org/mailman/listinfo/kde. > Archives: http://lists.kde.org/. > More info: http://www.kde.org/faq.html. ___________________________________________________ . Account management: https://mail.kde.org/mailman/listinfo/kde. Archives: http://lists.kde.org/. More info: http://www.kde.org/faq.html.