opening external URL's in new tabs?

manouchk manouchk at gmail.com
Wed Apr 19 13:46:33 BST 2006


problem solved.
Iuse option --caption of konqueror to recocgnise a window of konqueror. I made 
a python script that open this window if it exists else it opens one. It 
works from command line on my mandriva 2005LE (KDE 3.4.2), I will test from 
kmail soon!

I use caption konqueror-bureau2 which in english means konqueror-desktop2.
The script:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os,sys,pylab

a=os
tmpfile="tmpfile_dcop"
os.system("dcop>%s"%tmpfile)
f = file(tmpfile)
windows=[]
for l in f:
        if l.count("konqueror-"):windows.append(l.split()[0])
f.close()
os.remove(tmpfile)
good_konqueror=""
for k in windows:
        print "dcop %s konqueror-mainwindow\#1 caption\(\) >%s"%(k,tmpfile)
        os.system("dcop %s konqueror-mainwindow\#1 caption\(\) 
>%s"%(k,tmpfile) )
        f = file(tmpfile)
        for l in f:
                if l.split()[-1].count("bureau2"):
                        os.system("more %s"%tmpfile)
                        good_konqueror=k
        os.remove(tmpfile)
        f.close()
print("variable good_konqueror is :%s"%good_konqueror)
if good_konqueror:os.system("dcop %s konqueror-mainwindow\#1 newTab 
%s"%(good_konqueror,sys.argv[
1]))
else:
        if sys.argv[1].count("http://"):
                url=sys.argv[1]
        else:url="http://"+sys.argv[1]
        os.system("konqueror --profile webbrowsing --caption konqueror-bureau2 
%s&"%url)


One could make another script which would detect window having a webbrosing 
profile etc... There are many possibilities..

Now with that konqueror could fight with firefox! That was the option missing, 
I think.

Cheers,
Emmanuel.
___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list